From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 26-AUG-1990 09:23:20.06
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: VMS Questions- can life be simplified [DO.COM]

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA12821; Sun, 26 Aug 90 09:12:58 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Sat, 25 AUG 90 21:54:22 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA00259; Sat, 25 Aug 90 21:42:10 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 26 Aug 90 04:23:11 GMT
From: maverick.ksu.ksu.edu!iowasp.physics.uiowa.edu!granroth@rutgers.edu
Organization: Department of Physics and Astronomy, University of Iowa
Subject: Re: VMS Questions- can life be simplified [DO.COM]
Message-Id: <1990Aug25.232311.795@iowasp.physics.uiowa.edu>
References: <9008241356.AA21846@ucbvax.Berkeley.EDU>, <JYM.90Aug24133647@remarque.berkeley.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Someone recently asked, among other things, about a Unixish "set path"
type of functionality for VMS.  I wrote a little utility called DO.COM
which will execute routines (either .COM or .EXE) from the default
directory or from a search path, and has the "benefit" of not defining
a lingering foreign command.  It's a trivial little thing, but I
thought someone might find it useful.  Comments follow code.

-Larry    Granroth@IowaSP.physics.UIowa.edu    IOWASP::GRANROTH

---------------------------------------------------------------------

$ ! DO.COM foreign command utility.  Documentation follows code.
$ if p1 .eqs. ""
$ then write sys$output "Usage: DO command [arg1 arg2 . . . arg8]"
$   exit
$ endif
$ name = f$search ("''p1'.com")
$ if name .nes. ""
$ then pre = "@"
$ else
$   name = f$search ("''p1'.exe")
$   if name .nes. ""
$   then pre = "$"
$   else
$     name = f$search ("do_path:''p1'.com")
$     if name .nes. ""
$     then pre = "@"
$     else
$	name = f$search ("do_path:''p1'.exe")
$	if name .nes. ""
$	then pre = "$"
$	else
$	  write sys$output "Unable to execute ", p1, " from:"
$	  show logical do_path
$	  exit
$	endif
$     endif
$   endif
$ endif
$ cmd := 'pre''name'
$ ! write sys$output name
$ define/nolog sys$input sys$command
$ cmd 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8' 'p9'
$ exit
$ !--------------------------------------------------------------------
$ !
$ !  DO.COM written 01-11-90 by L. Granroth
$ !  will allow any .COM or .EXE files in a defined search path
$ !  to be automatically executed as foreign commands with optional
$ !  parameters.
$ !  Simply define DO.COM as a foreign command and define DO_PATH to
$ !  be a directory search path where executables and command files
$ !  will reside.
$ !
$ ! $ do :== @device:[directory]do.com
$ ! $ define do_path disk$system:[public.tools], disk$user:[my.tools]
$ !
$ !  Then invoke those files by entering something like:
$ !
$ !  $ DO filename arg1 arg2
$ !  where "arg1" and "arg2" are command line arguments to "filename".
$ !
$ !  A matching .COM file will be invoked in preference to a .EXE file
$ !  and the current default directory will be searched before the
$ !  directories specified by DO_PATH.  A command file name using wild card
$ !  characters will invoke the first matching file.
$ !
$ !--------------------------------------------------------------------

