HLL program input and output operations with i5/OS DDM

The high-level language operations are supported by DDM for keyed or nonkeyed operations.

See the information in the following tables.

Table 1. High-level language operations supported by DDM for keyed or nonkeyed operations
i5/OS™ database operation High-level languages
ILE RPG programming language ILE COBOL programming language   BASIC   PL/I
Open file OPEN OPEN OPEN OPEN
Query file        
Read (keyed access) CHAIN (key) READ INVALID KEY READ KEY READ EQUAL
Read first/last1 *LOVAL *HIVAL READ FIRST LAST READ FIRST LAST READ FIRST LAST
Read next READ READE2 READ <NEXT> AT END READ READ NEXT
Read previous READP READ PRIOR AT END READ PRIOR READ PRV
Read next or previous3 Next equal Previous equal Next unique Previous unique     READ = =, PRIOR READ NXTEQL PRVEQL NXTUNQ PRVUNQ
Read (relative to start)4 CHAIN (rrn) READ RELATIVE KEY READ REC= READ KEY
Release record lock EXCPT or next I/O op (next I/O op) (next I/O op) (next I/O op)
Force end of data FEOD      
Position file5 SETGT SETLL START KEY GREATER KEY NOT LESS KEY EQUAL RESTORE  
Update record UPDAT REWRITE6 REWRITE REWRITE
Write record WRITE/ EXCPT WRITE6 WRITE WRITE
Delete record DELET DELETE6 DELETE DELETE
Close file CLOSE CLOSE CLOSE CLOSE
         
1
For the ILE RPG language, if the keyed access path of a file specifies DESCENDING, then *LOVAL gets the last record in the file and *HIVAL gets the first record in the file.
2
For duplicate keyed files, the ILE RPG language performs a READ NEXT operation and compares the key of the returned record to determine if the record qualifies. If so, the record is returned to the program; if not, an end-of-file indication is returned.
3
If the remote file is on a non-iSeries™ server, these operations cannot be performed using DDM.
4
An iSeries application program can open a keyed access open data path to a file and then access its records using both keyed and relative record access methods. Although DDM supports the combined-access access method, a target server (such as System/36™) might not. In this case, the i5/OS can do relative record accessing of a keyed file on a non-iSeries target server if the target server supports the combined-by-record-number access method and if the DDM file specifies that method. The combined-by-record-number access method is specified on an iSeries server as ACCMTH(*ARRIVAL *BOTH) on the Create DDM File (CRTDDMF) command. If these values are not specified for the DDM file and the target server does not support the combined-access access method, relative record operations to a keyed file are rejected.
5
Positioning operations (SETxx in the ILE RPG language, or START in the ILE COBOL language) do not return the record data to the application program. These operations also cause the file to be opened for random processing.
6
ILE COBOL operations that change indexed or relative files can lock the record before the operation to make the record eligible.
Table 2. High-level language operations supported by DDM for keyed or nonkeyed operations
i5/OS database operation High-level languages
CL ILE C programming language
Open file OPNDBF FOPEN, FREOPEN
Query file OPNQRYF  
Read (keyed access)    
Read first/last    
Read next RCVF FREAD, FGETC
Read previous    
Read next or previous: Next equal Previous equal Next unique Previous unique    
Read (relative to start)    
Release record lock   (next I/O op)
Force end of data   FFLUSH
Position file POSDBF FSEEK, FSETPOS
Update record   FWRITE, FPUTC, FFLUSH
Write record   FWRITE, FPUTC, FFLUSH
Delete record    
Close file CLOF FCLOSE