[mod.computers.vax] ACCESSING SYSUAF.DAT FROM PASCAL

JGILL@UTMEM1.BITNET.UUCP (02/10/87)

If you have VMS 4.4 or later, you should use the $GETUAI system service.  If
you have VMS 4.3 or earlier, you can access it from PASCAL with the following:
 
var     sysuaf_file : file of varying [1500] of char;
        sysuaf_rec = record case integer of
            1 : (s:varying [1500] of char);
            2 : (r:record
              rlen : [word] $byte; { this has the actual length of the record }
              { fill in the rest of the record layout here}
            end)
          end;
 
begin
  open(file_variable := sysuaf_file,
       file_name := 'sys$system:sysuaf.dat',
       history := old,
       sharing := readwrite,
       access_method := keyed,
       error := continue);
{ rest of program }
end.
 
Reading from the file is no problem, but to write a true variable length record,
you must use the WRITEV statement to write all the fields into a variable (in
the above example, this would be
        writev(sysuaf_rec.s,field1, field2, ...);
        sysuaf_file^ := sysuaf_rec.s;
        update(sysuaf_file);
 
John Gill                                       JGILL@UTMEM1
University of Tennessee, Memphis