C Copyright © Oracle Corporation 1995. All Rights Reserved. SUBROUTINE display_resume C----------------------------------------------------- C This subroutine demonstrates how to retrieve a C field of data type SEGMENTED STRING. C----------------------------------------------------- IMPLICIT NONE LOGICAL employee_found INTEGER*4 segment_length CHARACTER employee_id*5,resume_segment*80 &RDB& DATABASE EXTERNAL pers = FILENAME 'MF_PERSONNEL' &RDB& DBKEY SCOPE IS FINISH WRITE (6,90) 90 FORMAT ('1',T25,'**** DISPLAY RESUME ****'///) C------------------------------------------------- C Prompt user to enter the ID of the employee C resume that he or she wants to view. If user C enters 'exit' then exit subroutine. C------------------------------------------------- TYPE 110 110 FORMAT ('$',' Please enter the ID of the 1 Employee or type exit: ') ACCEPT 120, employee_id 120 FORMAT (A) DO WHILE ((employee_id.NE.'EXIT ') .AND. (employee_id.NE.'exit ')) employee_found = .FALSE. &RDB& START_TRANSACTION READ_ONLY C---------------------------------------------------- C Start an outer FOR loop to retrieve the employee C record(s) with the specified ID. C----------------------------------------------------- &RDB& FOR R IN RESUMES WITH &RDB& R.EMPLOYEE_ID = employee_id employee_found = .TRUE. C------------------------------------------------------ C Start an inner FOR loop to retrieve the segments C of the segmented string that comprise the employees C resume. C------------------------------------------------------ &RDB& FOR RR IN R.RESUME &RDB& GET &RDB& resume_segment = RR.RDB$VALUE; &RDB& segment_length = RR.RDB$LENGTH; &RDB& END_GET C----------------------------------------------------- C Display each segment as it is retrieved from C the database. C----------------------------------------------------- TYPE 1000, resume_segment 1000 FORMAT (' ',A) &RDB& END_FOR &RDB& END_FOR &RDB& COMMIT C----------------------------------------------------- C If a record with the specified ID was not found C then inform the user. C----------------------------------------------------- IF (.NOT.(employee_found)) THEN TYPE 2000, employee_id 2000 FORMAT(' Employee ',A,' has no resume on file') END IF PRINT *, ' ' TYPE 110 ACCEPT 120, employee_id END DO RETURN END