[mod.computers.vax] lib$ routine fails

colonel@buffalo.CSNET.UUCP (08/11/86)

Can anybody help with this problem?  Here's a simple fortran program:

C       TEST OF LIB$FIND_FILE.
        CHARACTER*255 EXP
        CHARACTER*255 SPEC
        INTEGER LIB$FIND_FILE
        SPEC = '*.CHR'
        IDUMMY = LIB$FIND_FILE(SPEC,EXP,0)
        PRINT *,EXP(1:78)
        STOP
        END

When I run it, it bombs on a HALT instruction.  The CALLG to LIB$FIND_FILE
points to a longword address in SHARE-LIBRTL rather than to the subroutine
itself.  What am I doing wrong?

colonel@buffalo.CSNET ("Col. G. L. Sicherman") (08/12/86)

From: "Col. G. L. Sicherman" <colonel%buffalo.csnet@CSNET-RELAY.ARPA>
Subject: lib$ routine fails
Newsgroups: mod.computers.vax
To: info-vax@SRI-KL.ARPA

Can anybody help with this problem?  Here's a simple fortran program:

C       TEST OF LIB$FIND_FILE.
	CHARACTER*255 EXP
	CHARACTER*255 SPEC
	INTEGER LIB$FIND_FILE
	SPEC = '*.CHR'
	IDUMMY = LIB$FIND_FILE(SPEC,EXP,0)
	PRINT *,EXP(1:78)
	STOP
	END

When I run it, it bombs on a HALT instruction.  The CALLG to
LIB$FIND_FILE points to a stored longword address in SHARE-LIBRTL
rather than to the subroutine itself.  What am I doing wrong?

CHAA006%vaxa.rhbnc.ac.uk@CS.UCL.AC.UK (08/14/86)

The run-time library manual shews that the third parameter requires
MODIFY access.  The following code appears to work.

C       TEST OF LIB$FIND_FILE.
        CHARACTER*255 EXP
        CHARACTER*255 SPEC
        INTEGER LIB$FIND_FILE, zero
	data zero /0/
        SPEC = '*.CHR'
        IDUMMY = LIB$FIND_FILE(SPEC,EXP,zero)
        PRINT *,EXP(1:78)
        STOP
        END

Philip Taylor (RHBNC; University of London, U.K.)

Bitnet/NetNorth/Earn: 	CHAA006@VAXA.RHBNC.AC.UK or CHAA006%RHBNC.VAXA@AC.UK
	or	    :	CHAA006@VAXB.RHBNC.AC.UK or CHAA006%RHBNC.VAXB@AC.UK

       Arpa	    :	CHAA006%UK.AC.RHBNC.VAXA@ARPA.UCL-CS
	or	    :	CHAA006%UK.AC.RHBNC.VAXB@ARPA.UCL-CS

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (08/17/86)

>   Can anybody help with this problem?  Here's a simple fortran program:
>   
>   C       TEST OF LIB$FIND_FILE.
>           CHARACTER*255 EXP
>           CHARACTER*255 SPEC
>           INTEGER LIB$FIND_FILE
>           SPEC = '*.CHR'
>           IDUMMY = LIB$FIND_FILE(SPEC,EXP,0)
>           PRINT *,EXP(1:78)
>           STOP
>           END
>   
>   When I run it, it bombs on a HALT instruction.  The CALLG to LIB$FIND_FILE
>   points to a longword address in SHARE-LIBRTL rather than to the subroutine
>   itself.  What am I doing wrong?

First of all, if you check, you'll find that the program is bombing in the
routine LIB$GET_VM. This is because it's just allocated enough memory to hold
the NAM block to store the context of your search, and is trying to store the
address of it in the address you gave it for such storage. Unfortunately,
address 00000000 is frowned upon for use as data storage. What you need to do
is to give LIB$FIND_FILE all its required parameters. context is defined to be
"[z]ero or an address of an internal FAB/NAM buffer from a previous call to
LIB$FIND_FILE".  The context argument is a longword containing the address of
the context.  In other words, you have to give the routine an integer*4
variable containing zero.  Thus, the following works properly: 

C	TEST OF LIB$FIND_FILE.
	PARAMETER RMS$_NORMAL = '00010001'X
	CHARACTER*255 EXP
	CHARACTER*255 SPEC
	INTEGER LIB$FIND_FILE, CTX
	SPEC = '*.CHR'
	IDUMMY = LIB$FIND_FILE(SPEC,EXP,CTX)
	PRINT *,EXP(1:78)
	STOP
	END

It would, of course, be nice if DEC would improve the documentation for
the arguments to the library routines;  in fact, they have, for uVMS, where
they use the same conventions for the system service documentation as is
used in the documentation of the instruction set.