🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

9 total messages Started by Lynn Mei Wed, 28 Feb 1996 15:59
How to run a C program taking command line arguments on VMS
#305
Author: Lynn Mei
Date: Wed, 28 Feb 1996 15:59
23 lines
857 bytes
Could someone tell me how to run a C program which takes command line 
arguments on VAX/VMS? I have checked the FAQ about openVMS and tried the 
instructions. But I couldn't get it work. I don't have an openVMS mannual.  
Please help me!

My program is like:

/* myprog.c */
  
  main(argn, **argv)
  {
  
     ...

  }

If run on Unix or DOS, I could type something like

  myprog -lu abcd

How to run it on VMS?

I'd appreciate your help!
Re: How to run a C program taking command line arguments on VMS
#306
Author: Carl J Lydick
Date: Wed, 28 Feb 1996 23:27
61 lines
2720 bytes
In article <4h1u5d$s5c@news.fsu.edu>, meil@firnvx.firn.edu (Lynn Mei) writes:
=Could someone tell me how to run a C program which takes command line 
=arguments on VAX/VMS? I have checked the FAQ about openVMS and tried the 
=instructions. But I couldn't get it work. I don't have an openVMS mannual.  
=Please help me!
=
=My program is like:
=
=/* myprog.c */
=  
=  main(argn, **argv)
=  {
=  
=     ...
=
=  }
=
=If run on Unix or DOS, I could type something like
=
=  myprog -lu abcd
=
=How to run it on VMS?
=
=I'd appreciate your help!

From the FAQ which you claim to have read:
------------------------------------------------------------
DCL1.   How do I run a program with arguments?

The RUN command does not accept arguments.  To pass arguments to a program,
you must use what is called a "foreign command".  For example:

	$ uudecode :== $disk:[dir]uudecode.exe
	$ uudecode filespec

The leading $ in the symbol definition is what makes it a foreign command.
If the device and directory is omitted, SYS$SYSTEM: is assumed.  For more
information on foreign commands, see the OpenVMS User's Manual.

See also question PROG2.

If you want to create a detached process that takes arguments from a command
line, it must be run under the control of a command line interpreter
(typically DCL).  This is done by placing the command line in a file,
specifying SYS$SYSTEM:LOGINOUT.EXE as the image to run and the command file
as the input.  For example:

	$ OPEN/WRITE CMD TEMP_INPUT.COM
	$ WRITE CMD "$ MYCOMMAND arguments"
	$ CLOSE CMD
	$ RUN/DETACHED SYS$SYSTEM:LOGINOUT /INPUT=TEMP_INPUT.COM

------------------------------------------------------------
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.
Re: How to run a C program taking command line arguments on VMS
#310
Author: yom
Date: Thu, 29 Feb 1996 02:50
36 lines
1205 bytes
It's been a long time since I've been on a VMS machine, but I think
you have to assign a global symbol for your executable:

$ foo :== $usr:[bar]foo.exe


Song (yom@clark.net)

In article <4h1u5d$s5c@news.fsu.edu>, meil@firnvx.firn.edu says...
>
>Could someone tell me how to run a C program which takes command line 
>arguments on VAX/VMS? I have checked the FAQ about openVMS and tried 
the 
>instructions. But I couldn't get it work. I don't have an openVMS 
mannual.  
>Please help me!
>
>My program is like:
>
>/* myprog.c */
>  
>  main(argn, **argv)
>  {
>  
>     ...
>
>  }
>
>If run on Unix or DOS, I could type something like
>
>  myprog -lu abcd
>
>How to run it on VMS?
>
>I'd appreciate your help!
>
Re: How to run a C program taking command line arguments on VMS
#307
Author: Greg Thomas
Date: Fri, 01 Mar 1996 09:54
27 lines
1318 bytes
Lynn Mei wrote:
> 
> Could someone tell me how to run a C program which takes command line
> arguments on VAX/VMS? I have checked the FAQ about openVMS and tried the
> instructions. But I couldn't get it work. I don't have an openVMS mannual.
> Please help me!
> 
> My program is like:...
> If run on Unix or DOS, I could type something like
>   myprog -lu abcd
> How to run it on VMS?

Because the VMS 'RUN' command takes VMS based argments, you need to 
set up a foreign symbol:
  $ myprog == "$DISK:[DIRECTORY]MY_PROG.EXE"
then just use 
  $ myprog -lu abcd
as you do on DOS/UNIX. This is detailed fairly clearly in the FAQ.

-- 
Greg Thomas
---
Tel (01473) 224832
Fax (01473) 233319
---
Any opinions expressed are mine, not necessarily those of the company 
I work for.
Re: How to run a C program taking command line arguments on VMS
#308
Author: mmiller4
Date: Fri, 01 Mar 1996 12:31
26 lines
1420 bytes
In article <4h1u5d$s5c@news.fsu.edu>, meil@firnvx.firn.edu (Lynn Mei) writes:
>Could someone tell me how to run a C program which takes command line 
>arguments on VAX/VMS? I have checked the FAQ about openVMS and tried the 
>instructions. But I couldn't get it work. I don't have an openVMS mannual.  
>Please help me!
>
>If run on Unix or DOS, I could type something like
>
>  myprog -lu abcd

