Slide 35 of 80
Notes:
- now, assuming “cmd” could be a UDC name, the SHOWCATALOG command is executed with output redirected to a TEMP file named “whereudc”.
- If SHOWCATALOG worked without error, the where script invokes itself recursively, via the XEQ command, to display relevant UDC information. The predefined HPFILE variable contains the fully qualified name of the current script, and is used here in case the next author decides to use a different filename. This allows the script filename to not be hard-coded into the script.
- the XEQ command invokes, via HPFILE, the script again, passing the same “cmd” value as the first argument. An alternate entry point is passed as the second parameter, via the by-convention usage of “entry=“. Input to where is redirected from the file that the SHOWCATALOG command created.
- the fsyntax() function is called after processing UDCs since a UDC name can be longer than a valid MPE filename. Also, the where script expects that all names, even POSIX command names, to be passed in unqualified. There are not explicit checks for qualified MPE names (f.g.a) since it is ambiguous if a name such as “foo.sh” is the name of a shell script, or a partially qualified MPE name. Since the user of this script is not expected to use the “MPE-escaped” syntax for POSIX names, a “./” is prepended to the “cmd” name that is parsed by fsyntax().
- if there is a syntax error the script exits via the RETURN command.
- a variable is set to true if there are any wildcard characters in the “cmd” value. In general, if an expression evaluates to a boolean (true or false) it can be used to directly set the value of a variable. For example: setvar x (a > b) is more efficient than: if (a > b) then setvar x true else setvar x false endif