Accessing Files Programmer's Guide (32650-90885)

136 Chapter9
Reading from a File
Reading a File Label from a Labeled Tape File
FREADLABEL ( data_file, {file number of tape file}
label, {returns label }
length {# of halfwords to read}
);
if ccode <> cce then handle_file_error (data_file);
FWRITE ( list_file, {output to $STDLIST }
label, {label read by FREADLABEL }
length, {length of label }
control_code {default condition }
);
if ccode <> cce then handle_file_error (list_file);
end; {end read_user_label }
If an error is encountered by either FREADLABEL or FWRITE, procedure handle_file_error
is invoked. For more information about FREADLABEL intrinsic parameters, refer to the
MPE/iX Intrinsics Reference Manual. For more information about the FWRITE intrinsic,
refer to chapter 8, "Writing to a File". In appendix A, "HP Pascal/iX Program Examples",
example A-2 uses a similar procedure to read a user label from a labeled magnetic tape
file.