NeerajPathak26
New User
Joined: 23 Feb 2006 Posts: 2
|
|
|
|
Hello,
Need help. I am creating a report. I run the report job from Monday to friday.If I run the report job on Monday I need to put the date of friday. If report run day is tuesday to friday I need to put previous day's date. I am getting the cuurent date and weekday as well using OUTREC BUILD=(1:DAYNAME,DATE1(-)). But I am not able to use IFTHEN condition to get the desired result for my requirement.
Appreciate your help on this one.
Thanks
Neeraj |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
NeerajPathak26 wrote: |
Hello,
Need help. I am creating a report. I run the report job from Monday to friday.If I run the report job on Monday I need to put the date of friday. If report run day is tuesday to friday I need to put previous day's date. I am getting the cuurent date and weekday as well using OUTREC BUILD=(1:DAYNAME,DATE1(-)). But I am not able to use IFTHEN condition to get the desired result for my requirement.
Appreciate your help on this one.
Thanks
Neeraj |
You can use PREVDday function to get last Friday date when the current day is a Monday.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DAYNAME,S'&LWDAY'
//SORTIN DD *
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:DAYNAME,DATE1-1)),
IFTHEN=(WHEN=(81,3,CH,EQ,C'MON'),
OVERLAY=(84,8,Y4T,PREVDFRI,TOGREG=Y4T(-))),
IFTHEN=(WHEN=NONE,OVERLAY=(84,4,C'-',88,2,C'-',90,2))
//* |
|
|