Example 1 The following COBOL example retrieves values from named fields in a relation: &RDB& START_TRANSACTION READ_WRITE &RDB& FOR E IN EMPLOYEES &RDB& GET &RDB& LAST-NAME = E.LAST_NAME; &RDB& FIRST-NAME = E.FIRST_NAME; &RDB& MIDDLE-INITIAL = E.MIDDLE_INITIAL &RDB& END_GET &RDB& END_FOR &RDB& COMMIT This code fragment retrieves field values from each record in the EMPLOYEES relation. It assumes that the program has declared the three host language variables, LAST-NAME, FIRST-NAME, and MIDDLE-INITIAL, with the appropriate data types. Example 2 The following set of statements performs a join of two relations and uses GET to retrieve a value from each: &RDB& START_TRANSACTION READ_WRITE &RDB& FOR JH IN JOB_HISTORY CROSS D IN DEPARTMENTS &RDB& OVER DEPARTMENT_CODE &RDB& WITH JH.JOB_END MISSING &RDB& GET &RDB& ID_NUMBER = JH.EMPLOYEE_ID; &RDB& DEPT-NAME = D.DEPARTMENT_NAME &RDB& END_GET &RDB& END_FOR &RDB& COMMIT Example 3 The following BASIC code fragment retrieves the result of a statistical function: INPUT "State: ", STATE &RDB& START_TRANSACTION READ_ONLY &RDB& GET &RDB& NUMBER-EMPLOYEES = COUNT OF E IN EMPLOYEES &RDB& WITH E.STATE = STATE &RDB& END_GET PRINT "Number of employees in "; & STATE; " is "; NUMBER-EMPLOYEES &RDB& COMMIT This statement retrieves the number of employees who live in the specified state and assigns that number to the variable NUMBER- EMPLOYEES. Example 4: The following RDBPRE program segment uses GET...RDB$DB_KEY within a STORE...END_STORE block to retrieve into a host language variable the database key of the record about to be stored by the STORE statement. &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.)