Define the Filename Area

Another pre-requisite of using the callable file handler is to set up a filename area: a data item containing the name of the data file, and depending on the type of file you are dealing with, a data item for the separate index file.
  1. Again, in the working-storage section, beneath the FCD definition, paste the following code:
           01 ex-filename                  pic x(260) value "idxfile.dat".
           01 ex-index-name	               pic x(100).

    These variables define the data file name and the separate indexed file (if the data file format uses one). Later, when setting up the FCD, you will set fcd-filename-address to the address of ex-filename, and fcd-idxname-adress to the address of ex-index-name.

    Note: This tutorial uses an IDXFORMAT8 file, which does not use a separate index file (.idx file); therefore, the ex-index-name variable is not necessary in the running of this tutorial, but is included to demonstrate its use if you were to use a data file that required a separate index file (for example, IDXFORMAT12).
  2. Press Ctrl+S to save the changes so far.

As you are going to be creating an indexed file, you also need to define a key definition block, which defines the index keys used in file operations on indexed files.