C Copyright © Oracle Corporation 1995. All Rights Reserved. SUBROUTINE store_res C-------------------------------------------------------------- C This subroutine demonstrates how to store a record with a C field of data type SEGMENTED STRING. C-------------------------------------------------------------- IMPLICIT NONE LOGICAL end_of_file CHARACTER employee_id*5,resume_line*80,resume_file*30 &RDB& DATABASE EXTERNAL pers = FILENAME 'MF_PERSONNEL' &RDB& DBKEY SCOPE IS FINISH WRITE (6,90) 90 FORMAT ('1',T25,'**** MODIFY RESUME ****'///) C------------------------------------------------------- C Prompt user for the employee ID of the employee C that he or she wants to store. C------------------------------------------------------- 100 TYPE 110 110 FORMAT ('$',' Please enter the ID of the 1Employee or type exit: ') ACCEPT 120, employee_id 120 FORMAT (A) DO WHILE ((employee_id .NE. 'EXIT ') .AND. (employee_id .NE. 'exit ')) PRINT *, ' ' C---------------------------------------------------------- C Prompt user for the file name of the resume to be stored. C---------------------------------------------------------- TYPE 1006 1006 FORMAT ('$',' Please enter filename of new resume: ') ACCEPT 1010, resume_file 1010 FORMAT (A) &RDB& START_TRANSACTION READ_WRITE &RDB& RESERVING RESUMES FOR SHARED WRITE C--------------------------------------------------------- C Create a segmented string to hold the values from the C specified file. C--------------------------------------------------------- &RDB& CREATE_SEGMENTED_STRING resume_handle end_of_file = .FALSE. OPEN (UNIT=1, FILE=resume_file, STATUS='old') DO WHILE (.NOT.(end_of_file)) READ (1, 2000, END=3000) resume_line 2000 FORMAT (A80) &RDB& STORE R IN resume_handle USING &RDB& R.RDB$VALUE = resume_line &RDB& END_STORE END DO 3000 end_of_file = .TRUE. CLOSE (UNIT=1) &RDB& END_SEGMENTED_STRING resume_handle C----------------------------------------------------------------------- C Store the new record by supplying the segmented string handle from C the CREATE_SEGMENTED_STRING statement as the object of the segmented C string assignment statement. C----------------------------------------------------------------------- &RDB& STORE R IN RESUMES USING &RDB& R.EMPLOYEE_ID = employee_id; &RDB& R.RESUME = resume_handle; &RDB& END_STORE &RDB& COMMIT PRINT *, ' ' TYPE 110 ACCEPT 120, employee_id END DO RETURN END