Declare ROWID variables in ILE RPG applications that use SQL

ILE RPG does not have a variable that corresponds to the SQL data type ROWID.

To create host variables that can be used with this data type, use the SQLTYPE keyword. The SQL precompiler replaces this declaration with an ILE RPG language declaration in the output source member. ROWID declarations can be either standalone or within a data structure.

ROWID example

The following declaration:

D MY_ROWID         S          SQLTYPE(ROWID)

results in the following generation:

D MYROWID          S          40A  VARYING
Notes:
  1. SQLTYPE, ROWID can be in mixed case.
  2. ROWID host variables are allowed to be declared in host structures.
  3. SQLTYPE must be between positions 44 and 80.
  4. When a ROWID is declared as a standalone host variable, position 24 must contain the character 'S' and position 25 must be blank.
  5. The standalone field indicator 'S' in position 24 should be omitted when a ROWID is declared in a host structure.
  6. ROWID host variables cannot be initialized.