The DEFRULE, DEFPROC and DO-END statements can use IF-THEN-ELSE statements to perform conditional processing. The if_expressions define the conditions evaluated by the rules language.
The following structure displays a typical IF-THEN-ELSE definition:
IF if_expression_1 if_expression_2
...
if_expression_n
THEN action_statements
flow_control_statements
ELSE action_statements
flow_control_statements
Once all conditions within an IF section of a group have been met, the product performs the action statements and the flow control statements inside the THEN section.
If any expression within an IF section fails and the ELSE parameter is available, the product performs the action and flow control statements specified by the ELSE section.
If nested IF processing is required, THEN or ELSE processing can use the DO-END or CALLPROC statements. When using nested IF processing, please keep the logic as simple as possible. Since ACC has the ability to control all allocation requests being processed by a system, logic errors within ACC rules can adversely effect system performance.
The if_expressions can make use of the symbolic fields found in the SYMBOLICFIELDS, the symbolic fields found in the "SYMBOLIC FIELDS" chapter in the product’s user guide, and literals. Also, symbolic fields can be compared to other symbolic fields. For information about using expressions, examine Expressions.
IF
Function: This is a required parameter. The IF parameter is used to start
the IF section of the rule definition. At least one expression is required after the IF parameter. The IF section is terminated by the THEN parameter.
Default: None
Format: IF
if_expression
Function: At least one if_expression is required by the IF-THEN-ELSE
group. The expression(s) define the conditions that must be satisfied to perform the actions requested by the THEN section of the rules. If the expression(s) fail and an ELSE section is available, the ELSE section will then be processed. Otherwise, rule scanning will continue with the next IF-THEN-ELSE group.
By default, “AND” logic is performed between the if_expressions in an IF-THEN-ELSE group. While “OR” can be coded, parenthetical expressions cannot be used to group if_expressions. For example, the following rule could be used to control allocation of temporary data sets.
IF TEMPDSN=YES OR HLQ=TEMP* THEN SET DISKPOOL=TEMPPOOL
Default: None
Format: For information about using expressions, examine “Expressions”
CALLEXIT( exitname )
Function: The CALLEXIT parameter can be used to pass control to a user
exit. The exitname specifies the name of the exit to be called. For the DEFRULE statement to function correctly, the exit must be enabled by the Dynamic Install Facility (DIF) before the CALLEXIT parameter is processed. If the exit has a non-zero return code, the IF section for the rule will fail, and processing will continue with the next rule definition. For more information about user exits, examine “User Exits” on page 3-46.
Default: None
Format: CALLEXIT(exitname)
Function: This is an optional parameter. The ELSE parameter is used to
start the ELSE section of the IF-THEN-ELSE group. At least one action or flow control statement is required after the ELSE parameter. The ELSE section is terminated by another rule statement, or an End-Of-File condition on the rules control cards.
Default: None
Format: ELSE
THEN
Function: The THEN parameter is used to start the THEN section of the IF-
THEN-ELSE group. At least one action or flow control statement is required after the THEN parameter. The THEN section is terminated by another rule definition statement, another IF, an ELSE parameter, or an End-Of-File condition on the rules control statements.
Default: None
Format: THEN