Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

REXX to update date in a PS file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: REXX to update date in a PS file
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 User


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

PostPosted: Thu Mar 10, 2016 9:48 am    Post subject:
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    Post subject: Reply to: REXX to update date in a PS file
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    Post subject: Reply to: REXX to update date in a PS file
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

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Thu Mar 10, 2016 12:41 pm    Post subject:
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: 1445
Location: Azeroth

PostPosted: Thu Mar 10, 2016 2:25 pm    Post subject:
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: 1715
Location: UK

PostPosted: Thu Mar 10, 2016 2:26 pm    Post subject:
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

New User


Joined: 01 Sep 2015
Posts: 96
Location: Switzerland

PostPosted: Thu Mar 10, 2016 3:35 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us