home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
- From: fairfield@slacvx.slac.stanford.edu
- Newsgroups: comp.lang.fortran
- Subject: Re: Problem using $GETUAI
- Message-ID: <1992Nov5.133408.1@slacvx.slac.stanford.edu>
- Date: 5 Nov 92 21:34:08 GMT
- Article-I.D.: slacvx.1992Nov5.133408.1
- References: <1992Nov5.184235.12119@wega.rz.uni-ulm.de>
- Sender: news@unixhub.SLAC.Stanford.EDU
- Organization: Stanford Linear Accelerator Center
- Lines: 98
-
- In article <1992Nov5.184235.12119@wega.rz.uni-ulm.de>, KARGL@rzmain.rz.uni-ulm.de (ComRam) writes:
- > Starting with the problem of finding the Real Name to a given Account I
- > first wrote a little C program which does the job and works quite fine.
- > Then I started to do the same thing in FORTRAN (Just for fun:-) and this
- > one refuses to work. The SYS$GETUAI returns a SS$_BADCONTEXT. Can anyone
- > tell me whats wrong with this thing?
- >
- > --------------------------------------------------------------------------
- >
- > * FINDREAL.FOR --- Find Owner Name --- (C) 1992 by ComRam
- >
- > PROGRAM Findreal
- >
- > IMPLICIT NONE
- >
- > INCLUDE '($JPIDEF)'
- > INCLUDE '($UAIDEF)'
- >
- > CHARACTER*12 Username
- > CHARACTER*32 Owner
- >
- > INTEGER Usernamelen,
- > 1 Ownerlen,
- > 2 Status,
- > 3 I
- >
- > INTEGER SYS$GETJPI,
- > 1 SYS$GETUAI
- >
- > STRUCTURE /ITMLST/
- > INTEGER*2 BUFLEN,
- > 1 CODE
- > INTEGER*4 BUFADR,
- > 1 RETLENADR
- > END STRUCTURE
- >
- > RECORD /ITMLST/ JPI_LIST,
- > 1 UAI_LIST
-
- [...]
-
- > Status = SYS$GETUAI (0,0,%DESCR(Username(1:I)),UAI_LIST,0,0,0)
- >
- > WRITE (*,*) 'Status : ',Status,' Owner : ',Owner
- >
- > STOP
- > END
-
- Petros Dafniotis <dafnioti@cae.wisc.edu> already noted that the call
- to SYS$GETUAI wants a "null" argument. In VAX Fortran you either omit
- the argument, as Petros noted, or you pass a zero BY VALUE, i.e., %VAL(0).
-
- Furthermore, VAX Fortran passes character string arguments by descriptor,
- so your $DESCR(...) is redundant. (All other arguments are passed by reference,
- but you're not writing %REF(UAI_LIST), for example.) Thus you would normally
- write:
-
- Status = SYS$GETUAI (,,Username(1:I),UAI_LIST,,,)
-
- But what I _really_ wanted to comment on is that your item lists are
- supposed to be terminated by a longword zero. Thus it's common to declare
- your ITMLST structure like so:
-
- STRUCTURE /ITMLST/
- UNION
- MAP
- INTEGER*2 BUFLEN,
- 1 CODE
- INTEGER*4 BUFADR,
- 1 RETLENADR
- END MAP
- MAP
- INTEGER*4 ZERO
- END MAP
- END UNION
- END STRUCTURE
-
- followed by
-
- RECORD /ITMLST/ JPI_LIST(2),
- 1 UAI_LIST(2)
-
- Your assignment statements change from "JPI_LIST.BUFLEN = 12" to
- "JPI_LIST(1).BUFLEN = 12", etc. Finally, to be picky, you then add the
- statements:
-
- JPI_LIST(2).ZERO = 0
- and
- UAI_LIST(2).ZERO = 0
-
-
- Cheers, Ken
- --
- Dr. Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu
- SLAC, P.O.Box 4349, MS 98 | DECnet: 45537::FAIRFIELD (45537=SLACVX)
- Stanford, CA 94309 | BITNET Fairfield@Slacvx
- ----------------------------------------------------------------------------
- These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
-