Search code examples
unixopenvmsvms

what is equivalent command of unix which in VMS


I have a tool xyz in vms.I want to get location where it is installed.For example in unix we can achieve this by using which command.So please help me vms equivalent of this command.


Solution

  • There is no equivalent command of which in VMS. To find the location of such a tool it depends on how the tool is set up on VMS. VMS commands can be DCL commands, aka DCL verbs, or foreign commands, aka DCL symbols. I assume you invoke the xyz tool with just typing "xyz" at the DCL command prompt.

    DCL verbs are defined in a DCL command table. Your system administrator may have added the xyz tool to one of the DCL command tables, for example with the $ SET COMMAND command in the system wide LOGIN command procedure. If your tool is set up as a DCL command, you may want to get and look at the VERB utility (this utility is available from the VMS freeware CD), which will show you your XYZ command, with a DCl command $ VERB XYZ. Its output will list an "image" line, so anything after that keyword is the (file) specification of the tool's executable image. The default directory here is SYS$SYSTEM, which is a logical name. Keep in mind that the specification can be a (full) VMS file specification or just a logical name.

    For foreign commands - almost always used for tools ported from Unix - you can check for the DCL symbol with the DCL command $ SHOW SYMBOL XYZ. If the tool is setup up this way, you will see an output like "XYZ == $file_ specification". Again, the file specification can be a (full) VMS file specification or just a logical name.

    Additionally, recent versions of VMS support automatic foreign commands. That is, executable images (and command procedures), which are found in the directoy/-ies pointed to by the logical name DCL$PATH, will automatically be used as a foreign command. So your tool xyz may be a file in such a directory. This would be the easiest way to find its location: $ DIRECTORY DCL$PATH:XYZ should do it.