ILE COBOL considerations for DDM
ILE COBOL programs can refer to DDM files. Generally, DDM file names can be specified in ILE COBOL programming language anywhere a database file name can be specified, for both iSeries™ and non-iSeries target servers.
- DDM file names can be specified on the Create COBOL Program (CRTCBLPGM) command:
- To access remote files containing source statements, on an iSeries server or a non-iSeries server, a DDM file name can be specified on the SRCFILE parameter, and a member name can be specified on the SRCMBR parameter.
- For iSeries or System/38™ target servers, a remote iSeries or System/38 source file (and, optionally, member) can be accessed in the same manner as a local source file and member.
- For non-iSeries target servers, a remote source file can be accessed if both the PGM and SRCMBR parameter defaults are used on the CRTCBLPGM command. Or, if a member name is specified, it must be the same as the DDM file name specified on the SRCFILE parameter.
- To place the compiler listing in a database file on a target server, a DDM file name can be specified on the PRTFILE parameter of the CRTCBLPGM command.
- DDM file names can be specified as the input and output files for the ILE COBOL SORT and MERGE operation. (The work file for this operation cannot be a DDM file.)
- A DDM file can be used in the ILE COBOL COPY statement when the DDS option on that statement is used to copy one or all of the externally described record formats from the remote file referred to by the DDM file into the program being compiled. If this is done when the remote file is not on an iSeries server or a System/38, the field declares for the record descriptions will not have meaningful names. Instead, all of the field names are declared as Fnnnnn and the key fields are declared as Knnnnn.
A recommended method for describing remote files, when the target is not an iSeries server or a System/38, is to have the data description specifications (DDS) on the local server and enter a Create Physical File (CRTPF) command or a Create Logical File (CRTLF) command on the local server. Compile the program using the local file name. Ensure that the remote server's file has the corresponding field types and field lengths.
To access the remote file, use the Override with Database File (OVRDBF) command preceding the program, for example:
OVRDBF FILE(PGMFIL) TOFILE(DDMFIL) LVLCHK(*NO)
- DDM file names can be specified on a COPY statement:
- If you do not specify the library name with the file name, the first file found with that file name in the user's library list is used as the include file.
- If the target server is not an iSeries server or a System/38, a DDM file name can be specified as the include file on a COPY statement, but the member name must be the same as the DDM file name.
- If the target server is a System/36™, ILE COBOL programming language cannot be used to open a DDM file for output if the associated remote file has logical files built over it. For System/36 files with logical files, the open operation (open output) will fail because ILE COBOL programming language attempts to clear the file before using it.
When an ILE COBOL program opens a DDM file on the source server, the following statements can be used to perform I/O operations on the remote file at the target server, for both iSeries and non-iSeries targets: CLOSE, DELETE, OPEN, READ, REWRITE, START, and WRITE.
- Direct file support with ILE COBOL
An iSeries server does not support direct files as one of its file types. However, an ILE COBOL program on iSeries server can specify that a file be accessed as a direct file.
Parent topic:
Programming language considerations for DDM