ILE RPG programs and automatic report programs can both refer to DDM
files. Generally, DDM file names can be specified in ILE RPG
programming language anywhere a database file name can be specified, for both
AS/400 and non-AS/400 target systems.
- DDM file names can be specified on the Create RPG Program (CRTRPGPGM) and
Create Auto Report Program (CRTRPTPGM) commands:
- To access remote files containing source statements, on an AS/400 system
or a non-AS/400 system, a DDM file name can be specified on the SRCFILE
parameter, and a member name can be specified on the SRCMBR parameter.
- For AS/400 or System/38 target systems, a remote AS/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-AS/400 target systems, a remote source file can be accessed if
both the PGM and SRCMBR parameter defaults are used on either command.
Or, if a member name is specified, it must be the same as the DDM file name
specified on the SRCFILE parameter. (The same is true for member names
specified either on the /COPY statement of the input specifications used to
create an automatic report program or as used by the compiler to include
source specifications.)
- 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 either command.
- A DDM file name and member name can be specified on the OUTFILE and OUTMBR
parameters of the CRTRPTPGM command, but before the output produced by the
command can be stored in the remote file referred to by the DDM file, the
remote file must already exist. Also, as with local files, the record
format of the remote file must match the required OUTFILE parameter
format. Generally, this means that the target system must be an AS/400
system or a System/38.
When an ILE RPG program opens a DDM file on the source system, the
following types of I/O operations can be performed on the remote file at the
target system, for both AS/400 and non-AS/400 targets: CHAIN, CLOSE,
DELET, EXCPT, FEOD, OPEN, READ, READE, READP, SETGT, SETLL, UPDAT, and
WRITE.
Other considerations are:
- If the DDM file is declared in the program to be externally described, the
ILE RPG compiler copies the external descriptions of the remote file referred
to into the program at compile time. However, if the remote file is not
on an AS/400 system or a System/38, the field declares for the record
descriptions do 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
AS/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)
- A DDM file is also valid as the file specified in the ILE RPG program that
will be used implicitly in the ILE RPG logic cycle.
- A record format name, if used, must match the DDM file name when the
target system is not an AS/400 system or a System/38.
- An ADDROUT file created on a System/36 cannot be used on an AS/400
system. AS/400 System/36-Compatible RPG II uses 3-byte ADDROUT files,
and ILE RPG programming language on an AS/400 system and System/38 uses 4-byte
ADDROUT files.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]