command files (scripts)
command file - a file that contains a single command definition
features:
- same convenience as UDCs
- searched for after UDCs and built-in commands using the HPPATH variable -- default HPPATH includes “logon group, PUB.logon account, PUB.SYS, ARPA.SYS”
- require read or eXecute access
- easy to modify since file is only in use while it is being executed
- very similar to unix scripts or DOS bat files
Notes:
Command files (scripts) are single files that contain the commands to be executed. These files can reside anywhere on a system; however, typically they are located in groups or directories referenced in the HPPATH variable. Like UDCs, scripts are invoked via their name, however, since a script is a file, it can be entered as a qualified filename or as an unqualified filename. Most commonly, script names are entered as unqualified names (just the base name), and thus the HPPATH variable is used to complete (“qualify”) the name based on successive group/directory names defined in HPPATH. UDC names can be up to 16 characters long, and thus are longer than standard MPE filenames; however, POSIX script names can be longer than UDC names.
2. Command override mechanism:
A UDC name can be the same name as a built-in MPE command. The CI resolves a user entered command name by checking for a UDC prior to searching for a built-in CI command. Thus, a UDC can hide a built-in CI command. For example, a UDC can be named RUN, hence overriding the :RUN command.
A script cannot override a built-in CI command. For example, if a command file named RUN.PUB.SYS exists and the user enters “:run ….”, the built-in :RUN command will be executed, not the script. Typically, command file names are different from UDC and built-in command names. The :XEQ command is provided to execute scripts with the same name as built-in commands or UDCs.
Note: after a user has logged on, UDCs are searched for in the following order:
- user level UDCs, starting at the first user file shown by :SHOWCATALOG
- account level UDCs,. starting at the first account file listed by :SHOWCATALOG
- system level UDCs, starting at the first system file displayed by :SHOWCATALOG.
Multiple files at the same level (user, account, system) are searched for (and executed, if found) based upon the order the files are cataloged.
Note: OPTION RECURSION causes the UDC commands within the option recursion UDC to be searched for starting at the first file cataloged at the user level, regardless of the level of the executing UDC.
Note: the UDC search order is different at logon time.