home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / fortran / 4212 < prev    next >
Encoding:
Internet Message Format  |  1992-11-06  |  3.1 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
  2. From: fairfield@slacvx.slac.stanford.edu
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Problem using $GETUAI
  5. Message-ID: <1992Nov5.133408.1@slacvx.slac.stanford.edu>
  6. Date: 5 Nov 92 21:34:08 GMT
  7. Article-I.D.: slacvx.1992Nov5.133408.1
  8. References: <1992Nov5.184235.12119@wega.rz.uni-ulm.de>
  9. Sender: news@unixhub.SLAC.Stanford.EDU
  10. Organization: Stanford Linear Accelerator Center
  11. Lines: 98
  12.  
  13. In article <1992Nov5.184235.12119@wega.rz.uni-ulm.de>, KARGL@rzmain.rz.uni-ulm.de (ComRam) writes:
  14. > Starting with the problem of finding the Real Name to a given Account I
  15. > first wrote a little C program which does the job and works quite fine.
  16. > Then I started to do the same thing in FORTRAN (Just for fun:-) and this
  17. > one refuses to work. The SYS$GETUAI returns a SS$_BADCONTEXT. Can anyone
  18. > tell me whats wrong with this thing?
  19. > --------------------------------------------------------------------------
  20. > * FINDREAL.FOR --- Find Owner Name --- (C) 1992 by ComRam
  21. >     PROGRAM Findreal
  22. >     IMPLICIT NONE
  23. >     
  24. >     INCLUDE '($JPIDEF)'
  25. >     INCLUDE '($UAIDEF)'
  26. >     CHARACTER*12   Username
  27. >     CHARACTER*32   Owner
  28. >     INTEGER Usernamelen,
  29. >     1    Ownerlen,
  30. >     2    Status,
  31. >     3    I
  32. >     INTEGER SYS$GETJPI,
  33. >     1    SYS$GETUAI
  34. >     STRUCTURE /ITMLST/
  35. >        INTEGER*2 BUFLEN,
  36. >     1            CODE
  37. >        INTEGER*4 BUFADR,
  38. >     1            RETLENADR
  39. >     END STRUCTURE
  40. >     
  41. >     RECORD /ITMLST/ JPI_LIST,
  42. >     1        UAI_LIST
  43.  
  44. [...]
  45.  
  46. >     Status = SYS$GETUAI (0,0,%DESCR(Username(1:I)),UAI_LIST,0,0,0)
  47. >     WRITE (*,*) 'Status : ',Status,'  Owner : ',Owner
  48. >     STOP
  49. >     END
  50.  
  51.     Petros Dafniotis <dafnioti@cae.wisc.edu> already noted that the call
  52. to SYS$GETUAI wants a "null" argument.  In VAX Fortran you either omit
  53. the argument, as Petros noted, or you pass a zero BY VALUE, i.e., %VAL(0).
  54.  
  55.     Furthermore, VAX Fortran passes character string arguments by descriptor,
  56. so your $DESCR(...) is redundant. (All other arguments are passed by reference,
  57. but you're not writing %REF(UAI_LIST), for example.)  Thus you would normally 
  58. write:
  59.  
  60.      Status = SYS$GETUAI (,,Username(1:I),UAI_LIST,,,)
  61.  
  62.     But what I _really_ wanted to comment on is that your item lists are
  63. supposed to be terminated by a longword zero.  Thus it's common to declare
  64. your ITMLST structure like so:
  65.  
  66.      STRUCTURE /ITMLST/
  67.       UNION
  68.         MAP
  69.            INTEGER*2 BUFLEN,
  70.      1               CODE
  71.            INTEGER*4 BUFADR,
  72.      1               RETLENADR
  73.         END MAP
  74.         MAP
  75.           INTEGER*4 ZERO
  76.         END MAP
  77.       END UNION
  78.      END STRUCTURE
  79.  
  80. followed by
  81.  
  82.      RECORD /ITMLST/ JPI_LIST(2),
  83.      1        UAI_LIST(2)
  84.  
  85. Your assignment statements change from "JPI_LIST.BUFLEN = 12" to
  86. "JPI_LIST(1).BUFLEN = 12", etc.  Finally, to be picky, you then add the 
  87. statements:
  88.  
  89.     JPI_LIST(2).ZERO = 0
  90. and
  91.     UAI_LIST(2).ZERO = 0
  92.  
  93.  
  94.         Cheers, Ken
  95. -- 
  96.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
  97.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  98.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  99.  ----------------------------------------------------------------------------
  100.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  101.