ALTIF – Alter operations if specific criteria are true

The ALTIF can be run as the first operation in an occurrence to conditionally ALTER other operations within the same occurrence.

ALTIF CRITERIA(<field-prefix>) [<common-keywords>]

where CRITERIA names a user field prefix to use for specifying date logic expressions against. The prefix is used to identify IF, DO, and EL user fields to define the date logic and a corresponding set of attributes to alter.

The command searches for matching user fields in each operation within the same occurrence. The fields must be coded with matching <field-prefix> and <tag> elements of the name with one IF, at least one DO user field, and optional EL fields, using the following convention:
<field-prefix>-<tag>-IF
The user field with date logic.
<field-prefix>-<tag>-DO
The user fields containing the ALTER keywords to act upon when the corresponding IF is true. At least one DO keyword must be coded for each IF.
EL*
The user fields containing the ALTER keywords to act upon when the corresponding IF is false.
In the following example, ABC-01-IF is true on Monday, therefore ABC-01-DO is processed on Monday. ABC-02-IF is true only on Tuesday, therefore ABC-02-DO1 and ABC-02-DO2 are processed on Tuesday. On any other day, that operation is left unaltered, according to the day of the week.
ABC-01-IF = @(MON)  
ABC-01-DO = OPIA(!OYMD1.1900)
ABC-02-IF = @(TUE)
ABC-02-DO1 = OPIA(!OYMD1.2100)
ABC-02-DO2 = OPIA(!OYMD1.2300)
In the following example, user field ABC-03-IF checks to see if the day is a workday: if true, it runs ABC-03-DO, if it is not a workday, it runs ABC-03-EL1 and ABC-03-EL2.
ABC-03-IF = @(WORKDAY)
ABC-03-DO = TIMEDEP(Y)
ABC-03-EL1 = TIMEDEP(N)
ABC-03-EL2 = DROPSR('DONT.RUN.WITH.CICS')

The IF user field can contain any valid REXX Expression, containing date logic variables, Workload Automation Programming Language variables or HCL Workload Automation for Z JCL variables (for details, see IF-THEN-ELSE – Conditional execution). The variables are evaluated by the operation running the ALTIF command, hence their values are set in relation to that operation.

The DO and EL user fields can contain any action keywords from the ALTER command. The identification, filter, and data keywords are managed internally by the ALTIF command; you must use only the keywords that cause operation modification. Each individual DO or EL user field causes an individual ALTER statement to be run. The ALTER statements are run in the sort sequence of the user field names. For details, see ALTER.

Note:
  • If you set an -IF User Field without at least one corresponding -DO user field, the ALTIF command fails with RC=8.
  • When UPDATE(N) is set, to see the ALTER commands that would have been issued use OPTIONS MSGLEVEL(2). To see the low level PIF commands that would have been issued, use OPTIONS TRACE(1).