Accessing Files Programmer's Guide (32650-90885)

Chapter 14 201
Getting File Information
Displaying File Error Information
Writing a file system error-check procedure
Error checking intrinsics can be used throughout a program every time that there is an
intrinsic call. Instead of repeating a call to PRINTFILEINFO many times, it is more efficient
to write an error-check procedure and merely call this procedure where necessary.
The following example is a sample error-check procedure, named FILERROR. This
procedure is declared at the beginning of the program; from that point on, it can be called
with a single statement.
The procedure contains two parameters. FILENO is an identifier through which the file
number is passed. The PRINTFILEINFO intrinsic then prints a file information display for
that file. QUITNO is part of the abort message printed by the QUIT intrinsic. This enables
you to determine the point at which the process was aborted.
PROCEDURE FILERROR(FILENO,QUITNO:SHORTINT);
BEGIN
PRINTFILEINFO(FILENO);
QUIT(QUITNO);
END;
15 NUMBER WRITERS is the number of FOPEN calls of the file with
some type of WRITE access. NUMBER READERS is the number of
FOPEN calls tothe file with READ access. This field applies only to
message files; it does not appear for other files.
16 The error number and residue.
17 The block number and number of records (NUMREC) for the file.
Table 14-3. PRINTFILEINFO Information
Line # Meaning