Accessing Files Programmer's Guide (32650-90885)

Appendix A 219
Pascal/XL Program Examples
Program Example A-3
var file_num : integer;
file_name : pac80;
domain : integer
);
{***********************************************************************}
{procedure open_disk_file is a generic file open procedure that allows }
{you to specify the file name, it's domain, type of access, and internal}
{format - ASCII or binary. }
{***********************************************************************}
const
{**define HPFOPEN item numbers** }
formal_designator_option = 2;
domain_option = 3;
access_type_option = 11;
ascii_binary_option = 53;
var
{**define HPFOPEN items********* }
update : integer;
ascii : integer;
{**define scratch variables** }
msgbuf : pac80;
status : status_type;
begin
update := 5;
ascii := 1;
HPFOPEN (file_num, status, formal_designator_option, file_name,
domain_option, domain,
ascii_binary_option, ascii,
access_type_option, update);
if status.all <> 0 then
handle_file_error (file_num, 1);
end; { end open_disk_file }
procedure write_user_label
(
file_num : integer;
buffer : pac80;
length : integer;
lnum : integer
);
{************************************************************************}
{ procedure write_user_label writes a user-defined label to the specified}
{ file. }
{************************************************************************}
begin
FWRITELABEL (file_num, buffer, length, lnum);
if ccode <> cce then
handle_file_error (file_num, 2);