In OpenVMS, how can I see where a command is coming from - like "which" in NIX

4

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)

user1987442

Posted 2013-02-14T09:39:11.493

Reputation: 55

Answers

2

$SHOW PROCESS/ALL

$SHOW ENTRY

$SHOW ENTRY/FULL

STTR

Posted 2013-02-14T09:39:11.493

Reputation: 6 180

Don't think that is OpenVMS – user1987442 – 2013-02-14T10:22:59.037

Wow, this is my epic inattention. Correct. – STTR – 2013-02-14T10:33:50.957

1

There exists three DCL "sources" of, as you say, "coming from" something command like.

One warning: syntaxes with visible explicit DCL enforcement, like:

$'dosomething'

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

  1. Symbols

    Function: like un*x alias or as "run a program with parameters", nearly like the MCR dosomething.

    Do a:

    $ show symbol dosomething
    

    Symbols are "first use" (if used, then has priority over next steps)

  2. 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.

  3. Path usage

    Do a:

    $ directory DCL$PATCH:dosomething
    

    If a .COM or .EXE file exists, the command procedure runs nearly like after @DCL$PATH:dosomething or image of code runs like mcr DCL$PATH:dosomething.

    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

  1. 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!

  2. 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)

  3. 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)

Gotfryd

Posted 2013-02-14T09:39:11.493

Reputation: 11

0

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.

PKM

Posted 2013-02-14T09:39:11.493

Reputation: 493