.TITLE FMN_FILE_STATISTICS .IDENT /1-001/ .SUBTITLE Program Description ;++ ; ; MODULE: FMN_FILE_STATISTICS ; ; SOURCE CODE FILE: ARC_SOURCE:[MENUSYS]FILESTAT.MAR ; ; VERSION: 1-001 ; ; FACILITY: Financial Management Menu System ; ; ABSTRACT: Returns file statistics. ; ; ENVIRONMENT: User Mode, AST Reentrant ; ; AUTHOR: Don Stevens-Rayburn ; ; COPYRIGHT: Applied Research Corporation ; ; CREATION DATE: 03-Mar-1989 ; ; MODIFICATION HISTORY: ; ; FUNCTIONAL DESCRIPTION: ; ; Given a file-spec, this procedure returns: ; ; 1. The file name ( string ). ; 2. The file type ( string ). ; 3. The file version ( string ). ; 4. The file size ( integer ). ; 5. The file date ( string ). ; ; REGISTER USE: ; ; INCLUDED SOURCE FILES: None. ; ; CALLING SEQUENCE: ; ; status = FMN_FILE_STATISTICS ( file-spec, ; file-name, ; file-type, ; file-version, ; file-size, ; file-date ) ; ; where file-spec is a character variable or constant containing ; a valid file specification or logical name and file-size is ; an longword buffer to get the returned size. ; ; FORMAL ARGUMENTS: ; ; file-spec ; VMS_USAGE: char_string ; TYPE: fixed length string ; ACCESS: read only ; MECHANISM: by descriptor ; ; file-name ; VMS_USAGE: char_string ; TYPE: fixed length string ; ACCESS: write only ; MECHANISM: by descriptor ; ; file-type ; VMS_USAGE: char_string ; TYPE: fixed length string ; ACCESS: write only ; MECHANISM: by descriptor ; ; file-version ; VMS_USAGE: char_string ; TYPE: fixed length string ; ACCESS: write only ; MECHANISM: by descriptor ; ; file-size ; VMS_USAGE: longword ; TYPE: unsigned integer ; ACCESS: write only ; MECHANISM: by reference ; ; file-date ; VMS_USAGE: char_string ; TYPE: fixed length string ; ACCESS: write only ; MECHANISM: by descriptor ; ; IMPLICIT INPUTS: None. ; ; IMPLICIT OUTPUTS: None. ; ; COMPLETION STATUS: ; ; SS$_BADPARAM file-name is not a valid string. ; ; Completion codes returned by system service calls are passed ; through to the caller. ; ; CONDITIONS SIGNALLED: None. ; ; SUBROUTINES, FUNCTIONS AND MACROS CALLED: ; ; SIDE EFFECTS: None. ; ;-- $SSDEF ; Define error codes. $NAMDEF ; NAM block definitions. $FABDEF ; FAB block definitions. $XABDATDEF ; XABDAT block definitions. FSPEC = 4 ; Define argument offsets. FNAME = 8 FTYPE = 12 FVERS = 16 FSIZE = 20 FDATE = 24 .PSECT DATA,NOEXE,WRT,LONG .ALIGN LONG NAM_BLK: $NAM RSA=RES_STR,- ; Result buffer address RSS=NAM$C_MAXRSS,- ; Result buffer size ESA=EXP_STR,- ; Expanded buffer address ESS=NAM$C_MAXRSS ; Expanded buffer size .ALIGN LONG FAB_BLK: $FAB FOP=NAM,- ; Use NAM block option NAM=NAM_BLK,- ; Pointer to NAM block FNA=TRN_LOG_NAM,- ; Addr of file name string XAB=XAB_DATE ; Addr of first XAB. XAB_DATE: $XABDAT ; Declare Date XAB. EXP_STR: .BLKB NAM$C_MAXRSS ; Expanded string buffer RES_STR: .BLKB NAM$C_MAXRSS ; Resultant string buffer RES_STR_D: .BLKL 1 ; Resultant string descriptor .ADDRESS RES_STR INP_LOG_NAM_D: .BLKL 2 ; Descriptor for input logical name. TRN_LOG_NAM: .BLKB NAM$C_MAXRSS ; Buffer for translated logical name. TRN_LOG_NAM_D: .LONG NAM$C_MAXRSS ; Descriptor for translated logical .ADDRESS TRN_LOG_NAM ; Name TRN_LOG_LEN: .BLKW 1 ; Translated name length .PSECT CODE,EXE,NOWRT .ENTRY FMN_FILE_STATISTICS, ^M .SUBTITLE Translate Logical Name MOVQ @4(AP),INP_LOG_NAM_D ; Move input logical descriptor. $TRNLOG_S LOGNAM=INP_LOG_NAM_D, - ; Translate logical name RSLLEN=TRN_LOG_LEN, - RSLBUF=TRN_LOG_NAM_D BLBS R0,L010 ; Branch on success. RET ; Return Error Status. L010: MOVB TRN_LOG_LEN,- ; Set String length FAB_BLK+FAB$B_FNS $PARSE FAB=FAB_BLK ; Parse the file spec. BLBS R0,L020 ; Branch on success RET ; Return Error Status. L020: $SEARCH FAB=FAB_BLK ; Search for the file. BLBS R0,L030 ; Branch on success. RET ; Return error status. L030: MOVZBL NAM_BLK+NAM$B_RSL,- ; Set String Length. RES_STR_D $OPEN FAB=FAB_BLK ; Open file BLBS R0,NAM ; Branch on success. RET ; Return error status. NAM: MOVQ @FNAME(AP), R7 ; Move descriptor into R7 & R8. MOVZBL R7,R7 ; Clear all but length. MOVZBL NAM_BLK+NAM$B_NAME,R5 MOVL NAM_BLK+NAM$L_NAME,R6 MOVC5 R5,(R6),#^A/ /,R7,(R8) ; Move file name to output buff. TYP: MOVQ @FTYPE(AP), R7 ; Move descriptor into R7 & R8. MOVZBL R7,R7 ; Clear all but length. MOVZBL NAM_BLK+NAM$B_TYPE,R5 MOVL NAM_BLK+NAM$L_TYPE,R6 MOVC5 R5,(R6),#^A/ /,R7,(R8) ; Move file type to output buff. VER: MOVQ @FVERS(AP), R7 ; Move descriptor into R7 & R8. MOVZBL R7,R7 ; Clear all but length. MOVZBL NAM_BLK+NAM$B_VER,R5 MOVL NAM_BLK+NAM$L_VER,R6 MOVC5 R5,(R6),#^A/ /,R7,(R8) ; Move file name to output buff. ALQ: MOVL FAB_BLK+FAB$L_ALQ,@FSIZE(AP) ; Move size. CDT: $ASCTIM_S TIMBUF=@FDATE(AP),- ; Convert date to string. TIMADR=XAB_DATE+XAB$Q_CDT BRW SUCCESS SUCCESS: $CLOSE FAB=FAB_BLK ; Close the file. MOVL #SS$_NORMAL,R0 ; Return status. RET .SUBTITLE Error Return FAILURE: $CLOSE FAB=FAB_BLK MOVL #SS$_BADPARAM,R0 RET .END