Accessing Files Programmer's Guide (32650-90885)
106 Chapter6
Closing a File
Closing a 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-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.
Closing a permanent disk file
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
.
.
.
HPFOPEN(file_num, status,
formal_designator_option, file_name, {HPFOPEN
formaldesignator option
}
domain_option, permanent, {HPFOPEN
domain option
}
access_type_option, update, {HPFOPEN
access type option
}
dynamic_locking_option, lockable, {HPFOPEN
dynamic locking option
}
exclusive_option, shared {HPFOPEN
exclusive option
}
ASCII_binary_option, ascii {HPFOPEN
ASCII/binary option
}
);
.
.
.
error := 1;
disposition := 0; {no change to disposition }
security_code := 0; {No additional restrictions }
FCLOSE ( file_num, {file_num returned by HPFOPEN }
disposition, {don't change prior disposition }
security_code {no additional restrictions are added }
);
if ccode = error then handle_file_error (file_num, 0)
.
.
.
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.