CHKDATE – Verify and generate dates

Use the CHKDATE command to verify the validity of the input date, allowing the same input formats and derive other variables from the input date in various formats. This command is equivalent to the OCL CHKDATE command and can be used to generate the same set of between 82 to 198 variables that the OCL command generates.

By default, the CHKDATE command runs in quick mode ( QUICK(Y)), which generates only variables that require calculation and cannot be natively generated by simple Workload Automation Programming Language commands. If you run CHKDATE with QUICK(N), all of the OCL equivalent variables are generated.

Specify:
CHKDATE DATE1(<ymd>)|DATE2(<dmy>) [CALNAME(<calendar>)] [INCVALUE(<0-30>)]
[FAIL(SKIP|STOP)] [FROM(<1-30>)] [MSG(Y|N)] [OCL(Y|N)] [QUICK(Y|N)]
where:
DATE1(<ymd>)
The input date in the format YYYYMMDD, YYMMDD, YYYY/MM/DD or YY/MM/DD. DATE1 and DATE2 are mutually exclusive.
DATE2(<dmy>)
The input date in the format DDMMYYYY, DDMMYY, DD/MM/YYYY and DD/MM/YY. DATE1 and DATE2 are mutually exclusive.
CALNAME(<calendar>)
Name of the calendar to be used for variables that need to know the work and free days. Specify an existing calendar, otherwise an error with RC=12 is issued. You can also use the short form CAL.
INCVALUE(<0-30>)
The number incremented variables to create. Valid values are from 0 to 30. The CHKDATE command adds and subtracts up to this value to create sets of variables XYMDNx, XWYMDNx, XYMDPx, and XWYMDPx. For each set x will be from 1 to the value specified by INCVALUE. If you specify INCVALUE(0), Workload Automation Programming Language creates no incremented variables, while OCL always creates 1. You can also use the short form INC.
FAIL(SKIP|STOP)
Determines what to do if an error occurs when setting an individual variable. You can specify:
SKIP
The error is reported, the variable is not created, and processing continues attempting to create other variables. The command ends with RC=4.
STOP
The error is reported, the variable is not created, and processing is interrupted. The command ends with RC=12.
FROM(<1-30>)
The starting value for creating incremental variables. This is an extension to what the OCL CHKDATE command could do. With OCL, if you specify INCVALUE(30) the incremental variables are created from 1 to 30. With Workload Automation Programming Language, if you specify INCVALUE(30) FROM(29) the variables are created only from 29 to 30. If you set FROM to a higher value than INCVALUE no incremental variables are created.
MSG(<Y|N>)
Whether the values for each variable are listed in the Workload Automation Programming Language log.
OCL(<Y|N>)
Sets the compatibility with OCL. This determines whether to calculate variables exactly as OCL, or create mathematically consistent values. If you set Y, the default for CALNAME is set to DEFAULT, the default for INCVALUE is set to 1, and the default for QUICK is set to N.
If you set OCL to N (default), the following defaults are assigned:
  • CALNAME: For a scheduled job, the calendar assigned to the occurrence. For a non-scheduled job, it first uses OPTIONS CALENDAR, or the value specified in EQQYPARM, or finally the value DEFAULT.
  • INCVALUE: 0
  • FROM: 1
  • MSG: N
  • QUICK: Y
If you set OCL to Y, the following defaults are assigned:
  • CALNAME: DEFAULT
  • INCVALUE: 1
  • FROM: 1
  • MSG: N
  • QUICK: N
QUICK(<Y|N>)
Whether Workload Automation Programming Language creates all the 82-198 variables that are created with OCL, or only the complex variables that the Workload Automation Programming Language VARDATE command cannot create. This enables you to use VARDATE to create single variables and CHKDATE to create complex variables. If you set Y, only the variables marked with a check mark in the Quick column in Table 1 are created. If you set N, all of the OCL equivalent variables are created.

You can also use the short form Q.

