Example 6-1 is an HP Pascal/XL code segment containing an HPFOPEN call
that opens a new file, and an FCLOSE intrinsic call that changes the
disposition of the file to permanent prior to closing it. (Refer to Example 5-1
for details on this HPFOPEN call.)
In Example 6-1, there is a disposition conflict between the FCLOSE
call and the HPFOPEN call that opened the file identified by
file_num:
The disposition parameter of FCLOSE
specifies that the file is to be closed as a permanent file.
The final disposition option of the
HPFOPEN call specifies that the file should be closed
as a temporary file.
The disposition parameter of FCLOSE takes precedence
over the final disposition option of HPFOPEN because the integer value
of FCLOSE's disposition (1) is a smaller positive
value than that of HPFOPEN's final disposition option
(2).
Example 6-1. Closing a New Disk File as Permanent
If the file could not be closed because an incorrect file_num was
specified, or another file of the same name and disposition already exists,
ccode returns a value of one, thus invoking the error-handling
procedure handle_file_error.
In Appendix A, "Pascal/XL Program Examples," Example A-1 uses
a similar procedure to close a new disk file. For more information
about FCLOSE parameters, refer to the MPE/iX Intrinsics
Reference Manual.
Example 6-2 closes the permanent file opened in Example 5-2. (Refer to Example
5-2 for details on this HPFOPEN call.) The disposition of the file is
not changed when it is closed. The file remains a permanent disk file.
Example 6-2. Closing a Permanent Disk File
If the file could not be closed because an incorrect file_num was
specified, or another file of the same name and disposition already exists,
ccode returns a value of one, thus invoking the error-handling
procedure handle_file_error.
In Appendix A, "Pascal/XL Program Examples," Example A-5 uses
a similar procedure to close a permanent disk file. For more information
about FCLOSE parameters, refer to the MPE/iX Intrinsics
Reference Manual.