DDM Programming Considerations
Generally, DDM file names can be specified in ILE COBOL anywhere a database
file can be specified, for both iSeries and non-iSeries target systems. This section
summarizes the ILE COBOL programming considerations for DDM files:
- DDM file names can be specified on the Create Bound COBOL Program (CRTBNDCBL),
Create COBOL Module (CRTCBLMOD), and Create COBOL Program (CRTCBLPGM) commands:
- To access remote files containing source statements, on an iSeries system
or a non-iSeries system, a DDM file name can be specified on the SRCFILE parameter,
and a member name can be specified on the SRCMBR parameter.
- For OS/400 or System/38 target systems, a remote OS/400 or System/38 source
file (and, optionally, member) can be accessed in the same manner as a local
source file and member.
- For non-OS/400 target systems, a remote source file can be accessed if
both the PGM and SRCMBR parameter defaults are used on the CRTBNDCBL or CRTCBLPGM
command. Or, if a member name is specified, it must be the same as the DDM
file name specified on the SRCFILE parameter. The CRTCBLMOD command follows
similar rules, except that the PGM and SRCMBR parameters are replaced with
the MODULE and SRCMBR parameters.
- To place the compiler listing in a database file on a target system, 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.
- 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 OS/400 system
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 OS/400 system or a System/38, is to have the data description specifications
(DDS) on the local system and enter a Create Physical File (CRTPF) command
or a Create Logical File (CRTLF) command on the local system. Compile the
program using the local file name. Ensure that the remote system'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 system is not an OS/400 system 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 system is a System/36, ILE COBOL 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 system, the following
statements can be used to perform I/O operations on the remote file at the
target system, for both OS/400 and non-OS/400 targets: CLOSE, DELETE, OPEN,
READ, REWRITE, START, and WRITE.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.