The following list shows the return codes:
0
The date is valid, and variables have been generated.
4
The date is valid, but errors occurred when creating variables and FAIL(SKIP) was set.
8
The date is valid, and no variables have been generated.
12
Invalid values have been specified, or FAIL(STOP) was set and some variables could not be created.

Notes

Consider the following notes about the CHKDATE command:
  1. With the Workload Automation Programming Language CHKDATE command the SUBSYS keyword is not provided, because you can change the subsystem by using the native OPTIONS SUBSYS statement.
  2. The variable XDE is supposed to be the number of the 10-day period of the year in which the date exists. With OCL, the second 10-day period in the year is only actually 9 days. With Workload Automation Programming Language, all values of XDE use consistent 10-day periods throughout the year. If you set OCL(Y), the command generates values consistent with OCL, using a 9-day second period. If you set OCL(Y) (default), the command generates consistent 10-day periods throughout the year.
  3. The variable XFIRSTDE is supposed to be date on which the 10-day period within the month begins for the input date. This would be days 01, 11, 21 and 31. With OCL, any 31-day months uses 21 as the start day for day 31, creating an 11-day third period. With Workload Automation Programming Language, day 31 generates a fourth period stating on 31, maintaining a consistent 10-day cycle start day in each month. If you set OCL(Y), the values generated are consistent with OCL, using an 11-day third period. The Workload Automation Programming Language equivalent code generates the consistent 10-day periods.
  4. If the command fails and variables are not generated you will not be able to refer to those variables in later code. Be sure to manage return code checking and logic to avoid referring to variables on failure.
  5. In the Workload Automation Programming Language the formats CCYY and YYYY are interchangeable.
  6. In Workload Automation Programming Language the string VARDATE X5MOND ONLY(5) DAY(MON) MONTH(!XMMM)YEAR(!XYYYY) FORMAT(YYYYMMDD) returns the date of the first Monday of the following month if the month only has 4 Mondays. Internally, the Workload Automation Programming Language CHKDATE command checks the number of Mondays available and set the X5 variables to blank if there is no fifth Monday.
  7. The variable XYDDP1 is identical to variable XDDP1, as per the original OCL command.
  8. The variable XDMYN1 is not documented within OCL but it is created by CHKDATE in OCL, therefore it is included in the Workload Automation Programming Language version for compatibility.
  9. The variables XWW and XWWD are based on 7-day weeks starting on the first of January each year, regardless of which day the 1st falls on.
  10. The variables XTOTWWM, XWWMONTH, and XWWLAST use weeks that start on a Monday and end on a Sunday. A week is counted whether it is a full 7 days or partial.
  11. The variable XWWLAST is directly dependent on the values of variables XTOTWWM and XWWMONTH. The Workload Automation Programming Language equivalent for XWWLAST includes code to create all three variables.
  12. The member EQQCHKDT in the SEQQWAPL library contains the Workload Automation Programming Language statements to create every variable that CHKDATE create by using native Workload Automation Programming Language commands. This can be used as an online reference if you do not want to generate all the variables from CHKDATE.
  13. The Workload Automation Programming Language function DATEFORM can be used to convert some formats other than those handled by the DATE1 and DATE2 keywords into a handled format.
  14. If you set OCL(Y) default to have the CALNAME keyword set to DEFAULT and no such calendar exists, the CALNAME keyword will be reset to blank to allow the default calendar to be identified by other means. If you set CALNAME(DEFAULT) and it does not exist, the command fails with RC=12.
  15. To set or reference variables by combining numbers with mathematical operators, use double quotes to avoid the mathematical expression being resolved. For example:
     VARSET MYDATE = “25/09/03” CHKDATE DATE1(“!MYDATE)

CHKDATE variables

Table 1 lists all the variables that you can create with the CHKDATE command. You are also shown the Workload Automation Programming Language command to directly create a single variable.

Only the variables with a check mark in the Quick column are created by default; to create all of the variables specify QUICK(N).

