contents.gifindex.gifprev1.gifnext1.gif

C$FILEINFO Routine

C$FILEINFO retrieves some operating system information about a given file.

Usage

CALL "C$FILEINFO"
   USING FILE-NAME, FILE-INFO,
   GIVING STATUS-CODE

Parameters

FILE-NAME PIC X(n)

Contains the name of the file to check. This should either be a full path name or a name relative to the current directory.

FILE-INFO Group item to receive returned information. Must have this structure:

01  FILE-INFO.
    02  FILE-SIZE    PIC X(8) COMP-X.
    02  FILE-DATE    PIC 9(8) COMP-X.
    02  FILE-TIME    PIC 9(8) COMP-X.

STATUS-CODE Any numeric data item.

This receives the return status. It will be zero if successful, or "1" if the file does not exist or is not a regular disk file.

Description

This routine checks to see if the passed file exists and is a regular disk file. If it is, then FILE-INFO is filled in with the appropriate information. The FILE-SIZE field is the size of the file in bytes. The FILE-DATE and FILE-TIME fields indicate the time the file was last modified. FILE-DATE has the form "YYYYMMDD" (year/month/day, note the 4-digit year) and FILE-TIME has the form "HHMMSShh" (hours/minutes/seconds/hundredths--just like ACCEPT FROM TIME). On all current implementations, the hundredths field is always set to zero.

Note that this routine provides a handy way to see if a file exists.