From: Tom Wade [t.wade@vms.eurokom.removespam.ie] Sent: Friday, October 25, 2002 10:24 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: File Attributes "Atlant Schmidt" wrote in message news:3DB7EEE3.BBE91ABD@mindspring.com... > JF Mezei wrote: > > > Bill wrote: > > > I can get to the file attributes (i.e. "Revision Date") through the > > > Lexical f$file_attributes within a command procedure. But how do I > > > get to the same information through a Fortran program? > > > > HELP RMS > > > > Look at FAB and various XABs that get populated with a SYS$OPEN (as well as > > other calls). > > Look at the FABs and RABs? Good golly! > No wonder you VMS folks are paid the big bucks! > You work very, very hard for simple data! :-) Never let it be said .... I enclose a file RDATE.MAR which has a routine Revision_Date (rab, date) which returns a revision date given a RAB of the open file (the RAB is got from the For$Rab intrinsic function, and the date can be converted to text using $ASCTIM). A sample Fortran program GET-DATE.FOR is also provided which calls the Macro code and writes out what you want. Since I am posting this from an MS newsreader, it's quite likely it will munge or wrap some of the stuff, in which case you can get it from ftp://picard.eurokom.ie/revision-date.zip ------------ File RDATE.MAR ------------------ ;*************************************************************************** *** ; Routine to return the revision date of an opened file. 1st arg contains ; the RAB address of the file. Return the date/time in internal form in ; the second arg (passed by address). $FABDEF ; RMS Macros $RABDEF $XABDEF .Psect OS_DATA noexe, wrt, noshr, quad File_Xabdat: $XABDAT ; Date/Time access block. .Psect OS_CODE exe, nowrt, shr, quad .Entry Revision_Date ^M Movl @4(AP), R6 ; get RAB address Movl Rab$L_Fab(R6), R6 ; get FAB address Movl Fab$L_Xab(R6), R7 ; save old value Moval File_Xabdat, - ; load XAB address into Fab$L_Xab(R6) ; FAB $DISPLAY - ; get the info we Fab = R6 ; need into XAB Blbc R0, exit_revision_date Moval file_xabdat, R8 ; get XAB address. Movq Xab$Q_Rdt(R8), @8(AP) ; return revision date Movl #SS$_Normal, R0 ; indicate success Exit_Revision_Date: Movl R7, Fab$L_Xab(R6) ; put it back Ret ; out of here. .End ----------- File GET-DATE.FOR --------------- Program Get_Date Implicit None Integer rab, unit, length Integer *4 cdate (2) Logical ok, Revision_Date Character *255 file Character *25 date_string Call Lib$Get_Lun (unit) Call Lib$Get_Input (file, 'File: ', length) Open (unit, name=file (1:length), status='old', readonly) rab = For$Rab (unit) ok = Revision_Date (rab, cdate) If (.not. ok) call Sys$Exit (%Val (ok)) Call Sys$Asctim (length, date_string, cdate) Call Lib$Put_Output (date_string (1:length)) End ------------------------------------------------ ------------------------------------------------------------------------ Tom Wade | EMail: tee dot wade at eurokom dot ie 30, Dale Rd | Tel: +353 (1) 278-7878 Stillorgan | Fax: +353 (1) 278-7879 Co Dublin | Disclaimer: This is not a disclaimer Ireland | Tip: "Friends don't let friends do Unix !"