Previous Topic

Next Topic

Book Contents

Book Index

General Information

When a DO RULE statement is encountered during rule processing, Control-O invokes the specified rule. When processing of the invoked rule is completed, processing continues sequentially from the point after the DO RULE statement in the initial (calling) rule.

When a DO RULE statement is executed, the rule is searched for among the rules in the active environment according to the specified rule name, table, library, and owner. If the rule is found but is not active (for example, if the runtime scheduling criteria are not satisfied), the "invoked" rule is not executed and the calling rule continues execution with the next DO statement.

While a called rule is active, both the called rule and the calling rule share the same AutoEdit System variable and Local variable environment. The calling rule can pass an argument string as input to the called rule. This argument string may contain AutoEdit expressions that are resolved at time of rule execution. The argument string may be accessed by the called rule through the %%$ARGS System variable. If a called rule calls another rule, the %%$ARGS values passed in the earlier call is overwritten by the %%$ARGS values passed by the later call. For more information about the AutoEdit facility, see AutoEdit Facility.

A rule specified with an ON RULE statement can be invoked any number of times by DO RULE calls.

A called rule can invoke other rules through the DO RULE parameters. Nesting of DO RULE calls (for example, rule 1 calls rule 2, which calls rule 3, and so on), up to 20 deep, is supported. A rule can be called recursively.

A DO RULE statement can be distributed to Control-O on a remote system that is identified by the %%$COMMSYS reserved user-defined variable in a preceding DO SET statement. For more information, see the description of %%$COMMSYS in Reserved User-Defined Variables, and Performing an Action on Another System ctoug3.

When a DO RULE statement requests execution of a remote rule, Control-O transfers the system AutoEdit variables. Local AUTOEDIT variables are not transferred to the remote Control-O.

To exit a called rule, specify either DO RETURN or DO TERMINAT, as follows:

Parent Topic

DO RULE: Automated Console Action Parameter