Accessing Files Programmer's Guide (32650-90885)

Appendix A 211
Pascal/XL Program Examples
Program Example A-2
{* This routine displays File System information about a file *}
{* and then calls QUIT to terminate the program. *}
{* PARAMETERS: *}
{* file_num (input) *}
{* - file number. The routine will print info about this *}
{* file. *}
{* quit_num (input) *}
{* - quit number. This number will be displayed by QUIT when *}
{* the program is terminated. *}
{************************************************************************}
begin {* handle_file_error *}
PRINTFILEINFO (file_num);
QUIT (quit_num);
end; {* handle_file_error *}
procedure handle_fclose_error;
{************************************************************************}
{* PURPOSE: *}
{* This routine informs the user that the disk file could not *}
{* closed. Then CAUSEBREAK is called to break the program; *}
{* this is done to give the user a chance to purge or rename *}
{* an existing disk file which has the same name as the one the *}
{* program is trying to save. When the user enters 'resume' *}
{* this routine will return to the caller. *}
{************************************************************************}
var
msgbuf : pac80;
begin {* handle_fclose_error *}
{* print error messages *}
{************************}
msgbuf := 'Can''t close disk file';
PRINT (msgbuf, -21, 0);
msgbuf := 'Check for duplicate name';
PRINT (msgbuf, -24, 0);
msgbuf := 'Fix, then type "resume"';
PRINT (msgbuf, -23, 0);
{* break the program *}
{*********************}
CAUSEBREAK;
end; {* handle_fclose_error *}
procedure open_tape_file
(
var file_num : integer
);
{************************************************************************}
{* PURPOSE: *}
{* This routine opens a labeled tape file. *}
{* PARAMETERS: *}