Previous Topic Next topic Print topic


Accessing the FCD

When file I/O operations are performed by your program, using ordinary COBOL syntax, a File Control Description (FCD) is created automatically for each file. You can access this automatically created FCD by compiling your program with the FCDREG Compiler directive. This enables you to read or change the FCD or to use it to make explicit calls to the File Handler.

To access the FCD, you must set up an FCD definition in the Linkage Section of your program. An example FCD definition is supplied in the copybook XFHFCD.CPY. This definition can be mapped onto the FCD you need to read or alter using the following SET statement in your program:

     set address of fcd to address of fh--fcd of file

where the parameters are:

Parameter Description
fcd The name of the FCD definition in the Linkage Section of your program
fh--fcd The FCD used by this COBOL system to access the file (note the double hyphen)
file The FD name of the file

Following this SET operation, you can access the file's FCD by accessing the data items in the FCD which you set up in your Linkage Section.

Similarly, you can access the key definition block as follows:

     set address of kdb to address of fh--keydef of file

where the parameters are:

Parameter Description
kdb The name of the key definition block in the Linkage Section of your program
fh--keydef The key definition used by this COBOL system to access the file (note the double hyphen)
file The FD name of the file
Previous Topic Next topic Print topic