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:

  1. 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)
  2. Initialize all the data areas to binary zeros to ensure that the File Handler does not receive invalid values
  3. 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:

  1. Fill in the appropriate fields in the FCD for the selected operation code
  2. Call the File Handler
  3. Determine the success of the file I/O operation by checking the file status
  4. Process the FCD fields and/or any data in the record area

This documentation includes a tutorial demonstrating a number of file handling operations using the callable File Handler; see Tutorial: Using the Callable File Handler.