home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!ucbvax!GENVAX.COMPUTER-CENTRE.POLY-OF-WALES.AC.UK!AWOSBORNE
- From: AWOSBORNE@GENVAX.COMPUTER-CENTRE.POLY-OF-WALES.AC.UK
- Newsgroups: comp.os.vms
- Subject: help with C/fortran and LIB$SPAWN problem
- Message-ID: <9207282033.AA18527@ucbvax.Berkeley.EDU>
- Date: 28 Jul 92 17:26:00 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 101
-
-
- Hi everybody,
-
- Basically this request is about using FORTRAN or C to get the
- name of the DCL script within which a the program is being run.
-
-
- A few months ago a request came onto the net for a means of
- getting the name of a command file from within which a H.L.L
- program is being run, as DCL's f$environment("procedure") does.
-
- The general concensus was that it couldn't be done with the
- present collection of library and system routines.
- A macro program was then mailed which managed to return the
- command-file name (well done whoever!).
-
- As I don't have any experience of MACRO and want a solution that
- can work across VMS versions, I tried a different approach
- ( and failed ! 8-( )
-
-
- Here's my failed attempt:
-
- Within a DCL script, you could spawn a command such as the
- following:
-
- $spawn define envfile1 'f$environment("procedure")'/table=lnm$job
-
- which places the DCL script-name into a logical - great !
-
-
- I would like to do this from within FORTRAN or C during its
- (not before, which a user can fake) for later reading, and
- tried the following:
-
- PROGRAM TEST
- IMPLICIT NONE
-
- CHARACTER*40 COMM1/'def envfile1 testmsg/table=lnm$job'/
- CHARACTER*70 COMM2/'def envfile2 ''f$environment("procedure")''
- 1/TABLE=LNM$job'/
-
- INTEGER*4 STATUS,
- 1 LIB$SPAWN
-
- ! This is the test DEFINE with a simple string
- PRINT *,COMM1
-
- ! This is the DEFINE string that doesn't work
- PRINT *,COMM2
-
- STATUS=LIB$SPAWN(comm1)
- IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
-
- STATUS=LIB$SPAWN(comm2)
- IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
-
- END
-
-
- Unfortunately, the first spawned DEFINE worked,
- BUT the second spawned DEFINE didn't,
- returning the following mesages:
-
- V86_ena> @do ! my command file which runs the above program
- def envfile1 testmsg/table=lnm$job
- def envfile2 'f$environment("procedure")'/TABLE=LNM$job
- %DCL-W-NULFIL, missing or invalid file specification - respecify
- V86_ena> sho log env*
-
- (LNM$PROCESS_TABLE)
-
- (LNM$JOB_83496D10)
-
- "ENVFILE1" = "TESTMSG"
-
- (LNM$GROUP_000020)
-
- (LNM$SYSTEM_TABLE)
-
- (DECW$LOGICAL_NAMES)
-
-
- Can anybody point me in the right direction for passing the
- DEFINE ENVFILE 'F$ENVIRONMENT("PROCEDURE")' command-line
- using SPAWN from within FORTRAN or C, and getting it to store
- the DCL script-name in which it's being run ?. It appears to
- be tripping over the single quotes - any work-arounds ?
-
-
- We're on VMS 5.4_2 and I used Fortran version 5.6 for the
- above test.
- Hope somebody can help ...
-
-
- Nye Osborne.
-
- Polytechnic of Wales (POW)
- soon to be:
- University of Glamorgan (UG) Yuk !
-
-