IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX to update date in a PS file


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ansu1990

New User


Joined: 09 Mar 2016
Posts: 3
Location: India

PostPosted: Thu Mar 10, 2016 9:36 am
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Mar 10, 2016 9:48 am
Reply with quote

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
View user's profile Send private message
ansu1990

New User


Joined: 09 Mar 2016
Posts: 3
Location: India

PostPosted: Thu Mar 10, 2016 9:55 am
Reply with quote

So is it possible to write a rexx code to update it to the current date then?
Back to top
View user's profile Send private message
ansu1990

New User


Joined: 09 Mar 2016
Posts: 3
Location: India

PostPosted: Thu Mar 10, 2016 10:41 am
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Mar 10, 2016 12:41 pm
Reply with quote

Given that you're obviously a totally clueless newbie, you should never have asked this question here, but in stead you shouldhave gone to the Help & Support Forum for Mainframe Beginners...

'nuff said!
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Mar 10, 2016 2:25 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Mar 10, 2016 2:26 pm
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Thu Mar 10, 2016 3:35 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top