In some cases, with the direct Workload Automation Programming Language command, the input to VARDATE requires sub-elements of the input date, such as the 3-character month, the year, or the day of the month. If you do not have access to a variable containing those elements separately, obtain them by issuing a command similar to the following example using a variable with your input date in the format YYMMDD.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
Then use !XMMM and !XYYYY in subsequent VARDATE commands that need them.
VARDATE XFDAYD ONLY(1) MONTH(!XMMM)
                 YEAR(!XYYYY) FORMAT(W)

If you already have the transformed elements available to you in variables, you can discard the sub-element lines from the Workload Automation Programming Language equivalent example that set them up. In many cases these extra lines are simply the Workload Automation Programming Language equivalent for other variables created by the CHKDATE command.

In the Workload Automation Programming Language equivalent examples the user variable !CHKDATE contains the input date in the format YYMMDD. Equally the date could be provided from supplied variables such as !OYMD1 which contains the input arrival date in YYMMDD format.

The user variable !CHKCAL contains the value “CALENDAR(DEFAULT)”. Setting the !CHKCAL variable to “” causes Workload Automation Programming Language to use the Workload Automation Programming Language default, which for a scheduled job is the calendar associated with the occurrence.
Table 1. Variables created by the CHKDATE command
Variable Description and equivalent direct WAPL command Value Quick
XDAY Day of the week: 1-7. 1=Monday.
VARDATE XDAY BASE(!CHKDATE) FORMAT(W)
3
XDAYD Day of the week (MONDAY, TUESDAY… ).
VARDATE XDAYD BASE(!CHKDATE) FORMAT(WWWW)
WEDNESDAY
XDD Day of the month in DD format.
VARDATE XDD BASE(!CHKDATE) FORMAT(DD)
03
XDDD Day of the year in DDD format (Julian day).
VARDATE XDDD BASE(!CHKDATE) FORMAT(DDD)
246
XDDDYY Date as a Julian date in DDDYY format.
VARDATE XDDDYY BASE(!CHKDATE) FORMAT(DDDYY)
24625
XDDDYYYY Date as a Julian date in DDDYYYY format.
VARDATE XDDDYYYY BASE(!CHKDATE) FORMAT(DDDCCYY)
2462025
XDDN1 Next calendar day in DD format.
VARDATE XDDN1 BASE(!CHKDATE) OFFSET(+1)
        UNIT(DAY) FORMAT(DD)
04
XDDP1 Previous calendar day in DD format.
VARDATE XDDP1 BASE(!CHKDATE) OFFSET(-1)
        UNIT(DAY) FORMAT(DD)
02
XDE Ten-day period of the year.
VARDATE WDDD BASE(!CHKDATE) FORMAT(DDD)
VARSET XDE = RIGHT(((!WDDD - 1) % 10) + 1,2,"0")
25
XDMY Date in DDMMYYYY format.
VARDATE XDMY BASE(!CHKDATE) FORMAT(DDMMCCYY)
03012025
XDMY1 Date in DDMMYY format.
VARDATE XDMY1 BASE(!CHKDATE) FORMAT(DDMMYY)
030125
XDMY2 Date in DD/MM/YY format.
VARDATE XDMY2 BASE(!CHKDATE) FORMAT(DD/MM/YY)
03/01/25
XDMY3 Date in DD/MM/YYYY format.
VARDATE XDMY3 BASE(!CHKDATE) FORMAT(DD/MM/CCYY)
03/09/2025
XDMYN1 Previous calendar day in DD format.
VARDATE XDMYN1 BASE(!CHKDATE) OFFSET(+1)
        UNIT(DAY) FORMAT(DDMMCCYY)
