The file operation codes are:
File operations can be used with both program described and externally described files (F or E respectively in position 19 of the file description specifications).
When an externally described file is used with certain file operations, a record format name, rather than a file name, can be specified in factor 2. Thus, the processing operation code retrieves and/or positions the file at a record format of the specified type according to the rules of the calculation operation code used.
When the OVRDBF command is used with the MBR (*ALL) parameter specified, the SETLL, SETGT and CHAIN operations only process the current file member. For more information, refer to the Programming: Data Base Guide.
The WRITE and UPDAT operations that specify a program described file name in factor 2 must have a data structure name specified in the result field. The CHAIN, READ, READE, READP, and REDPE operations that specify a program described file name in factor 2 may have a data structure name specified in the result field. With the CHAIN, READ, READE, READP, and REDPE operations, data is transferred directly between the file and the data structure, bypassing the normal field extract function. Thus, no record identifying or field indicators are set on as a result of an input operation to a data structure. If all input and output operations to the file have a data structure specified in the result field, input and output specifications are not required. However, the data structure must be defined on the input specifications. If an input operation (CHAIN, EXFMT, READ, READC, READE, READP, REDPE) does not retrieve a record because no record was found, because an error occurred in the operation, or because the last record was already retrieved (end of file), then no data is extracted and all fields in the program remain unchanged.
If you specify an N in position 53 of a CHAIN, READ, READE, READP, or REDPE operation for an update disk file, a record is read without locking. If no value is specified in position 53, the record is locked if the file is an update disk file.
Exception/errors that occur during file operations can be handled by the programmer (by coding an error indicator or specifying a file-error subroutine), or by the RPG/400 error handler.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.