IBM Support

JCL VARIABLE " OCLASTC " usage with SETVAR directive

Question & Answer


Question

Results to be expected when adding/subtracting some number of months from &OCLASTC

Answer

In all previous releases of TWS z/OS, and in V8R3 prior to installing the PTFs for SPE APAR PK71280, adding or subtracting a number of months from any date via the SETVAR directive could result in an invalid date. For instance, subtracting three months from 31JUL would generate a date of 31APR. Since April has only 30 days, this date is invalid.

.

PK71280 updates this processing so that if the TARGET month has fewer days than the STARTING month, the DAYS part of the date will be adjusted as necessary to the LAST DAY of the TARGET month so as to create a valid date.

.

This enhancement has resulted in some confusion about use of IBM-supplied variable OCLASTC (The LAST CALENDAR DAY OF THE CURRENT MONTH) with SETVAR.

.


If you use OLASTC+2M, TWSz will add two months to the date of the last day of the current month. So if you use that syntax in February of 2009, the last day of the month is 28. Thus OCLASTC would be 28FEB09 (or 02/28/09). Adding two months results in 28APR09 (or 04/28/09). This is correct processing and was not changed by the SPE. Adding or subtracting some number of months to OCLASTC **DOES NOT** automatically generate the LAST CALENDAR DAY of the TARGET month.
.
What WAS changed was the processing that would have given an INVALID date. For instance, subtracting one month from 31MAR09 (03/31/09) used to result in 31FEB09 (02/31/09), which of course is impossible. PK71280 changes the processing WHEN THE TARGET MONTH IS SHORTER THAN THE STARTING MONTH so that a valid date is always generated. Thus,, for instance, subtracting
one month from 31, 30, or 29 MAR will give you 28FEB (except on leap years, of course).
[{"Product":{"code":"SSRULV","label":"IBM Workload Scheduler for z\/OS"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"--","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"All Versions;Version Independent","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

More support for:
IBM Workload Scheduler for z/OS

Software version:
All Versions, Version Independent

Operating system(s):
z/OS

Document number:
394331

Modified date:
13 September 2019

UID

swg21396155