Accessing Files Programmer's Guide (32650-90885)

218 AppendixA
Pascal/XL Program Examples
Program Example A-3
{ DECLARATION PART }
{***********************************************************************}
const
ccg = 0; { condition code warning/EOF,/etc.. }
ccl = 1; { condition code error }
cce = 2; { condition code successful }
permanent = 1;
new = 0;
temp = 2;
delete = 4;
type
pac256 = packed array [1..256] of char;
pac80 = packed array [1..80] of char;
{HPFOPEN status parameter type }
status_type = record
case integer of
0 : (info : shortint;
subsys : shortint);
1 : (all : integer);
end;
var
old_file : integer;
new_file : integer;
filename : pac80;
label_id : integer;
label_len : integer;
outbuf : pac80;
function FREAD: shortint; intrinsic; { sequential read old file }
procedure HPFOPEN; intrinsic; { open both disk files }
procedure FCLOSE; intrinsic; { close both disk files }
procedure FWRITEDIR; intrinsic; { random access write to new file }
procedure FWRITELABEL; intrinsic; { write new user-defined label }
procedure PRINTFILEINFO; intrinsic; { user in error-handler }
procedure FGETINFO; intrinsic; { get EOF location }
procedure QUIT; intrinsic; { use in error-handler }
procedure handle_file_error
(
file_num : shortint;
quit_num : shortint
);
{***********************************************************************}
{ procedure handle_file_error prints file information on the job/session}
{ list device, then aborts the program. }
{***********************************************************************}
begin
PRINTFILEINFO (file_num);
QUIT (quit_num);
end; { end handle_file_error }
procedure open_disk_file
(