04092025
XFDAY Day of the week for first of month: 1-7; 1 = Monday.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XFDAY ONLY(1) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(W)
1
XFDAYD Name of first day of the week for first of month.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XFDAYD ONLY(1) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(WWWW)
MONDAY
XFDAYJ Julian day of first of month in DDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XFDAYJ ONLY(1) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(DDD)
244
XFDAYJ1 Julian date of first of month in YYYYDDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XFDAYJ1 ONLY(1) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(CCYYDDD)
2025244
XFF Half of the month: 1 = first half (days 1-15), 2 = second half (from day 16 to the end).
VARDATE XDD BASE(!CHKDATE) FORMAT(DD)
IF !XDD < 16 THEN VARSET XFF = 1
ELSE VARSET XFF = 2
1
XFIRSTDE First day of the ten-day period of the month in YYYYMMDD format.
VARDATE XDD BASE(!CHKDATE) FORMAT(DD)
VARDATE XYM BASE(!CHKDATE) FORMAT(CCYYMM)
VARSET  XFIRSTDE = "!XYM"||,
        RIGHT(((!XDD-1) % 10) * 10 + 1,2,"0")
20250901
XFIRSTQ First day of quarter in YYYYMMDD format.
VARDATE XMM BASE(!CHKDATE) FORMAT(MM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
IF ("!XMM" <= "03") THEN DO
   VARDATE XFIRSTQ ONLY(1) MONTH(JAN)
           YEAR(!XYYYY) FORMAT(CCYYMMDD)
END
IF ("!XMM" >= "04") & ,
   ("!XMM" <= "06") THEN DO
   VARDATE XFIRSTQ ONLY(1) MONTH(APR)
           YEAR(!XYYYY) FORMAT(CCYYMMDD)
END
IF ("!XMM" >= "07") & 
("!XMM" <= "09") THEN DO
VARDATE XFIRSTQ ONLY(1) MONTH(JUL)
YEAR(!XYYYY) FORMAT(CCYYMMDD)
END
IF ("!XMM" >= "10") THEN DO
   VARDATE XFIRSTQ ONLY(1) MONTH(OCT)
           YEAR(!XYYYY) FORMAT(CCYYMMDD)
END
20250701
XFREEDAY Status of the day; F=FREEDAY, W=WORKDAY.
IF @(FREE,!CHKDATE,!CHKCAL) THEN VARSET XFREEDAY = "F"
ELSE VARSET XFREEDAY = "W"
W
XLASTDD Last day of month in DD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DD)
30
XLASTDD1 Last day of month in YYYYMMDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD1 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
20250930
XLASTDD2 Last day of month in YYMMDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD2 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(YYMMDD)
250930
XLASTDD3 Last day of month in DDMMYYYY format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD3 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DDMMCCYY)
30092025
XLASTDD4 Last day of month in DDMMYY format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD4 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DDMMYY)
300925
XLASTDDN Last day of the next month in DD format.
VARDATE XMMMN1 BASE(!CHKDATE) FORMAT(MMM)
        OFFSET(+1) UNIT(MONTH)
VARDATE XYYYYN1 BASE(!CHKDATE) FORMAT(CCYY)
        OFFSET(+1) UNIT(MONTH)
VARDATE XLASTDDN LAST(1) MONTH(!XMMMN1)
        YEAR(!XYYYYN1) FORMAT(DD)
31
XLASTDDP Last day of the previous month in DD format.
VARDATE XMMMP1  BASE(!CHKDATE)  FORMAT(MMM) 
        OFFSET(-1)   UNIT(MONTH) 
VARDATE XYYYYP1  BASE(!CHKDATE)  FORMAT(CCYY)
        OFFSET(-1) UNIT(MONTH) 
VARDATE XLASTDDP LAST(1) MONTH(!XMMMP1) 
        YEAR(!XYYYYP1) FORMAT(DD)
31
XLSTDDJ Day of year for last of month in DDD format (Julian day).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLSTDDJ LAST(1) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(DDD)
273
XLSTDDJ1 Julian date for last of month in YYYYDDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLSTDDJ1 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYDDD)
2025273
XMM Month in MM format.
VARDATE XMM BASE(!CHKDATE) FORMAT(MM)
09
XMMM Three-character name of month (not in OCL).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
SEP
XMMN1 Next month in MM format.
VARDATE XMMN1 BASE(!CHKDATE) FORMAT(MM)
                 OFFSET(+1) UNIT(MONTH)
