The RPG operations to be handled

The operation to be performed by the handler is specified by the rpgOperation subfield.

Each operation has a description of the operation's meaning in terms of RPG operation codes, and the actions that the handler must perform to fulfill the operation.

The name of the constant that defines the operation is followed by the numeric value of the constant in parentheses. This numeric value is provided for debugging purposes only; handler providers should use the named constant within their code.

QrnOperation_CHAIN (9)

RPG operation Handler action
  • If the keyedFile subfield is '0', the operation is random retrieval from a file by relative record number.
  • Otherwise, the operation is random retrieval from a file by key.
  1. Locate the record specified by the search argument.
  2. If the record is available, provide the data and set the found subfield to '1'. Otherwise, set the found subfield to '0'.
  3. See Using search argumentsfor more information on using search arguments.
  4. See Handling input datafor more information on providing input data.
Remember: The input data for a subfile record contains both input and output fields. The handler must retain the values of the output fields when the record is written so that it can provide the values of the output fields for subsequent input operations.

QrnOperation_CLOSE (18)

RPG operation Handler action
Implicit or explicit close of the file. See When the Open-Access file is closed for information on when a file is closed by RPG. End the interaction with the resource or device.

QrnOperation_DELETE (16)

RPG operation Handler action
Delete record by relative record number or key Delete the record specified by the search argument. See Using search argumentsfor more information on using search arguments.
Note: See QrnOperation_DELETE_CURRENT for a similar operation with no search argument specified.

QrnOperation_DELETE_CURRENT (19)

RPG operation Handler action
Delete the current record Delete the most recently input record if it is locked, or set the status to a failing value if it is not locked.
Note: See QrnOperation_DELETE for a similar operation with a search argument specified.

QrnOperation_EXFMT (10)

RPG operation Handler action
Write and read a record format from a user-interface file
  1. Present the output data to the user including any subfile records associated with the record format
  2. Receive the input data from the user, including input data for any subfile records associated with the record format
  3. Provide the input data
  4. If there are any subfile records associated with the record format
  5. See Handling input datafor more information on providing input data.
  6. See Handling output datafor more information on using output data.

QrnOperation_FEOD (17)

RPG operation Handler action
Force end of data Set the end-of-file condition

QrnOperation_OPEN (1)

RPG operation Handler action
Implicit or explicit OPEN operation Initialize the interaction with the resource or device.

QrnOperation_POSITION_END (3)

RPG operation Handler action
SETLL *END Set the file cursor to the end of the file.

QrnOperation_POSITION_START (2)

RPG operation Handler action
SETLL *START Set the file cursor to the beginning of the file.

QrnOperation_READ (4)

RPG operation Handler action
  • Implicit or explicit sequential input operation for a database file or record format.
  • Implicit or explicit input operation for a user-interface file or record format.
  1. Move the file cursor forward to the next record.
  2. Provide input data or set the eof subfield to '1'.
  3. See Handling input datafor more information on providing input data.

QrnOperation_READC (5)

RPG operation Handler action
Read next changed subfile record
  1. Move the file cursor forward to the next changed record.
  2. Provide data or set the eof subfield to '1'.
  3. See Handling input datafor more information on providing input data.
Remember: The input data for a subfile record contains both input and output fields. The handler must retain the values of the output fields when the record is written so that it can provide the values of the output fields for subsequent input operations.

QrnOperation_READE (6)

RPG operation Handler action
Read the next record if its key is equal to the search argument
  1. Move the file cursor forward to the next record.
  2. Provide input data if the key of the record matches the search argument, or set the eof subfield to '1'.
  3. See Using search argumentsfor more information on using key data.
  4. See Handling input datafor more information on providing input data.
Note: See QrnOperation_READPE_CURRENT for a similar operation with no search argument specified.

QrnOperation_READE_CURRENT (20)

RPG operation Handler action
Read equal key, with no search argument specified
  1. Move the file cursor forward to the next record.
  2. Provide data if the record has the same key as the previously current record, or set the eof subfield to '1'.
  3. See Handling input datafor more information on providing input data.
Note: See QrnOperation_READE for a similar operation with a search argument specified.

QrnOperation_READP (7)

RPG operation Handler action
Sequential read previous operation
  1. Move the file cursor backward to the previous record.
  2. Provide input data or set the eof subfield to '1'.
  3. See Handling input datafor more information on providing input data.

QrnOperation_READPE (8)

RPG operation Handler action
Read the previous record if its key is equal to the search argument
  1. Move the file cursor backward to the previous record.
  2. Provide input data if the key of the record matches the search argument, or set the eof subfield to '1'.
  3. See Using search argumentsfor more information on using key data.
  4. See Handling input datafor more information on providing input data.
Note: See QrnOperation_READE_CURRENT for a similar operation with no search argument specified.

QrnOperation_READPE_CURRENT (21)

RPG operation Handler action
Read equal key previous, with no search argument specified
  1. Move the file cursor backward to the previous record.
  2. Provide data if the record has the same key as the previously current record, or set the eof subfield to '1'.
  3. See Handling input datafor more information on providing input data.
Note: See QrnOperation_READPE for a similar operation with a search argument specified.

QrnOperation_SETGT (11)

RPG operation Handler action
Set greater than
  1. Set the file cursor to the first record greater than the search argument.
  2. Set the found subfield to '1' if there is such a record.
  3. See Using search argumentsfor more information on using search arguments.

QrnOperation_SETLL (12)

RPG operation Handler action
Set lower limit
  1. Set the file cursor to the last record less than or equal to the search argument.
  2. Set the found subfield to '1' if there is such a record.
  3. Set the equal subfield to '1' if the record is an exact match for the search argument.
  4. See Using search argumentsfor more information on using search arguments.

QrnOperation_UNLOCK (13)

RPG operation Handler action
Unlock record Unlock the most recently input record if it is locked, or set the status to a failing value if it is not locked.

QrnOperation_UPDATE (14)

RPG operation Handler action
Update the current record Update the most recently input record if it is locked, or set the status to a failing value if it is not locked. See Handling output datafor more information on using output data.

QrnOperation_WRITE (15)

RPG operation Handler action
Write record
  • If the record is a subfile record, retain the output data so it can be returned as part of the data on a subsequent QrnOperation_READC or QrnOperation_CHAIN.
  • If the record is not a subfile record, output the data to the device or resource.
  • See Handling output datafor more information on using output data.