Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How do you return the current program name of a vms program? For instance., in unix it's $0. I'm writing a script that will be installed on different nodes with slightly different script names. But, I want this script to have the same code for all nodes.
Thanks.

I'm not a frequent UNIX-user so I have to make some guesses......
in Unix $ is used to translate variables.
$0 is the first variable and vill return the running image/file.There are eight reserved parameters in VMS ( P1 - P8 ), but they are used to pass parameters into a commandfile.
example,TEST.COM
$ SHOW SYMBOL P%
$ @TEST
P1 = ""
P2 = ""
P3 = ""
P4 = ""
P5 = ""
P6 = ""
P7 = ""
P8 = ""$ @TEST hello 5 vms 123
P1 = "HELLO"
P2 = "5"
P3 = "VMS"
P4 = "123"
P5 = ""
P6 = ""
P7 = ""
P8 = ""To get the name of the executing commandfile, you have to use a lexical function called F$ENVIRONMENT
$ file = f$environment("procedure")
$ show symbol fileregards,
Hakan Zanderau
HA-solutions

Using the lexical f$environment outside a commandfile ( $-prompt ) will return the name of your terminal.
Hakan Zanderau
HA-solutions$ HELP LEXICALS for more help

Thanks, Hakan! I'm a Unix/Linux/IBM Mainframe guy on a crash course in VMS. Much apperciated!
Mike
Petro Heating Oil
IT Dept.

Mike,
You may want to take a look at some of my presentations on using lexical functions. One such presentation, "DCL Lexicals: OpenVMS Jujitsu", can be found at http://www.rlgsc.com/decus/usf95/in... .
There is also a series of columns that appeared on OpenVMS.org on logical names, an often related area when parameterizing scripts. Links to these columns appear on http://www.rlgsc.com/publications.html
- Bob Gezelter, http://www.rlgsc.com

![]() |
show device d equivalent
|
setting date
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |