If I have a command dosomething in OpenVMS, where can I see where it is coming from (Location of script/exe - how it is defined if it is a different kind of animal)
There exists three DCL "sources" of, as you say, "coming from" something command like.
One warning: syntaxes with visible explicit DCL enforcement, like:
are not counted here, only the "visible like command" ones.
Also explicit RUN or MCR commands are commands themselves, then
run dosomething are out of interest.
How to check
Function: like un*x alias or as "run a program with parameters", nearly like the MCR dosomething.
$ show symbol dosomething
Symbols are "first use" (if used, then has priority over next steps)
True DCL command
There no build in utility to check the command table.
However you can setup a freeware VERB utility.
Then do a:
$ verb dosomething
The "image" and "cliroutine" (in VERB output) shows the .EXE or internal DCL routine where runs the command.
$ directory DCL$PATCH:dosomething
If a .COM or .EXE file exists, the command procedure runs nearly like after
@DCL$PATH:dosomethingor image of code runs like
Path usage is a "last chance" one (only if symbol does not exist or not used and true DCL command does not exist also)
"Nearly" in all description above because there are minor syntax interpretation difference, mostly irrelevant.
Some additional explanation
If exists a symbol with name matching your "command", the content of symbol may be translated in two ways:
if the content begins with "$", the use is named "foreign command" and runs image (.EXE file) of rest of content, up to separator (parameter can be applied nearly like in alias); warning: the default directory of specified .EXE is SYS$SYSTEM:, not the default of process!
in all other cases the value may function like un*x alias.
Value of symbol is "inlined" to the command line, and the substituted text is interpreted as ("new") command.
The word "may" applies regarding of the SET SYMBOL setting (check HELP SET SYMBOL for VERB description).
Be aware, that alias further explains to other real dcl syntax (true command, explicite "@" for procedure or "invisible" DCL$PATH use), but not to next symbol (alias or foreign command).
It it strongly not recommended to substitute any true DCL command with aliases, DO NOT this!
True command are set with the SET COMMAND command (obvious), the executable (.EXE image or internal DCL routine) names are not related in other way to the command name, even if most command has adequate names (the DIRECTORY command runs a SYS$SYSTEM:DIRECTORY.EXE etc, but APPEND runs COPY.EXE and HELP runs VMSHELP.EXE etc)
Path is used like in un*x, but:
- Only after the true commands table is checked (of course, also after the alias symbol use, but this is "un*x like")
- The images intended for true command usage in most cases can not be used this way (exists somewhere runs with different syntax, example: INSTALL)
Dont think it works exactly that way in OpenVMS and there's no foolproof way afaik. For DCL show, most of the qualifiers would end up in SYS$SYSTEM:SHOW.EXE but without the MAP file there would be no way to figure out which source module actually went into this executable. DCL is not like Bash where it will fork-exec another process and load the image of that command.