ILE COBOL Programmer's Guide


Defining Program-Described Files

Records and fields for a program-described file are described by coding record descriptions directly in the FILE SECTION of the ILE COBOL program instead of using the Format 2 COPY statement.

The file must exist on the system before the program can run. The only exception is when you use dynamic file creation, by specifying OPTION(*CRTF) on the CRTCBLMOD/CRTBNDCBL command. For more information, refer to the description of the OPTION parameter in Parameters of the CRTCBLMOD Command.

To create a file, use one of the Create File commands. DDS can be used with the Create File commands. For an ILE COBOL indexed file, a keyed access path must be created. Specify a key in DDS when the file is created. The record key in the ILE COBOL program must match the key defined when the file was created. If these key values do not match, the file operation may still proceed, but with the wrong record key being passed to the system. If the wrong record key happens to contain an apparently correct key value, the input/output operation will be performed successfully, but on the wrong data. Thus, the integrity of your data may be compromised. To prevent this problem from happening, you should use externally described files whenever possible.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]