C Copyright © Oracle Corporation 1995. All Rights Reserved. SUBROUTINE mod_resume C---------------------------------------------- C This subroutine demonstrates how to modify 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 RESUMES C record he or she wants to modify. C--------------------------------------------------- 100 TYPE 110 110 FORMAT ('$',' Please enter the ID of the 1Employee or type exit: ') ACCEPT 120, employee_id 120 FORMAT (A) C---------------------------------------------------- C Prompt user for the file name of the resume which C will replace the old resume. C---------------------------------------------------- DO WHILE ((employee_id .NE. 'EXIT ') .AND. (employee_id .NE. 'exit ')) PRINT *, ' ' TYPE 1000 1000 FORMAT (' To modify a resume, you must 1supply a new resume') TYPE 1005 1005 FORMAT (' to replace the old resume') 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 new segmented string that will hold C the value of the new resume. 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 Modify the old resume by supplying the segmented C string handle from the CREATE_SEGMENTED_STRING C statement as the object of the segmented string C assignment statement. C----------------------------------------------------- &RDB& FOR R IN RESUMES WITH &RDB& R.EMPLOYEE_ID = employee_id &RDB& MODIFY R USING &RDB& R.RESUME = resume_handle; &RDB& END_MODIFY &RDB& END_FOR &RDB& COMMIT PRINT *, ' ' TYPE 110 ACCEPT 120, employee_id END DO RETURN END