|
View previous topic :: View next topic
|
| Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Hi,
I wanted to add +1 to a date if it is found to be a Sunday.
The format of the date is YYYY-MM-DD.
I tried using Y4T option, but looks like it expects in the format of YYYYMMDD.
Please could you help!!
Thanks,
Madishpa |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
madishpa,
1.What is the LRECL and RECFM of the input/output file?
2. What is the position of the date field? |
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Hi,
LRECL is 20 and RECFM is FB.
Thanks,
Madishpa |
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Hi,
Just to add the date starts at position 1.
Thanks,
Madishpa. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
madishpa,
Use the following DFSORT JCL which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2012-08-10
2012-08-11
2012-08-12
2012-08-13
2012-08-14
2012-08-15
2012-09-30
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=20,IFTHEN=(WHEN=INIT,
OVERLAY=(21:1,10,UFF,M11,LENGTH=8,21,8,Y4T,WEEKDAY=CHAR3)),
IFTHEN=(WHEN=(29,3,CH,EQ,C'SUN'),
OVERLAY=(11:21,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)))
//* |
The output from this job is
| Code: |
2012-08-10
2012-08-11
2012-08-122012-08-13
2012-08-13
2012-08-14
2012-08-15
2012-09-302012-10-01 |
|
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Hi,
Thank you very much for the reply.
Please could you help advise as what would needs to be done if the date is as follows:
2012-08-12 2012-08-12 2012-08-12 2012-08-11
The expected o/p is as follows:
2012-08-13 2012-08-13 2012-08-13 2012-08-11
As the 2012-08-12 being a Sunday, the day has been incremented.
Appreciate your kind help.
Thanks
Madishpa. |
|
| Back to top |
|
 |
knickraj Warnings : 1 New User

Joined: 11 Jun 2007 Posts: 50 Location: Euro
|
|
|
|
try this..
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2012-08-12 2012-08-12 2012-08-12 2012-08-11
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=50,IFTHEN=(WHEN=INIT,
OVERLAY=(51:1,10,UFF,M11,LENGTH=8,51,8,Y4T,WEEKDAY=CHAR3,
71:12,10,UFF,M11,LENGTH=8,71,8,Y4T,WEEKDAY=CHAR3,
91:23,10,UFF,M11,LENGTH=8,91,8,Y4T,WEEKDAY=CHAR3,
111:34,10,UFF,M11,LENGTH=8,111,8,Y4T,WEEKDAY=CHAR3)),
IFTHEN=(WHEN=(59,3,CH,EQ,C'SUN'),
OVERLAY=(1:51,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)),HIT=NEXT),
IFTHEN=(WHEN=(79,3,CH,EQ,C'SUN'),
OVERLAY=(12:71,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)),HIT=NEXT),
IFTHEN=(WHEN=(99,3,CH,EQ,C'SUN'),
OVERLAY=(23:91,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)),HIT=NEXT),
IFTHEN=(WHEN=(119,3,CH,EQ,C'SUN'),
OVERLAY=(34:111,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-))) |
|
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Ohh...Thanks..
It helps..
Regards,
Madishpa |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| madishpa wrote: |
Hi,
Thank you very much for the reply.
Please could you help advise as what would needs to be done if the date is as follows:
2012-08-12 2012-08-12 2012-08-12 2012-08-11
The expected o/p is as follows:
2012-08-13 2012-08-13 2012-08-13 2012-08-11
As the 2012-08-12 being a Sunday, the day has been incremented.
Appreciate your kind help.
Thanks
Madishpa. |
Madishpa,
Can you tell me the trick of storing 4 date fields in CCYY-MM-DD format into a 20 byte FB file?
Why can't you tell us the actual requirement when you cannot modify the control cards supplied to you? You are just wasting not only your time as well as anyone who is trying to help you.
Knickraj,
I am sure you just got a glimpse of the actual number of date fields. It might be a month worth of data that needs to modify and in such cases it is better to go with weekday function to return the day of week in numeric format so that we can reduce the length of the expanded record. |
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Hi,
We we receive these 4 dates from a different application, for which we do not have control as they send these dates to different applications.
As our application alone does not run on a Sunday, we will have to consider incrementing the day by 1 which will be used down the line in the job.
Trust the requirement is clear.
Thanks
Madishpa |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|