@ - Date logic function

The @ function returns a boolean true or false (1 or 0), based on whether the input string is true for the day that is being evaluated.

The following string allows IF statements and other REXX based commands to make decisions, based on the characteristics of the date being checked.

@(“<input-string>”,[<date>],[”<additional-keywords>”])

For example, the string IF @(FRI) & @(WORKDAY) THEN would only be true if the date being checked was both a Friday and a workday.

The following list shows the valid values for <input-string>:

  • Day of the week: MON TUE WED THU FRI SAT SUN
  • Part of the week: WEEKDAY or WEEKEND
  • Day type: WORKDAY or FREEDAY (W, WORK, F and FREE are also valid)
  • Day of the month: D01D31
  • Month of the year: M01M12
  • Name of the month: JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
  • Year: Y00Y99
  • yymmdd: a specific date
  • A valid ADRULE string, for example ONLY LAST(1) DAY(FRIDAY) MONTH. For details about how you specify the ADRULE statement, see Managing the Workload.
Note: The <input-string> should be contained within single or double quotes if it contains ( or ), otherwise quotes are optional.

By default, the date being checked is either the input arrival date for jobs controlled by HCL Workload Automation for Z, or the current date for jobs not controlled by HCL Workload Automation for Z. This date can be overridden by specifying a date as the second argument of the function. The date can either be a specific date in the format yymmdd or a relative date, using plus or minus to offset from the default date for this function.

For example, the string IF @(FRI) & @(FREEDAY,+1) THEN is true if the scheduled date for the job is a Friday and the following day is a Free day.

When checking WORKDAY and FREEDAY, the calendar to be used is determined as follows:

  • If the job is controlled by HCL Workload Automation for Z, the calendar associated with the controlling occurrence is used.
  • If the job is run outside of HCL Workload Automation for Z, the calendar specified by OPTIONS CALENDAR or CALENDAR set within EQQYPARM is used.
  • If no calendar is set, the calendar named DEFAULT is used.

The CALENDAR can be overridden by specifying the CALENDAR keyword within the third argument. For example, the string IF @(WORK,,”CALENDAR(NATIONAL)”) & @(FREE,,”CALENDAR(LOCAL)”) THEN is true if the date being checked is a Workday in the National calendar and a Freeday in the Local calendar.

Note: The Work Day End Time is not considered for WORKDAY or FREEDAY. To exploit Workday End Time, you can use the ADRULE statement. Where you use an ADRULE statement, the rule is checked to see if it would generate a match for the date being checked.
The following list shows the additional keywords that you can specify as the third argument to influence how the rule is evaluated:
CALENDAR
Sets the calendar to use. If not specified, the calendar is decided using the same method as with WORKDAY and FREEDAY input strings.
FDAYRULE(1|2|3|4|E)
Sets the free day rule. By default, this is set to 3 which does not adjust the date.
IAT(hhmm)
Sets the input arrival time to evaluate against the rule, for Calendar Work Day End Time processing. By default, this will use the input arrival time of the job running the command, if it is controller by HCL Workload Automation for Z, otherwise it will use 0000 for a job outside of HCL Workload Automation for Z control.

For example:

  • @(“EVERY DAY(FREEDAY) WEEK”,,”CALENDAR(MYCAL) IAT(0300)”) evaluates whether 3am on the date being checked is a Freeday, taking into account the Work Day End Time of calendar MYCAL.
  • @(“ONLY LAST(1) DAY(FRIDAY) MONTH”,-3) evaluates whether it was the last Friday of the month 3 days ago.
  • @(“ONLY LAST(1) DAY(FRIDAY) MONTH”,,”FDAYRULE(1)”) evaluates whether this is the last working day before or on the last Friday of the month.
Note: The <additional-keywords> must be specified within single or double quotes, because it contains opening and closing parenthesis.

The date logic expressions can also be used in the CRITERIA user fields for the ALTIF and RUNIF commands.