[comp.os.vms] VMS global symbols

mst@csun.UUCP (Mike Temkin) (04/07/88)

I have a few programs that need command line parameters passed to them.
The documentation that comes with them (not much there) shows that a global
symbol ( :== ) should be used.  I have tried to get them to work, but 
I see no difference between typing 'RUN PROGRAM' and setting a global
symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.

Can anyone tell me what I am doing wrong?

Thanks in advance,
Mike Temkin


-- 
Mike Temkin
...!{ihnp4,sdcrdcf,hplabs,psivax,ttidca}!csun!mst
Cal. State U. Northridge, School of Engineering and Computer Science

whitfill@hc.DSPO.GOV (Jim Whitfill) (04/07/88)

in article <1181@csun.UUCP>, mst@csun.UUCP (Mike Temkin) says:
> 
> I have a few programs that need command line parameters passed to them.
> The documentation that comes with them (not much there) shows that a global
> symbol ( :== ) should be used.  I have tried to get them to work, but 
> I see no difference between typing 'RUN PROGRAM' and setting a global
> symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.
> 
> Can anyone tell me what I am doing wrong?
> 
> Thanks in advance,
> Mike Temkin

What you need is a command file, PROGRAM_RUN.COM, that contains:

$ RUN PROGRAM 'P1' 'P2'

Then define PGM :== @PROGRAM_RUN

To envoke program with parameters, type

PGM X Y


                   =======================================
                               Jim A. Whitfill
                    Los Alamos National Laboratory (LANL)
                            Group MEE-10, MS J580
                             Los Alamos, NM 87545
                                (505) 667-9282

                 (ARPAnet ==> whitfill%meediv.xnet@lanl.gov)
                   =======================================

robert@arizona.edu (Robert J. Drabek) (04/07/88)

In article <1181@csun.UUCP>, mst@csun.UUCP (Mike Temkin) writes:
> I have a few programs that need command line parameters passed to them.
> 
> I see no difference between typing 'RUN PROGRAM' and setting a global
> symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.
> 
> Can anyone tell me what I am doing wrong?

You need to create "foreign commands" with

  PRG :== $MYDISK:[MYDIR]MYPRG

Then you can execute MYPRG as you desired.  (MYDISK and MYDIR are
where your executable is located.  SHOW DEFAULT will give you a
hint about the correct names really are.)

-- 
Robert J. Drabek
Department of Computer Science
University of Arizona
Tucson, AZ  85721

whitfill@hc.DSPO.GOV (Jim Whitfill) (04/08/88)

From vn Thu Apr  7 06:25:50 1988
Subject: Re: VMS global symbols
Newsgroups: comp.os.vms
References: <1181@csun.UUCP>

in article <1181@csun.UUCP>, mst@csun.UUCP (Mike Temkin) says:
> 
> I have a few programs that need command line parameters passed to them.
> The documentation that comes with them (not much there) shows that a global
> symbol ( :== ) should be used.  I have tried to get them to work, but 
> I see no difference between typing 'RUN PROGRAM' and setting a global
> symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.
> 
> Can anyone tell me what I am doing wrong?
> 
> Thanks in advance,
> Mike Temkin

The previous response I made to this was WRONG!!

What you want to do is define PRG :== $DISK:[DIRECTORY]PROGRAM.

Then if you have used a system service to get CLI parameters, LIB_GET$FOREIGN
you can pass the parameters to the program by:

$ PRG x y

I'm sorry about the previous response, my mind was somewhere else.....
                   =======================================
                               Jim A. Whitfill
                    Los Alamos National Laboratory (LANL)
                            Group MEE-10, MS J580
                             Los Alamos, NM 87545
                                (505) 667-9282

                 (ARPAnet ==> whitfill%meediv.xnet@lanl.gov)
                   =======================================

mithomas@bsu-cs.UUCP (Michael Thomas Niehaus) (04/08/88)

In article <1181@csun.UUCP>, mst@csun.UUCP (Mike Temkin) writes:
> I have a few programs that need command line parameters passed to them.
> The documentation that comes with them (not much there) shows that a global
> symbol ( :== ) should be used.  I have tried to get them to work, but 
> I see no difference between typing 'RUN PROGRAM' and setting a global
> symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.
> 
> Can anyone tell me what I am doing wrong?
> -- 
> Mike Temkin
> ...!{ihnp4,sdcrdcf,hplabs,psivax,ttidca}!csun!mst
> Cal. State U. Northridge, School of Engineering and Computer Science

Try defining your global symbol like this:

$ PRG :== "$fullpathname:[directory]program"

Then, to start up the program with passed parameters, type this:

$ PRG this_is_param_1 this_is_param_2

