Supported RPG Features

CHAIN can read a specific subfile record by relative record number (RRN), bypassing the READC changed-record iteration. This is useful when a program needs to access or update a specific record without iterating through all changed records.

// Read subfile record at RRN 2
CHAIN 2 SFLREC;
IF %FOUND(CUSTLIST);
  // CUSTNAME and CUSTNO now contain values from RRN 2
  CUSTNAME = 'Updated';
  UPDATE SFLREC;
ENDIF;

After a successful CHAIN, the record becomes the current record for UPDATE - the same as after a READC. %FOUND(filename) returns *ON when the record exists at the specified RRN, *OFF when it does not.

In fixed-format C-specs, the HI resulting indicator (columns 71-72) is set ON when the record is not found, matching the CHAIN indicator semantics for disk files.