|
View previous topic :: View next topic
|
| Author |
Message |
Shanmugavel
New User
Joined: 15 Dec 2006 Posts: 7 Location: CHENNAI
|
|
|
|
| i want to subtract 45 days from the input date(which is present in the input PS) using easytrieve |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
Well, here's the REXX code
| Code: |
DAYS = 7
DATEOUT = DATE('S',DATE('B',DATE('J'),'J')-DAYS,'B')
TDAT = DATE('D',DATEOUT,'S')
JDAT = RIGHT(SUBSTR(DATEOUT,1,4),4,'0')!!RIGHT(TDAT,3,'0')
|
Which returns yyyyddd using either the system date as shown above, or can be easily modified to accept any date or format.
Works for leap years too ..............  |
|
| Back to top |
|
 |
lcmontanez
New User
Joined: 19 Jun 2007 Posts: 50 Location: Chicago
|
|
|
|
| Do you have access to DATECONV? |
|
| Back to top |
|
 |
anandinmainframe
Active User

Joined: 31 May 2007 Posts: 171 Location: India
|
|
|
|
Hi,
First seperate the input date as WS-MM WS-DD WS-YYYY in the input record.
now declare a new variable as WS-Date and compute that as
WS-Date = WS-DD - 45.
I hope this will work. |
|
| Back to top |
|
 |
lcmontanez
New User
Joined: 19 Jun 2007 Posts: 50 Location: Chicago
|
|
|
|
| anandinmainframe wrote: |
now declare a new variable as WS-Date and compute that as
WS-Date = WS-DD - 45. |
Did you account for the month/year changing? |
|
| Back to top |
|
 |
Shanmugavel
New User
Joined: 15 Dec 2006 Posts: 7 Location: CHENNAI
|
|
|
|
date CONV and papl date function are not working
and also the month and year are taken in to account
But i tried using DATE2000 it works fine. |
|
| Back to top |
|
 |
|
|