Programs that use this kind of passing will most often include the
LIB$GET_FOREIGN function.  This is how it gets its information.

Michael Niehaus
UUCP: ..!{uunet,pur-ee,iuvax}!bsu-cs!mithomas

MADISON@CICGJ.RPI.EDU (Matt Madison) (04/12/88)

in article <14274@hc.dspo.gov>, whitfill@hc.dspo.gov (Jim Whitfill) says:

>in article <1181@csun.UUCP>, mst@csun.UUCP (Mike Temkin) says:
[...]
>> I see no difference between typing 'RUN PROGRAM' and setting a global
>> symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.
>> 
>> Can anyone tell me what I am doing wrong?
>
>What you need is a command file, PROGRAM_RUN.COM, that contains:
>
>$ RUN PROGRAM 'P1' 'P2'
>
>Then define PGM :== @PROGRAM_RUN

No, no.  You need not do anything so complicated.  Simply define your
"foreign command" as:

    $ PRG :== $dev:[dir]PROGRAM

Where "dev" and "dir" are the device and directory where the executable
is located.  This is really basic RTFM DCL stuff.

Matt Madison   madison@cicgj.rpi.edu
Systems Programmer, Center for Interactive Computer Graphics
Rensselaer Polytechnic Institute

CARTER@MITBATES.BITNET (04/12/88)

I believe the programs in question are using LIB$GET_FOREIGN to get the
command line. If this is the case, you need to do the following:

  $ PRG :== $disk:[dir]PROGRAM
  $ PRG P1 P2 P3

You need to replace "disk" and "dir" with the appropriate disk name and
directory specification for your executable. If you just type

  $ PRG :== $PROGRAM

VMS assumes that the program sits in SYS$SYSTEM:.

Tony Carter
MIT Bates Linac
CARTER@MITBATES.BITNET

CADS_COLE@GALLUA.BITNET ("Kevin Cole at Gallaudet U. Washington DC") (04/12/88)

Mike Temkin <sdcrdcf!csun!mst@hplabs.hp.COM> writes:

>I have a few programs that need command line parameters passed to them.
>The documentation that comes with them (not much there) shows that a global
>symbol ( :== ) should be used.  I have tried to get them to work, but
>I see no difference between typing 'RUN PROGRAM' and setting a global
>symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.

Sounds like the "dreaded foriegn command syndrome" to me...  (Not terribly
dreadful, actually.)  Try this:

    $ PRG :== $ disk:[directory]PROGRAM

You have to specify the disk and directory with this form of the command.
Otherwise the machine tries to run something in SYS$SYSTEM.  Anyway, using
the "$" instead of "RUN" allows some programs to get at your parameters.

(I'm sure some guru out there will provide a more "in-depth" explaination, so
 I'm not sure why I bothered...)

--------------------------------------------------------------------------------
Kevin Cole      <Flatline>              BITNET: KJCOLE@GALLUA.BITNET
Center for Assessment and                               or
Demographic Studies  (CADS)                     CADS_COLE@GALLUA.BITNET
Gallaudet Research Institute  (GRI)     UUCP: ...!psuvax!gallua.bitnet!kjcole
Gallaudet University                    CompuServe: 76167,1406
Washington, D.C.  20002
(202) 651-5575

             "Hey Rocky!  Watch me pull a rabbit out of my hat!"

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (04/13/88)

 > in article <1181@csun.UUCP>, mst@csun.UUCP (Mike Temkin) says:
 > > 
 > > I have a few programs that need command line parameters passed to them.
 > > The documentation that comes with them (not much there) shows that a global
 > > symbol ( :== ) should be used.  I have tried to get them to work, but 
 > > I see no difference between typing 'RUN PROGRAM' and setting a global
 > > symbol like 'PRG :== RUN PROGRAM 'P1 'P2' then typing 'PRG param1 param2'.
 > > 
 > > Can anyone tell me what I am doing wrong?
 > > 
 > > Thanks in advance,
 > > Mike Temkin
 > 
 > What you need is a command file, PROGRAM_RUN.COM, that contains:
 > 
 > $ RUN PROGRAM 'P1' 'P2'
 > 
 > Then define PGM :== @PROGRAM_RUN
 > 
 > To envoke program with parameters, type
 > 
 > PGM X Y

Sigh.  I wish more people who answer questions in this forum would take
the time to check and see if their "solutions" have any basis in reality.
The RUN command takes exactly ONE parameter: the name of the program to
be run.  The "solution" proposed by Jim A. Whitfill has exactly the same
problems as everything the original poster had.  The REAL solution is to
define
	$ PGM:==$PROGRAM
then use the command
	$ PGM X Y
where PROGRAM is a file specification including the path.