C$FILEINFO

C$FILEINFO retrieves some operating system information about a given file.
Note: This ACUCOBOL-GT library routine is available in this COBOL version. Any compatibility issues in this COBOL system are in the Compatibility Issues section at the end of the topic.

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. Remote name notation and "@[DISPLAY:]" notation are allowed for this parameter. If run in standalone mode, and the "@[DISPLAY]" syntax is used, the file will be searched for on the local machine.
FILE-INFO Group item to receive returned information.     FILE-INFO must have the following 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.

The behavior of this routine is affected by the FILENAME_SPACES configuration variable. The value of FILENAME_SPACES determines whether spaces are allowed in a file name. See the entry for FILENAME_SPACES in Appendix H for more information.

Compatibility Issues

  • "@[DISPLAY]" is not supported in this COBOL system.
  • The FILENAME_SPACES configuration variable is not supported in this COBOL system. To use filenames that contain spaces, enclose them in quotation marks.