Accessing Files Programmer's Guide (32650-90885)

Chapter 14 199
Getting File Information
Displaying File Error Information
FERRMSG
This intrinsic is used following a call to FCHECK, to return an error message explaining the
nature of a file system error. It has three required parameters:
errorcode
is the error
number returned by FCHECK,
msgbuf
returns the error message, and
msglgth
returns the
length of the error message returned in
msgbuf.
This example shows a call to FCLOSE. If this returns a CCL condition, a call to FCHECK
requests the error code; then FERRMSG returns the error message associated with this code:
FCLOSE(FILENUM,1,0);
IF CCODE = CCL
THEN BEGIN
FCHECK(FILENUM,ERRNUM); {Returns error number }
FERRMSG(ERRNUM,MESSAGE,LENGTH); {Returns error message }
PRINT(MESSAGE,-LENGTH,0); {Prints error message to
$STDLIST}
TERMINATE; {Terminate process }
END;
If the FCHECK code has no assigned meaning, the following message is returned:
UNDEFINED ERROR errorcode
PRINTFILEINFO
This intrinsic prints a file information display on the job or session list device, $STDLIST.
The information shown depends upon whether or not a file is opened when the error
occurs. For files not yet opened, or for which the FOPEN intrinsic fails, the display is shown
in Example 14-1.
Example 14-1. File Information Display, Unopened File
+-F-I-L-E---I-N-F-O-R-M-A-T-I-O-N---D-I-S-P-L-A-Y+
! FILE NUMBER 5 IS UNDEFINED. ! Line #1
! ERROR NUMBER: 2 RESIDUE: 0 (WORDS) ! Line #2
! BLOCK NUMBER: 0 NUMREC: 0 ! Line #3
+------------------------------------------------+
The lines in this display show the following information:
For files that are open when a CCG (EOF error) or CCL (irrecoverable file error) was
returned, the file information display appears as shown in Example 14-2.
Example 14-2. File Information Display, Opened File
Line # Meaning
1 Warns that no corresponding file is open.
2 ERROR NUMBER indicates the last FOPEN error for the calling program.
RESIDUE is the number of words not transferred in an I/O request; since no
such request applies here, this is zero.
3 In this form, the BLOCK, NUMBER, and NUMREC fields are always zero.