10
XMMNAME Name of the month.
VARDATE XMMNAME BASE(!CHKDATE) FORMAT(MMMM)
SEPTEMBER
XMMP1 Previous month in MM format
VARDATE XMMP1 BASE(!CHKDATE) FORMAT(MM)
                 OFFSET(-1) UNIT(MONTH) 
08
XMMYY Month and year in MMYY format.
VARDATE XMMYY BASE(!CHKDATE) FORMAT(MMYY)
0925
XMY Month and year in MMYYYY format.
VARDATE XMY BASE(!CHKDATE) FORMAT(MMCCYY)
092025
XQUARTER Quarter number.
VARDATE XMM BASE(!CHKDATE) FORMAT(MM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
IF ("!XMM" <= "03") THEN DO
   VARSET XQUARTER = “1”
IF ("!XMM" >= "04") & ,
   ("!XMM" <= "06") THEN DO
   VARSET XQUARTER = “2”
END
IF ("!XMM" >= "07") & 
   ("!XMM" <= "09") THEN DO
   VARSET XQUARTER = “3”
END
IF ("!XMM" >= "10") THEN DO
   VARSET XQUARTER = “4”
END
3
XTOTWWM Total number of weeks in the month.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X1MONDD ONLY(1) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DD)  
VARDATE XLASTDD LAST(1) MONTH(!XMMM)   
        YEAR(!XYYYY) FORMAT(DD) 
