The following programs: o Create a record stream, CURRENT_INF_STREAM, consisting of the CURRENT_INFO record sorted by highest salary first o Fetch the first record, thereby fetching the CURRENT_INFO record with the highest salary o Display a message about that record
1 – C Example
#include <stdio.h> DATABASE PERS = FILENAME "PERSONNEL"; main() { READY PERS; START_TRANSACTION READ_ONLY; START_STREAM CURRENT_INF_STREAM USING CI IN CURRENT_INFO SORTED BY DESC CI.SALARY; FETCH CURRENT_INF_STREAM; printf ("%s makes the largest salary!\n", CI.LAST_NAME); END_STREAM CURRENT_INF_STREAM; COMMIT; FINISH; }
2 – Pascal Example
program record_stream (input,output); DATABASE PERS = FILENAME 'PERSONNEL'; begin READY PERS; START_TRANSACTION READ_ONLY; START_STREAM CURRENT_INF_STREAM USING CI IN CURRENT_INFO SORTED BY DESC CI.SALARY; FETCH CURRENT_INF_STREAM; writeln (CI.LAST_NAME, ' makes the largest salary!'); END_STREAM CURRENT_INF_STREAM; COMMIT; FINISH; end.