C Copyright © Oracle Corporation 1995. All Rights Reserved. SUBROUTINE seniority C------------------------------------------------------- C This subroutine lists employees in order of seniority. C------------------------------------------------------- IMPLICIT NONE INTEGER*4 salary_start(2),SYS$ASCTIM CHARACTER last_name*14,first_name*10,ascii_date*23,confirm &RDB& DATABASE EXTERNAL pers = FILENAME 'MF_PERSONNEL' &RDB& DBKEY SCOPE IS FINISH WRITE (6,90) 90 FORMAT ('1',T25,'**** SENIORITY ****'///) &RDB& START_TRANSACTION READ_ONLY C----------------------------------------------------------------- C Create a stream of records by crossing the EMPLOYEES C relation with a stream of records in the SALARY_HISTORY relation C that have the value for the SALARY_END field flagged as C missing. The assumption is that if the SALARY_END C field is missing, this record is the current record. C Sort the records in ascending order of the salary start C date. C----------------------------------------------------------------- &RDB& FOR SH IN SALARY_HISTORY CROSS &RDB& E IN EMPLOYEES OVER EMPLOYEE_ID &RDB& WITH SH.SALARY_END MISSING &RDB& SORTED BY SH.SALARY_START &RDB& GET &RDB& first_name = E.FIRST_NAME; &RDB& last_name = E.LAST_NAME; &RDB& salary_start = SH.SALARY_START; &RDB& END_GET C--------------------------------------------------- C Display the retrieved records; use SYS$ASCTIM to C convert the date, which is stored in binary format C to ASCII format. C---------------------------------------------------- CALL SYS$ASCTIM (, ascii_date, salary_start, ) TYPE 100,first_name,last_name,ascii_date 100 FORMAT('/',A,' ',A,' Started work on: ',A/) &RDB& END_FOR PRINT *, ' ' TYPE 300 300 FORMAT ('$',' Press RETURN to continue') ACCEPT 400, confirm 400 FORMAT (A) RETURN END