IF !X1MONDD = "01" THEN VARSET WPREMON = 0
ELSE VARSET WPREMON = 1 
VARSET WMDAYS = !XLASTDD - !X1MONDD + 1
VARSET WMFULL = (!WMDAYS % 7)
IF (!WMDAYS // 7) <> 0 THEN VARSET WMPART = 1
ELSE VARSET WMPART = 0 
VARSET XTOTWWM = !WPREMON + !WMFULL + !WMPART
5
XWDDN1 Next workday in DD format.
VARDATE XWDDN1 BASE(!CHKDATE) OFFSET(+1)
                 UNIT(WORKDAY) FORMAT(DD) !CHKCAL
04
XWDDP1 Previous workday in DD format.
VARDATE XWDDP1 BASE(!CHKDATE) OFFSET(-1)
                 UNIT(WORKDAY) FORMAT(DD) !CHKCAL
02
XWDMYN1 Next workday in DDMMYYYY format.
VARDATE XWDMYN1 BASE(!CHKDATE) OFFSET(+1)
                 UNIT(WORKDAY) FORMAT(DDMMCCYY) !CHKCAL
04092025
XWDMYP1 Previous workday in DDMMYYYY format.
VARDATE XWDMYP1 BASE(!CHKDATE) OFFSET(-1)
                 UNIT(WORKDAY)FORMAT(DDMMCCYY) !CHKCAL
02092025
XWW Week of the year.
VARDATE XDDD BASE(!CHKDATE) FORMAT(DDD)
VARSET XWW = RIGHT(((!XDDD - 1) % 7) + 1,2,"0")
36
XWWD Week of the year and day in WWD format.
VARDATE XDDD BASE(!CHKDATE) FORMAT(DDD)
VARDATE XDAY BASE(!CHKDATE) FORMAT(W)
VARSET XWW = RIGHT(((!XDDD - 1) % 7) + 1,2,"0")
VARSET XWWD = “!XWW!XDAY”
361
XWWLAST Whether this is the last week of the month (Y|N).
VARDATE XDD BASE(!CHKDATE) FORMAT(DD)
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X1MONDD ONLY(1) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DD)
VARDATE XLASTDD LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DD) 
IF !X1MONDD = "01" THEN VARSET WPREMON = 0 
ELSE VARSET WPREMON = 1  
VARSET WMDAYS = !XLASTDD - !X1MONDD + 1
VARSET WMFULL = (!WMDAYS % 7) 
IF (!WMDAYS // 7) <> 0 THEN VARSET WMPART = 1
ELSE VARSET WMPART = 0  
VARSET XTOTWWM = !WPREMON + !WMFULL + !WMPART
IF !XDD >= !X1MONDD THEN DO
VARSET WCDAYS = !XDD - !X1MONDD + 1
VARSET WCFULL = (!WCDAYS % 7)
IF (!WCDAYS // 7) <> 0 THEN 
VARSET WCPART = 1 
ELSE VARSET WCPART = 0 
END 
ELSE DO 
   VARSET WCFULL = 0  
   VARSET WCPART = 0  
END                
VARSET XWWMONTH = !WPREMON + !WCFULL + !WCPART   
IF !XTOTWWM = !XWWMONTH THEN    
   VARSET XWWLAST = "Y"            
ELSE VARSET XWWLAST = "N"
N
XWWMONTH Week number in the month.
VARDATE XDD BASE(!CHKDATE) FORMAT(DD)
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X1MONDD ONLY(1) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DD)         
IF !X1MONDD = "01" THEN VARSET WPREMON = 0
ELSE VARSET WPREMON = 1 
IF !XDD >= !X1MONDD THEN DO 
VARSET WCDAYS = !XDD - !X1MONDD + 1
VARSET WCFULL = (!WCDAYS % 7)
   IF (!WCDAYS // 7) <> 0 THEN
   ELSE VARSET WCPART = 0 
END 
ELSE DO
   VARSET WCFULL = 0
   VARSET WCPART = 0 
END 
VARSET XWWMONTH = !WPREMON + !WCFULL + !WCPART  
1
XYDDP1 Previous calendar day in DD format.
VARDATE XYDDP1 BASE(!CHKDATE) OFFSET(-1)
        UNIT(DAY) FORMAT(DD)
02
XYM Year and Month in YYYYMM format.
VARDATE XYM BASE(!CHKDATE) FORMAT(CCYYMM)
202501
XYMD Date in YYYYMMDD format.
VARDATE XYMD BASE(!CHKDATE) FORMAT(CCYYMMDD)
202501903
XYMD1 Date in YYMMDD format.
VARDATE XYMD1 BASE(!CHKDATE) FORMAT(YYMMDD)
250103
XYMD2 Date in YY/MM/DD format.
VARDATE XYMD2 BASE(!CHKDATE) FORMAT(YY/MM/DD)
25/01/03
XYMD3 Date in YYYY/MM/DD format.
VARDATE XYMD3 BASE(!CHKDATE) FORMAT(CCYY/MM/DD)
2025/01/03
XYY Year in YY format.
VARDATE XYY BASE(!CHKDATE) FORMAT(YY)
25
XYYDDD Date as a Julian date in YYDDD format.
VARDATE XYYDDD BASE(!CHKDATE) FORMAT(YYDDD)
25246
XYYMM Year and Month in YYMM format.
VARDATE XYYMM BASE(!CHKDATE) FORMAT(YYMM)
2509
XYYMMN Next month in YYMM format.
VARDATE XYYMMN BASE(!CHKDATE) OFFSET(+1)
                 UNIT(MONTH) FORMAT(YYMM)
2510
XYYMMP Previous month in YYMM format.
VARDATE XYYMMP BASE(!CHKDATE) OFFSET(-1)
                 UNIT(MONTH) FORMAT(YYMM)
2508
XYYN Next year in YY format.
VARDATE XYYN BASE(!CHKDATE) OFFSET(+1)
                 UNIT(YEAR) FORMAT(YY)
26
XYYP Previous year in YY format.
VARDATE XYYP BASE(!CHKDATE) OFFSET(-1)
                 UNIT(YEAR) FORMAT(YY)
24
XYYYY Year in YYYY format.
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
2025
XYYYYDDD Date as a Julian date in YYYYDDD format.
VARDATE XYYYYDDD BASE(!CHKDATE) FORMAT(CCYYDDD)
2025246
XYYYYMMN Next month in YYYYMM format.
VARDATE XYYYYMMN BASE(!CHKDATE) OFFSET(+1)
                 UNIT(MONTH) FORMAT(YYYYMM)
202510
XYYYYMMP Previous month in YYYYMM format.
VARDATE XYYYYMMP BASE(!CHKDATE) OFFSET(-1)
        UNIT(MONTH) FORMAT(CCYYMM)
202508
XYYYYN Next year in YYYY format.
VARDATE XYYYYN BASE(!CHKDATE) OFFSET(+1)
                UNIT(YEAR) FORMAT(CCYY)
2026
XYYYYP Previous year in YYYY format.
VARDATE XYYYYP BASE(!CHKDATE) OFFSET(-1)
                 UNIT(YEAR) FORMAT(CCYY)
2024
X1MOND First Monday of month in YYYYMMDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X1MOND ONLY(1) DAY(MON) MONTH(!XMMM) 
                 YEAR(!XYYYY) FORMAT(CCYYMMDD)
20250901
X1MONDJ First Monday of month in DDD format (Julian day).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X1MONDJ ONLY(1) DAY(MON) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(DDD)
244
X1MONDJ1 First Monday of month in YYYYDDD format (Julian date).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X1MONDJ1 ONLY(1) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(YYYYDDD)
2025244
X2MOND Second Monday of month in YYYYMMDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X2MOND ONLY(2) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
20250908
X2MONDJ Second Monday of month in DDD format (Julian day).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X2MONDJ ONLY(2) DAY(MON) MONTH(!XMMM)
YEAR(!XYYYY) FORMAT(DDD)
251
X2MONDJ1 Second Monday of month in YYYYDDD format (Julian date).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X2MONDJ1 ONLY(2) DAY(MON) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(YYYYDDD)
2025251
X3MOND Third Monday of month in YYYYMMDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X3MOND ONLY(3) DAY(MON) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
20250915
X3MONDJ Third Monday of month in DDD format (Julian day).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X3MONDJ ONLY(3) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(DDD)
258
X3MONDJ1 Third Monday of month in YYYYDDD format (Julian date).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X3MONDJ1 ONLY(3) DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYDDD)
2025258
X4MOND Fourth Monday of month in YYYYMMDD format.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X4MOND ONLY(4) DAY(MON) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
20250922
X4MONDJ Fourth Monday of month in DDD format (Julian day).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X4MONDJ ONLY(4) DAY(MON) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(DDD)
265
X4MONDJ1 Fourth Monday of month in YYYYDDD format (Julian date).
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE X4MONDJ1 ONLY(4) DAY(MON) MONTH(!XMMM) 
        YEAR(!XYYYY) FORMAT(CCYYDDD)
2025265
X5MOND Fifth Monday of month in YYYYMMDD format. It is set to blank if there is no fifth Monday.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD1 LAST(1) MONTH(!XMMM)
VARDATE XLASTDD1 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
VARDATE X5MOND ONLY(5)
        DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
IF !X5MOND > !XLASTDD1 THEN
VARSET X5MOND = "" 
20250929
X5MONDJ Fifth Monday of month in DDD format (Julian day). It is set to blank if there is no fifth Monday.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD1 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD) VARDATE X5MOND ONLY(5)
                     DAY(MON) MONTH(!XMMM)
                     YEAR(!XYYYY) FORMAT(CCYYMMDD)
                     IF !X5MOND > !XLASTDD1 THEN DO
   VARSET X5MOND   = ""
   VARSET X5MONDJ  = "" 
