Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!decvax!bellcore!ulysses!cbosgd!ucbvax!CITHEX.CALTECH.EDU!carl From: carl@CITHEX.CALTECH.EDU (Carl J Lydick) Newsgroups: mod.computers.vax Subject: Re: lib$ routine fails Message-ID: <860817085812.001@CitHex.Caltech.Edu> Date: Sun, 17-Aug-86 12:31:03 EDT Article-I.D.: CitHex.860817085812.001 Posted: Sun Aug 17 12:31:03 1986 Date-Received: Tue, 19-Aug-86 00:46:05 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 42 Approved: 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 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.