There are a number of mandatory and optional steps that you must perform to prepare your COBOL program, and then run it to
interface with an RDBMS. Some of these steps can be achieved a number of different ways, with some offering greater benefits
over others.
- The CREATEXFD directive
- This directive must be specified in order to create the .XFD file required to interface with an RDBMS.
- You would usually specify it within your source code or during compilation (either on the command line or within project properties).
It does not matter where you specify it as long as it is picked up during compilation.
- If you specify it without any further parameters, an XFD file is only created for each indexed file specified within your
source code. Specify FILE-TYPE=ALL within parentheses to create XFD files for all file organizations.
- By default, any XFD files are created in the current working folder, to specify another directory in which to place them,
specify XFD-DIRECTORY=pathname within parentheses to create XFD files in another directory.
- See
CREATEXFD XFD Directive for more information.
- Additional XFD directives
- These directives are optional, and are used if you want to override the default settings when creating or amending a table
in your RBDMS.
- These directives are always placed within a COBOL FD in your source code. They do not affect Procedure Division I/O statements,
and they do not change your COBOL fields in any way. Rather, they guide the building of the XFDs, giving you more control
over the way COBOL data maps to database fields.
- See
XFD Directives for more information.
- The IDXFORMAT directive or File Handler configuration option
- The IDXFORMAT option is mandatory, and tells the COBOL run-time system which RDBMS it is interfacing with when your program
executes a FILE I/O operation.
- You can set the directive directly into your source code, or during compilation (either on the command line or within project
properties), but if you specify the option within a File Handler configuration file, you can simply change the value at run
time, enabling you to use the same compiled code to interface with different types of RDBMSs.
- See
Configuring the File Handler for more information.
- Database configuration options
- Each supported RDBMS has a number of specific configuration options that you can set. Some are mandatory (such as specifying
the database to work with) and some are optional. There are also a number of general configuration options that can be applied
to any RDBMS.
- You specify these options within the
ACUFH configuration file, and then use the A_CONFIG environment variable to make the file available at run time.
- See
ACUFH Configuration File Variables for
RDBMS and ACUFH Configuration Variables for more information.