The following JCL will give you the desired results.
A brief explanation of the job. Your input file has just 2 digit year. But you need a 4 digit year to find out the leap year.
so we add a constant of 2000 to the year portion at 3 and find out if it is a leap year.
we now take that year and divide it by 4,100 and 400 and get the remainder on the inrec fields.
Now using a change command on OUTREC FIELDS we change the remainder to "L" if the remainder is a zero.
Using another change command on the OUTFIL OUTREC, we create a flag "L" if it is leap year and "N" if it is not a leap year.
We also subtract the month fields from one another. So if they are equal then the difference is zero and if they are different the difference is greater or lesser than 0.
Now we use this 2 flags(leap year and difference between months) and use another change command to decide if we need to update the record or not with another flag.
Based on the flag we increment the date field to the last day of the month.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Oct 25, 2010 12:34 pm Post subject:
Rahull,
With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports last day of week, month, quarter and year functions.
For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum