Operating System - OpenVMS
1828642 Members
7715 Online
109983 Solutions
New Discussion

DCL Script with parameter /

 
SOLVED
Go to solution
Sethunath K.O
Occasional Advisor

DCL Script with parameter /

Hi,
Can we use / as commandscript parameter ?

Purpose is I want to create an enviornment where some of the Unix command work (cd, ls,mkdir etc.) in VMS.
E.g.
@CD /usr/bin
As per my analysis DCL will throw an error if we use / as parameter.
@CD "/" will work , but I can not ask the user to enter a command @CD "/usr/bin"

Please suggest

Regards
Sethu

6 REPLIES 6
Hein van den Heuvel
Honored Contributor
Solution

Re: DCL Script with parameter /


Well, you don't really want your users to type @CD anyway right? Not knowing where CD lives and all that?

So you could define "$CD = @some_fixed_place:cd.com X"

Now, if for example you use: $CD /usr
The in CD.COM the P1 will be "X" and P1 will be /USR (uppercased!)

hth,
Hein.
Hein van den Heuvel
Honored Contributor

Re: DCL Script with parameter /

> The in CD.COM the P1 will be "X" and P1 will be /USR (uppercased!)

Oops, submitted before proofreading...

Then in the context of CD.COM the paramater P1 will be "X" and P2 will be /USR (uppercased!)

Hein.

Ken Robinson
Valued Contributor

Re: DCL Script with parameter /

If you define the command cd as

$ cd :== @somefixedplace:cd x """"

Then the 2nd parameter will contain everything that is entered after the command in whatever case is entered.

Here's a short example:

test.com contains the one line
$ sho sym p%

If I define the command cd as

$ cd :== @test X """

and enter the command

$ cd/this /is /a TEST

Here is the output:

P1 = "X"
P2 = " /this /is /a TEST"
P3 = ""
P4 = ""
P5 = ""
P6 = ""
P7 = ""
P8 = ""

$ cd /this is a /test

P1 = "X"
P2 = " /this is a /test"
P3 = ""
P4 = ""
P5 = ""
P6 = ""
P7 = ""
P8 = ""


Ken
Jan van den Ende
Honored Contributor

Re: DCL Script with parameter /

Sethu,
let me start with
WELCOME to VMS and to this forum!

Hein,
I think Sethu is entitled to a little explanation.

So Sethu, here goes:

/ in VMS normally denotes a qualifier (compare the Unix - , denoting a what U* calls a switch)
The @ ("execute whatever you find at") command behaves similar but not the same: it only accepts maximum of one qualifier, and only if given directly after the name of the file to be executed. All other command line elements (maximum 8, separated by spaces) are command parameters, which are automatically available within the activated procedure as the symbols P1 to P8.

So, Hein is "cheating" around the treating /USR as a qualifier by adding a dummy param.
The symbol CD will be replaced by its value
@some_fixed_place:cd.com X
in the command line evaluation, and then /usr/bin wil be added, resulting in
@some_fixed_place:cd.com X /usr/bin.
Now, CD.COM should never ever look at P1, but process P2. which holds the value of /USR/BIN
If you really need that as lowercase, then put it betweeb quotes on your command line. (same if you need embedded spaces or other special chars).

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Joseph Huber_1
Honored Contributor

Re: DCL Script with parameter /

Maybe my example of a U*x compatible "cd" command will be usefull for how it handles the "/" case:

cd is defined as: CD == "@DCL$PATH:CD #"

Then dcl$path:cd.com is the one at
http://wwwvms.mppmu.mpg.de/util_root/com/cd.com

It uses a program path_to_directory from
http://wwwvms.mppmu.mpg.de/~huber/util/main/path_to_directory.c

and needs for the "cd ~user" case a program UD
from
http://wwwvms.mppmu.mpg.de/vmssig/archive/u/ud.zip

whichh needs to be installed with SYSPRV to get another users home directory (if this is allowed at Your site).

http://www.mpp.mpg.de/~huber
Sethunath K.O
Occasional Advisor

Re: DCL Script with parameter /

Hi Hein , Ken , Jan van den Ende,& Joseph Huber

Thanks very much for your time and help. It is working fine for me

Thanks and Regards
Sethu