Slide 69 of 80
Notes:
- In the example above, :HELP UDCA, only finds the first definition of the UDC.
- OPTION RECURSION is necessary in UDCs that support multiple entry points, otherwise a UDC would not be able to invoke itself recursively - as required by entry points (which are discussed elsewhere).
- OPTION RECURSION causes the UDC search to start completely over -- all the way back to the first user level UDC cataloged. From this point all user, account and system level UDCs are checked in order to resolve the command name.
- OPTION NORECURSION is the UDC default and causes resolution of the next command to commence just after the current UDC. Thus, in the example above, when udcC is processing the command “udcA”, it tries to resolve that command name by first checking if it it a UDC defined somewhere “below” the definition of udcC. However, when udcB calls udcA with OPTION RECURSION set, the search goes back to the first UDC catalogued. In this example, that is the udcA, at the beginning of the file. The RECURSION scope is local to the current UDC and is not inherited by successive UDCs. So, when the first udcA calls udcC which calls udcA, this invocation of udcA is not recursive, and thus executes the last udcA defined in the file.
- OPTION RECURSION and NORECURSION are also CI built-in commands and can appear anywhere in the UDC body.
- Scripts are recursive by definition and OPTION NORECURSION has no meaning.
- Like OPTION RECURSION, none of the UDC/script options are inherited when one UDC invokes another UDC in a nested fashion, except for OPTION NOBREAK. Once a UDC or script is encountered with OPTION NOBREAK specified,. all other UDCs/scripts that are called by the NOBREAK UDC/script are treated as if OPTION NOBREAK were specified -- regardless of how BREAK is defined in the called UDC/scripts. OPTION NOBREAK is somewhat common in conjunction with OPTION LOGON UDCs.
- OPTION NOPROGRAM is new to MPE/iX (MPE XL). This option indicates that the UDC or script is not allowed to be executed from within a program (via calling the HPCICOMMAND intrinsic). Once an OPTION NOPROGRAM UDC is encountered all UDC searching stops. The command in question may still be resolved to be a built-in command, or a script or program file, but further UDC searching ceases. For example, define a UDC named LISTF, with OPTION NOPROGRAM, which simply does ECHO LISTF!. If :LISTF is executed from the CI it will execute the LISTF UDC. If :LISTF is executed from VOLUTIL (which calls the HPCICOMMAND intrinsic to execute all non-VOLUTIL commands), the UDC is found, but, since it is OPTION NOPROGRAM, the UDC is not executed and no other UDCs are processed. :LISTF is found to be a known CI command, and the real :LISTF command is executed. In the slide example above, if the first UDCA had OPTION NOPROGRAM defined, and :UDCC was executed from VOLUTIL, the last UDCA would be executed. However, if UDCB was executed from VOLUTIL, the first UDCA would be located, and since it is OPTION NOPROGRAM, it would not be executed. Also, the second UDCA in the file would not be discovered, because all UDC processing stopped when the NOPROGRAM UDCA was found.