RUNIF – Run operations only if specific criteria are true
The RUNIF
command can be run as
the first operation in an occurrence to conditionally decide which
operations are allowed to run, by moving the unwanted operations to
a non-reporting workstation and optionally removing special resources
and time dependencies.
RUNIF [USRF-EQ|NE(field=value)] [CRITERIA(<field-prefix>)]
[DROPSR(YES|NO)] [DROPTIME(YES|NO)] [WSNAME(<workstation>)]
[<common-keywords>]
where:USRF
- Specifies a user field and value to decide which operations to
run. You can use the keyword comparators
EQ
andNE
. WhenEQ
is used, it runs only operations marked with the combination of field name and value. WhenNE
is used, it runs only operations not marked with the combination of field name and value. CRITERIA
- Names a user field prefix to use for specifying date logic expressions
against. The prefix is used to identify positive and negative rule
user fields. For example,
CRITERIA(RUNME)
looks for user fields with the formatRUNME-POS-nn
andRUNME-NEG-nn
to contain the date logic rules for each operation. DROPSR(YES|NO)
- Instructs the
RUNIF
command to remove special resources from operations identified as being ineligible to run. If resources are not removed, the operations could wait for special resources, even if they were moved to a non-reporting workstation. This might even affect the availability of resources if the use OnComplete. The default isYES
. DROPTIME(YES|NO)
- Instructs the
RUNIF
command to remove any time dependency from any operations identified as being ineligible to run. If time dependencies are not removed the operation will wait until the time dependency has been satisfied, even if the operation was moved to a non-reporting workstation. WSNAME
- Specifies the workstation where the operations that are not required
are moved by the
RUNIF
process. This must be a general non-reporting workstation.
All fields are optional, but you must specify at least one USRF
and
one CRITERIA
. If both USRF
and CRITERIA
are
specified, the USRF
keyword is processed first,
and only the operations that pass the USRF
test
have their CRITERIA
fields processed.
When CRITERIA
is used, the following considerations
are made:
- If an operation has no user fields matching the
prefix-POS-nn
orprefix-NEG-nn
format, the operation is considered eligible to run. - If an operation has a user field matching the
prefix-POS-nn
format, the operation is considered eligible to run only if the expression contained within the user field is TRUE. - If an operation has a user field matching the
prefix-NEG-nn
format, the operation is considered ineligible to run if the expression contained within the user field is TRUE.
nn
is expected to be a two-digit
numeric value, to ensure that the fields are evaluated in the correct
order, because updates to the current plan might inadvertently change
the sequence of user fields. It does not matter if nn
is
not numeric, but it is important to understand that the sort sequence
of each individual field name decides the order in which the CRITERIA
rules
are combined. Multiple prefix-POS-nn
or prefix-NEG-nn
fields
are not processed individually, but they are evaluated as a single
positive or a single negative rule, using normal continuation rules
to combine each user field value.
RUNIF
usage,
where:- Operation 001 runs Monday to Friday
- Operation 005 runs only Monday
- Operation 010 runs Monday to Friday
- Operation 015 runs only on Mondays during October
- Operation 020 runs Monday, Tuesday, Thursday and Friday
- Operation 255 runs Monday to Friday
The contents of the CRITERIA
user fields
can contain Workload Automation Programming Language variables
that can be set in the same operation as the RUNIF
command.
For substitution to take place, variable substitution must be activated
in the same job as the RUNIF
command.
RUNIF
usage
with variables as criteria, where:- Operation 001 runs Monday to Friday
- Operation 005 runs Monday and Tuesday
- Operation 010 runs Monday and Tuesday
- Operation 015 runs Wednesday and Thursday
- Operation 020 runs Wednesday and Thursday
- Operation 255 runs Monday to Friday
The USRF
keyword can be used to provide
different execution routes through an application depending on the
contents of a variable in a JCL variable table.
Varying the name of the user field to be used allows the same operation to be permissible on multiple routes through the application.
Both the variable value and presence of the RUNIF
command
can be varied at submission time if the application is added to the
current plan dynamically.
Using the same user field name allows an application to be divided
into sub applications, allowing the application to run as a whole
if no RUNIF
command is set, or only running
a sub set of the operations if RUNIF
is executed
specifying a particular value for the user field.
RUNIF
usage
with variables to select the route, where:- When variable ROUTE in table MYTABLE is set to ROUTE1
- Operation 001 runs
- Operation 005 runs
- Operation 010 runs
- Operation 015 does not run
- Operation 020 runs
- Operation 025 does not run
- Operation 255 does not run
- When variable ROUTE in table MYTABLE is set to ROUTE2
- Operation 001 runs
- Operation 005 runs
- Operation 010 does not run
- Operation 015 runs
- Operation 020 does not run
- Operation 025 runs
- Operation 255 does not run
RUNIF
usage
with the RUNIF
command being varied at submission
time, where:- EQQ-SYSIN-02 contains a commented template of the
RUNIF
command to be replaced at submission time by a real version of theRUNIF
command. When submitted unmodified, all operations will run. - When an occurrence is submitted as follows:
INSERT CPOC ADID(MYAPPL) MODIFY CPOP OPNO(001) MODIFY CPUSRF UFNAME(EQQ-SYSIN-02) UFVALUE('RUNIF USRF(SUBAPPL=GRPA) WSNAME(NONR)')
- Operation 001 runs
- Operation 005 runs
- Operation 010 runs
- Operation 015 runs
- Operation 020 does not run
- Operation 025 does not run
- Operation 255 does not run
- When an occurrence is submitted as follows:
INSERT CPOC ADID(MYAPPL) MODIFY CPOP OPNO(001) MODIFY CPUSRF UFNAME(EQQ-SYSIN-02) UFVALUE('RUNIF USRF(SUBAPPL=GRPB) WSNAME(NONR)')
- Operation 001 runs
- Operation 005 does not run
- Operation 010 does not run
- Operation 015 does not run
- Operation 020 runs
- Operation 025 runs
- Operation 255 does not run
RUNIF
criteria were specified
incorrectly and a rerun is required, you need to restore the occurrence
to its original state, either by submitting a new occurrence in its
place, or manually restoring the workstation names, time dependency
attributes, and special resources, according to the database definition
of the application.