END
ELSE DO
VARDATE X5MONDJ ONLY(5) DAY(MON)
MONTH(!XMMM) YEAR(!XYYYY) FORMAT(DDD)
END 
272
X5MONDJ1 Fifth Monday of month in YYYYDDD format (Julian date). It is set to blank if there is no fifth Monday.
VARDATE XMMM BASE(!CHKDATE) FORMAT(MMM)
VARDATE XYYYY BASE(!CHKDATE) FORMAT(CCYY)
VARDATE XLASTDD1 LAST(1) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
VARDATE X5MOND ONLY(5)
        DAY(MON) MONTH(!XMMM)
        YEAR(!XYYYY) FORMAT(CCYYMMDD)
IF !X5MOND > !XLASTDD1 THEN DO 
VARSET X5MOND   = ""  
VARSET X5MONDJ1 = ""  
END   
ELSE DO   
VARDATE X5MONDJ1 ONLY(5) DAY(MON) 
MONTH(!XMMM) YEAR(!XYYYY) FORMAT(CCYYDDD)
END
2025272
Table 2The following variables are created for each iteration of the number n, which is calculated from the value FROM to the value INCVALUE. For example XYMDN1, XYMDN2, XYMDN3.
Table 2. Variables created by the CHKDATE command for each iteration of the number n
Variable Description and equivalent direct WAPL command Value Quick
XYMDNn Date +n calendar days in YYYYMMDD format.
VARDATE XYMDNn BASE(!CHKDATE) FORMAT(CCYYMMDD)
                 OFFSET(+n) UNIT(DAY)
