BASIC considerations for DDM
Compiled BASIC programs and interpretive BASIC statements can refer to DDM files. In addition, DDM file names can be specified on the Create BASIC Program (CRTBASPGM), Start BASIC (STRBAS), and Execute BASIC Procedure (EXCBASPRC) commands.
- A DDM file name can be specified on the SRCFILE parameter, and a member name can be specified on the SRCMBR parameter of the CRTBASPGM, STRBAS, and EXCBASPRC commands, but only if the remote source file (and member) is on an iSeries™ server or a System/38™. If one of these commands refers to remote files on non-iSeries or non-System/38 target servers, the operation fails.
- A DDM file can be used as the source file for the following BASIC commands in the BASIC session: FREE, LOAD, MERGE, PROC, REPLACE, SAVE, SRCFILE, and SUBPROC. It can also be used in the CHAIN BASIC statement.
- A DDM file name can be specified in the DECLARE FILE statement. The remote file that the DDM file refers to is used to bring in the field definitions for an externally described file. If this is done and 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)
- A DDM file can be specified as the file used in the LISTFMT and LISTFMTP BASIC commands. These commands extract the file descriptions of the referred to remote file to list any fields used in the program.
When BASIC is used to open 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, INPUT, LINPUT, OPEN, READ, REREAD, RESTORE, REWRITE, and WRITE statements for processing record files, and GET and PUT statements for processing remote stream files.
Parent topic:
Programming language considerations for DDM