View previous topic :: View next topic
|
Author |
Message |
ansu1990
New User
Joined: 09 Mar 2016 Posts: 3 Location: India
|
|
|
|
Hi all,
I am struggling to update date files everyday. the PS file has a date in this format :
00630444444444444444444444444444444444444444444444444444
2101C000000000000000000000000000000000000000000000000000
Here if you read one from bottom and one from top(alternate) you will get the date -20160310. I want to use rexx so that this is automatically updated to the current date.
Kindly Help. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
First off, your interpretation of the data is incorrect. It is packed decimal +020160310. The C at the end is one of the several packed decimal + signs. Rexx can handle packed decimal data, but it has a difficult time of it. There are examples in this forum, but you have to hunt around for them. |
|
Back to top |
|
|
ansu1990
New User
Joined: 09 Mar 2016 Posts: 3 Location: India
|
|
|
|
So is it possible to write a rexx code to update it to the current date then? |
|
Back to top |
|
|
ansu1990
New User
Joined: 09 Mar 2016 Posts: 3 Location: India
|
|
|
|
i found this code to convert packed decimal. i think i can use this, get the current date and convert into the particular format. but how to updtae the ps file with the new date?
...
packed = subst(Your_record,Start_pos,Length)
number = unpack(packed)
...
exit
unpack: procedure
parse arg pack
/* Convert packed data to hex and split */
char = c2x(pack)
numb = left( char, length(char)-1 )
sign = right( char, 1 )
/* Check sign and numeric sections */
if verify(sign, "ABCDEF" ) > 0 then ,
return ""
if verify( numb, "0123456789" ) > 0 then ,
return ""
/* Check negative sign */
if pos(sign, "BD" ) > 0 then,
return -numb
else ,
return numb |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello Anshuman,
Welcome to the forum.
Judging by your join date I am going to assume you are new to Mainframes. Your initiative to stop doing things manually and looking for alternatives is the right step.
However in this forum, when you ask questions you have to do a bit of ground work.. i.e searching/experimenting before expecting a solution.
Also you cannot expect anyone to give you complete working piece of code for your requirement.
You already have a piece of code that does conversions. Go through it, experiment and understand what each statement does. Once you do that, writing to PS file would not be much of a challenge. Time consuming, but it is solid investment and that's where the fun is. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
If there is only one recod in the dataset (it is not a file) then you close the dataset, re-open it, write your record and close the dataset again - no read. If there is more than one record then you will have to create a new dataset, delete the old one and rename the new one.
Edit (after seeing Willy's post): or use the DISKRU function of EXECIO. (Couldn't remember it off the top of my head!) |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Take a look at the DISKRU operand of the EXECIO function in the REXX Reference manual. You will still have to read up to the point where the date records is.
And do test it with a copy of the dataset. |
|
Back to top |
|
|
|