You can make explicit calls to the Callable File Handler from your program using the following syntax:
call "EXTFH" using opcode fcd
where the parameters are:
| Parameter
|
Description
|
| "EXTFH"
|
The module name of the File Handler interface.
|
|
opcode
|
A File Handler operation code. See the section
Operation Codes.
|
|
fcd
|
The data area, known as the FCD (File Control Description) which is used by the File Handler to hold details of the file being
accessed. See the section
Data Structures.
|
Before the first call, you must follow these steps:
- Allocate data areas for the File Control Description (FCD), the record area, the filename area and the key definition block
(if the file is indexed)
- Initialize all the data areas to binary zeros to ensure that the File Handler does not receive invalid values
- Set the pointers in the FCD to point to the:
- Record area
- Filename area
- Key definition block (indexed files only)
You must then follow these steps for each File Handler operation:
- Fill in the appropriate fields in the FCD for the selected operation code
- Call the File Handler
- Determine the success of the file I/O operation by checking the file status
- Process the FCD fields and/or any data in the record area