In an RDBPRE program (BASIC, COBOL, FORTRAN), you can use
GET...RDB$DB_KEY to retrieve the database key of the record
about to be stored by the STORE statement into a host language
variable. Example:
&RDB& STORE E IN EMPLOYEES USING E.EMPLOYEE_ID = 15231;
&RDB& E.LAST_NAME = "Smith";
&RDB& GET MY_DB_KEY = E.RDB$DB_KEY;
&RDB& END_GET
&RDB& END_STORE
(MY_DB_KEY is a user-defined host language variable.)
(The optional GET...RDB$DB_KEY is available only in programs
preprocessed by the RDBPRE preprocessor. The optional
PRINT...RDB$DB_KEY can be used in RDO only.)