Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I do date math in REXX exec? 1

Status
Not open for further replies.

IDC3044

Technical User
Apr 17, 2003
12
US
I have a dataset created with an unload from a DB2 table that I am working with. I am changing a SystemID number to the LPAR letter representation and doing some other formatting within the rexx exec.

Using Rexx how could I remove any entries that are not from the date that is 2 days less than the current date?

I have timestamps within the dataset of the format:

2004-11-30-11.21.34.040000
2004-12-01-02.05.22.010000
2004-12-02-04.32.44.090000

Any ideas?
 
First, convert your ISOform date to the REXX S-form:
Code:
sformdate = Translate("CcYyMmDd", ISOformdate , "CcYy-Mm-Dd")

Now convert the S-form to B-form:
Code:
bformdate = Date("B", sformdate ,"S")

You can do math with a B-form date: subtract 2, then convert it back to S-form, then to ISOform. Handle time similarly. This should yield a date-time from 48 hours ago which you can match directly to the DB2 timestamps.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top