20250904
XWYMDNn Date +n work days in YYYYMMDD format.
VARDATE XWYMDNn BASE(!CHKDATE) FORMAT(CCYYMMDD)
                 OFFSET(+n) UNIT(WORKDAY) !CHKCAL
20250902
XYMDPn Date -n calendar days in YYYYMMDD format.
VARDATE XYMDNn BASE(!CHKDATE) FORMAT(CCYYMMDD)
                 OFFSET(-n) UNIT(DAY)
20250902
XWYMDPn Date -n work days in YYYYMMDD format.
VARDATE XWYMDNn BASE(!CHKDATE) FORMAT(CCYYMMDD)
                 OFFSET(+n) UNIT(WORKDAY) !CHKCAL
20250902

Examples

To obtain only the output for the command CHKDATE DATE1(2025/09/03) issue:
CHKDATE DATE1(2025/09/03) OCL(Y)
To create only the complex variables, with consistent 10-day period values by using the calendar assigned to the job, issue the command:
CHKDATE DATE1(2025/09/03)
To create incremented variables only for plus or minus 10 days, issue the command:
CHKDATE DATE1(2025/09/03) INC(10) FROM(10)
To handle a variable in DD-MMM-YYYY format, for example 03-SEP-2025, issue the command:
VARSET ODDDATE = "03-SEP-2025"
VARSET CHKDATE = DATEFORM("!ODDDATE","DD-MMM-YYYY","YYMMDD")
CHKDATE DATE1(!CHKDATE) MSG(Y)
Note: Ensure that you enclose the variable ODDDATE and the corresponding setting in double quotes to avoid that the symbols / or - are interpreted and resolved as mathematical operators.
To perform a compound calculation with a mix of work and calendar days, such as adding 2 work days to the IA date, then adding 20 calendar days after the 2 work days, and save it to a variable named VAR1 in table MYTABLE, issue the command:
CHKDATE DATE1(!OYMD1) INC(2) FROM(2)
CHKDATE DATE1(!XWYMDN2) INC(20) FROM(20)
VARSET VAR1 VALUE(!XYMDN20) TABLE(MYTABLE) SAVE
To perform the same process with the native WAPL VARDATE command, issue:
VARDATE VAR1 BASE(!OYMD1) OFFSET(2) UNIT(WORKDAY)
VARDATE VAR1 BASE(!VAR1) OFFSET(20) UNIT(DAY) TABLE(MYTABLE) SAVE
Note: The native WAPL compound method enables offsets greater than 30 and can also use WEEK, MONTH, and YEAR as units of addition or subtraction.