Accessing Files Programmer's Guide (32650-90885)

212 AppendixA
Pascal/XL Program Examples
Program Example A-2
{* file_num (output) *}
{* - file number of open tape file *}
{************************************************************************}
const
{* define HPFOPEN item numbers *}
formal_designator_option = 2;
domain_option = 3;
tape_label_option = 8;
access_type_option = 11;
tape_type_option = 30;
tape_expiration_option = 31;
device_class_option = 42;
var
{* define HPFOPEN items *}
read_only : integer;
device_class : pac80;
old : integer;
file_name : pac80;
tape_label : pac80;
ansi_tape : integer;
tape_expiration : pac80;
{* define scratch varibles *}
msgbuf : pac80;
status : status_type;
begin {* open_tape_file *}
{* set up the item values for the HPFOPEN intrinsic *}
{****************************************************}
file_name := '&tapefile&';
old := 3;
read_only := 0;
tape_label := '&tape01&';
ansi_tape := 0;
tape_expiration := '&05/20/87&';
device_class := '&tape&';
HPFOPEN (file_num, status, formal_designator_option, file_name,
device_class_option, device_class,
domain_option, old,
tape_label_option, tape_label,
tape_type_option, ansi_tape,
access_type_option, read_only,
tape_expiration_option, tape_expiration);
if status.all <> 0 then {* check for error condition *}
begin
print_hpfopen_error (status);
handle_file_error (file_num, 1);
end;
end; {* open_tape_file *}
procedure open_disk_file
(
var file_num : integer
);