Accessing Files Programmer's Guide (32650-90885)

214 AppendixA
Pascal/XL Program Examples
Program Example A-2
if status.all <> 0 then {* check for error condition *}
begin
print_hpfopen_error (status);
handle_file_error (file_num, 2);
end;
end; {* open_disk_file * }
procedure print_user_label
(
file_num : integer
);
{************************************************************************}
{* PURPOSE: *}
{* This routine reads the user label from the tape file and *}
{* then prints the user label to $STDLIST. *}
{* PARAMETERS: *}
{* file_num (input) *}
{* - file number of open tape file *}
{************************************************************************}
var
inbuf : pac80; {* buffer for the user label *}
begin {* print_user_label *}
FREADLABEL (file_num, inbuf, 40); {* read the user label from tape*}
if ccode <> CCE then {* check for error condition *}
begin
print_fserr (file_num);
handle_file_error (file_num, 3);
end;
PRINT (inbuf, 40, 0); {* print the user label to $stdlist *}
end; {* print_user_label *}
procedure copy_file_from_tape_to_disk
(
tape_file : integer;
disk_file : integer
);
{************************************************************************}
{* PURPOSE: *}
{* This routine copies a tape file to a disk file one record at *}
{* a time (sequential access). *}
{* PARAMETERS: *}
{* tape_file (input) *}
{* - file number of an open tape file *}
{* disk_file (input) *}
{* - file number of an open disk file *}
{************************************************************************}
var