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.
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)]
DATE1(<ymd>)- The input date in the format YYYYMMDD, YYMMDD, YYYY/MM/DD or
YY/MM/DD.
DATE1andDATE2are mutually exclusive. DATE2(<dmy>)- The input date in the format DDMMYYYY, DDMMYY, DD/MM/YYYY and
DD/MM/YY.
DATE1andDATE2are 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
CHKDATEcommand 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 byINCVALUE. If you specifyINCVALUE(0), Workload Automation Programming Language creates no incremented variables, while OCL always creates 1. You can also use the short formINC. 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
CHKDATEcommand could do. With OCL, if you specifyINCVALUE(30)the incremental variables are created from 1 to 30. With Workload Automation Programming Language, if you specifyINCVALUE(30) FROM(29)the variables are created only from 29 to 30. If you setFROMto a higher value thanINCVALUEno 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
CALNAMEis set to DEFAULT, the default forINCVALUEis set to 1, and the default forQUICKis set to N.If you set OCL toN(default), the following defaults are assigned:CALNAME: For a scheduled job, the calendar assigned to the occurrence. For a non-scheduled job, it first usesOPTIONS CALENDAR, or the value specified in EQQYPARM, or finally the value DEFAULT.INCVALUE: 0FROM: 1MSG: NQUICK: Y
If you set OCL toY, the following defaults are assigned:CALNAME: DEFAULTINCVALUE: 1FROM: 1MSG: NQUICK: 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
VARDATEcommand cannot create. This enables you to useVARDATEto create single variables andCHKDATEto 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.
- 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
CHKDATE command:- With the Workload Automation Programming Language
CHKDATEcommand theSUBSYSkeyword is not provided, because you can change the subsystem by using the nativeOPTIONS SUBSYSstatement. - 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 setOCL(Y)(default), the command generates consistent 10-day periods throughout the year. - 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. - 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.
- In the Workload Automation Programming Language the formats CCYY and YYYY are interchangeable.
- 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 LanguageCHKDATEcommand checks the number of Mondays available and set the X5 variables to blank if there is no fifth Monday. - The variable XYDDP1 is identical to variable XDDP1, as per the original OCL command.
- The variable XDMYN1 is not documented within OCL but it is created by
CHKDATEin OCL, therefore it is included in the Workload Automation Programming Language version for compatibility. - 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.
- 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.
- 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.
- The member EQQCHKDT in the SEQQWAPL library contains the Workload Automation Programming Language statements to create
every variable that
CHKDATEcreate 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 fromCHKDATE. - 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.
- If you set
OCL(Y)default to have theCALNAMEkeyword set to DEFAULT and no such calendar exists, theCALNAMEkeyword will be reset to blank to allow the default calendar to be identified by other means. If you setCALNAME(DEFAULT)and it does not exist, the command fails with RC=12. - 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).
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)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.
“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.| Variable | Description and equivalent direct WAPL command | Value | Quick |
|---|---|---|---|
| XDAY | Day of the week: 1-7.
1=Monday. |
3 | |
| XDAYD | Day of the week (MONDAY, TUESDAY…
). |
WEDNESDAY | |
| XDD | Day of the month in DD
format. |
03 | |
| XDDD | Day of the year in DDD format (Julian
day). |
246 | |
| XDDDYY | Date as a Julian date in DDDYY
format. |
24625 | |
| XDDDYYYY | Date as a Julian date in DDDYYYY
format. |
2462025 | |
| XDDN1 | Next calendar day in DD
format. |
04 | |
| XDDP1 | Previous calendar day in DD
format. |
02 | |
| XDE | Ten-day period of the year. |
25 | ✔ |
| XDMY | Date in DDMMYYYY
format. |
03012025 | |
| XDMY1 | Date in DDMMYY
format. |
030125 | |
| XDMY2 | Date in DD/MM/YY
format. |
03/01/25 | |
| XDMY3 | Date in DD/MM/YYYY
format. |
03/09/2025 | |
| XDMYN1 | Previous calendar day in DD
format. |
04092025 | |
| XFDAY | Day of the week for first of month: 1-7; 1 =
Monday. |
1 | |
| XFDAYD | Name of first day of the week for first of
month. |
MONDAY | |
| XFDAYJ | Julian day of first of month in DDD
format. |
244 | |
| XFDAYJ1 | Julian date of first of month in YYYYDDD
format. |
2025244 | |
| XFF | Half of the month: 1 = first half (days 1-15), 2 = second half (from day 16 to the
end). |
1 | ✔ |
| XFIRSTDE | First day of the ten-day period of the month in YYYYMMDD
format. |
20250901 | ✔ |
| XFIRSTQ | First day of quarter in YYYYMMDD
format. |
20250701 | ✔ |
| XFREEDAY | Status of the day; F=FREEDAY,
W=WORKDAY. |
W | ✔ |
| XLASTDD | Last day of month in DD
format. |
30 | |
| XLASTDD1 | Last day of month in YYYYMMDD
format. |
20250930 | |
| XLASTDD2 | Last day of month in YYMMDD
format. |
250930 | |
| XLASTDD3 | Last day of month in DDMMYYYY
format. |
30092025 | |
| XLASTDD4 | Last day of month in DDMMYY
format. |
300925 | |
| XLASTDDN | Last day of the next month in DD
format. |
31 | ✔ |
| XLASTDDP | Last day of the previous month in DD
format. |
31 | ✔ |
| XLSTDDJ | Day of year for last of month in DDD format (Julian
day). |
273 | |
| XLSTDDJ1 | Julian date for last of month in YYYYDDD
format. |
2025273 | |
| XMM | Month in MM
format. |
09 | |
| XMMM | Three-character name of month (not in
OCL). |
SEP | |
| XMMN1 | Next month in MM format.
|
10 | |
| XMMNAME | Name of the
month. |
SEPTEMBER | |
| XMMP1 | Previous month in MM format
|
08 | |
| XMMYY | Month and year in MMYY
format. |
0925 | |
| XMY | Month and year in MMYYYY
format. |
092025 | |
| XQUARTER | Quarter number. |
3 | ✔ |
| XTOTWWM | Total number of weeks in the
month. |
5 | ✔ |
| XWDDN1 | Next workday in DD
format. |
04 | |
| XWDDP1 | Previous workday in DD
format. |
02 | |
| XWDMYN1 | Next workday in DDMMYYYY
format. |
04092025 | |
| XWDMYP1 | Previous workday in DDMMYYYY
format. |
02092025 | |
| XWW | Week of the year. |
36 | ✔ |
| XWWD | Week of the year and day in WWD
format. |
361 | ✔ |
| XWWLAST | Whether this is the last week of the month
(Y|N). |
N | ✔ |
| XWWMONTH | Week number in the month. |
1 | ✔ |
| XYDDP1 | Previous calendar day in DD
format. |
02 | |
| XYM | Year and Month in YYYYMM
format. |
202501 | |
| XYMD | Date in YYYYMMDD
format. |
202501903 | |
| XYMD1 | Date in YYMMDD
format. |
250103 | |
| XYMD2 | Date in YY/MM/DD
format. |
25/01/03 | |
| XYMD3 | Date in YYYY/MM/DD
format. |
2025/01/03 | |
| XYY | Year in YY
format. |
25 | |
| XYYDDD | Date as a Julian date in YYDDD
format. |
25246 | |
| XYYMM | Year and Month in YYMM
format. |
2509 | |
| XYYMMN | Next month in YYMM
format. |
2510 | |
| XYYMMP | Previous month in YYMM
format. |
2508 | |
| XYYN | Next year in YY
format. |
26 | |
| XYYP | Previous year in YY
format. |
24 | |
| XYYYY | Year in YYYY
format. |
2025 | |
| XYYYYDDD | Date as a Julian date in YYYYDDD
format. |
2025246 | |
| XYYYYMMN | Next month in YYYYMM
format. |
202510 | |
| XYYYYMMP | Previous month in YYYYMM
format. |
202508 | |
| XYYYYN | Next year in YYYY
format. |
2026 | |
| XYYYYP | Previous year in YYYY
format. |
2024 | |
| X1MOND | First Monday of month in YYYYMMDD
format. |
20250901 | |
| X1MONDJ | First Monday of month in DDD format (Julian
day). |
244 | |
| X1MONDJ1 | First Monday of month in YYYYDDD format (Julian
date). |
2025244 | |
| X2MOND | Second Monday of month in YYYYMMDD
format. |
20250908 | |
| X2MONDJ | Second Monday of month in DDD format (Julian
day). |
251 | |
| X2MONDJ1 | Second Monday of month in YYYYDDD format (Julian
date). |
2025251 | |
| X3MOND | Third Monday of month in YYYYMMDD
format. |
20250915 | |
| X3MONDJ | Third Monday of month in DDD format (Julian
day). |
258 | |
| X3MONDJ1 | Third Monday of month in YYYYDDD format (Julian
date). |
2025258 | |
| X4MOND | Fourth Monday of month in YYYYMMDD
format. |
20250922 | |
| X4MONDJ | Fourth Monday of month in DDD format (Julian
day). |
265 | |
| X4MONDJ1 | Fourth Monday of month in YYYYDDD format (Julian
date). |
2025265 | |
| X5MOND | Fifth Monday of month in YYYYMMDD format. It is set to blank if there is no
fifth Monday. |
20250929 | ✔ |
| X5MONDJ | Fifth Monday of month in DDD format (Julian day). It is set to blank if there
is no fifth Monday. |
272 | ✔ |
| X5MONDJ1 | Fifth Monday of month in YYYYDDD format (Julian date). It is set to blank if
there is no fifth Monday. |
2025272 | ✔ |
FROM to the value INCVALUE. For example
XYMDN1, XYMDN2, XYMDN3.| Variable | Description and equivalent direct WAPL command | Value | Quick |
|---|---|---|---|
| XYMDNn | Date +n calendar days in YYYYMMDD
format. |
20250904 | |
| XWYMDNn | Date +n work days in YYYYMMDD
format. |
20250902 | |
| XYMDPn | Date -n calendar days in YYYYMMDD
format. |
20250902 | |
| XWYMDPn | Date -n work days in YYYYMMDD
format. |
20250902 |
Examples
CHKDATE DATE1(2025/09/03) issue:
CHKDATE DATE1(2025/09/03) OCL(Y)CHKDATE DATE1(2025/09/03)CHKDATE DATE1(2025/09/03) INC(10) FROM(10)VARSET ODDDATE = "03-SEP-2025"
VARSET CHKDATE = DATEFORM("!ODDDATE","DD-MMM-YYYY","YYMMDD")
CHKDATE DATE1(!CHKDATE) MSG(Y)ODDDATE and the corresponding setting in double quotes to avoid that
the symbols / or - are interpreted and resolved as mathematical operators.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) SAVEVARDATE command,
issue:VARDATE VAR1 BASE(!OYMD1) OFFSET(2) UNIT(WORKDAY)
VARDATE VAR1 BASE(!VAR1) OFFSET(20) UNIT(DAY) TABLE(MYTABLE) SAVEWEEK,
MONTH, and YEAR as units of addition or
subtraction.