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
will be selected for execution. The declarative that is selected must satisfy
the rules for execution of that declarative. The order of precedence for selecting
a declarative is:
- A file-specific declarative (one of the form USE AFTER ERROR ON file-name-1, with or without the GLOBAL phrase) within the program that contains the statement that caused the qualifying condition
- A mode-specific declarative (one of the form USE AFTER ERROR ON INPUT, with or without the GLOBAL phrase) 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 condition
- 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.
- Rules 3 and 4 apply recursively back through the parents in the nest of programs.
Note: Each declarative procedure runs as a separate invocation
from that of other declarative procedures and the nondeclarative part of the
same ILE COBOL program.