You need to define a "foreign command" in DCL.  For example:

$ myprog == "$path:myprog.exe"
$ myprog -lu abcd

Note that VMS will convert the command line arguments to lowercase.  To prevent
this from happening, surround the arguments you do not want converted with
double quotes ("ARGUMENT").  For example:

$ myprog -lu "abcd"
------------------------------------------------------------------------------
Michael G. Miller                          "Nobody rides for free!!!" -- RATT
Ford Motor Credit Company
mmiller4@fc.ford.com

        -- Views are mine and not necessarily those of my employer. --
Re: How to run a C program taking command line arguments on VMS
#309
Author: Lynn Mei
Date: Fri, 01 Mar 1996 14:49
2 lines
526 bytes
Thanks to you all who helped me, I know how to run the program now.
I really appreciate!
Re: How to run a C program taking command line arguments on VMS
#312
Author: David Bratton
Date: Mon, 04 Mar 1996 17:00
17 lines
1033 bytes
Lynn Mei wrote:
> 
> Thanks to you all who helped me, I know how to run the program now.
> I really appreciate!

Just one more thing before the thread dies.

As of VMS 6.2 you have another option. You can define the logical
DCL$PATH to point to the directory containing the executable.
Then you _do not_ have to set it up as a foreign command.

$define/user dcl$path []
$foo -arg

David Bratton
University of Houston System
DBratton@uh.edu
Re: How to run a C program taking command line arguments on VMS
#311
Author: Ken Williams
Date: Tue, 05 Mar 1996 02:34
55 lines
1961 bytes
On 28 Feb 1996 23:27:38 GMT, carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
wrote:

>In article <4h1u5d$s5c@news.fsu.edu>, meil@firnvx.firn.edu (Lynn Mei) writes:
>=Could someone tell me how to run a C program which takes command line 
>=arguments on VAX/VMS? I have checked the FAQ about openVMS and tried the 
>=instructions. But I couldn't get it work. I don't have an openVMS mannual.  
>=Please help me!
>=
>=My program is like:
>=
>=/* myprog.c */
>=  
>=  main(argn, **argv)
>=  {
>=  
>=     ...
>=
>=  }
>=
>=If run on Unix or DOS, I could type something like
>=
>=  myprog -lu abcd
>=
>=How to run it on VMS?
>=
>=I'd appreciate your help!
>
>From the FAQ which you claim to have read:
>------------------------------------------------------------
>DCL1.   How do I run a program with arguments?
>
>The RUN command does not accept arguments.  To pass arguments to a program,
>you must use what is called a "foreign command".  For example:
>
>	$ uudecode :== $disk:[dir]uudecode.exe
>	$ uudecode filespec
>
[snip]

This discussion belongs in comp.os.vms but...
There is another option.  You can cause a program to execute as a
foreign command with the MCR command.  In the above example you could
do:

$ mcr uudecode filespec

If uudecode.exe is not in sys$system then you must provide the
complete device and directory specification of uudecode.

Regards,

Ken Williams
barnowl@blkbox.com
PGP Key Available On Request
Re: How to run a C program taking command line arguments on VMS
#313
Author: Ulli Horlacher
Date: Thu, 07 Mar 1996 16:13
39 lines
2147 bytes
On Mon, 04 Mar 1996 11:00:28 -0600, David Bratton (DBratton@uh.edu) wrote:
> 
> As of VMS 6.2 you have another option. You can define the logical
> DCL$PATH to point to the directory containing the executable.

Does this also work with lists of directories?

	$ define dcl$path sys$login,d1:[tools.exe],[]

This is a missing feature of VMS since version 1.0 :-)


BTW, for those without V6.2, I have written long time ago a
path-execution-emulation program called X.COM

From the help:

  X means eXecute:  execute a program, which can be found in a directory-
                    searchlist, as defined by the global DCL-symbol PATH.

  The program can be a VMS-image (type *.EXE) or a DCL-commandfile (type
  *.COM).
  Wildcards * and % are allowed as well as optionally passed parameters.

  Examples:  $ X LOGIN                    ! does a @SYS$LOGIN:LOGIN.COM
             $ X UUF* BLUB.BLAH BLUB.UUE  ! starts the image UUFIX.EXE and
                                          ! passes 2 parameters

  You can extend the search-path with: PATH==PATH+",<DIRECTORY>"
  Logicals are ok, too. eg:  PATH==PATH+",DD1:[FRAMSTAG.TOOLS],SYS$SCRATCH"


If you are interested in this program, send me a mail.

-- 
\ Ulli Horlacher   \ G=ulli;S=horlacher;OU=rus;P=uni-stuttgart;A=d400;C=de \ 
 \ Königsbergerstr 6 \ framstag@moep.bb.bawue.de \ ccc_horl@dulruu51.bitnet \
  \ 71065 Sindelfingen \ germany!framstag \ psi%026245050260103::8::ccc_horl \
   \ "Noch keine 30 und schon an die Nachwelt denken..." -  Kristian Köhntopp \
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads