Precedence rules for nested programs
Special precedence rules are followed when programs are contained within other programs.
In applying these rules, only the first qualifying declarative is selected for execution. The order of precedence for selecting a declarative is:
- A file-specific declarative (that is, a declarative of the form USE AFTER ERROR ON file-name-1) within the program that contains the statement that caused the qualifying condition.
- A mode-specific declarative (that is, a declarative of the form USE AFTER ERROR ON INPUT) within the program that contains the statement that caused the qualifying condition.
- A file-specific declarative that specifies the GLOBAL phrase and is within the program directly containing the program that was last examined for a qualifying declarative.
- A mode-specific declarative that specifies the GLOBAL phrase and is within the program directly containing the program that was last examined for a qualifying condition.
Steps 3 and 4 are repeated until the last examined program is the outermost program, or until a qualifying declarative has been found.