The following examples demonstrate the use of the GET statement with a statistical function. The examples store the value of the statistical function in the host language variable maxi, then print this value.
1 – C Example
#include <stdio.h> DATABASE PERS = FILENAME "PERSONNEL"; DECLARE_VARIABLE maxi SAME AS PERS.CURRENT_INFO.SALARY; main() { READY PERS; START_TRANSACTION READ_ONLY; GET maxi = MAX CI.SALARY OF CI IN CURRENT_INFO; END_GET; printf ("%f",maxi); COMMIT; FINISH; }
2 – Pascal Example
program max_function (input,output); DATABASE PERS = FILENAME 'PERSONNEL'; DECLARE_VARIABLE maxi SAME AS PERS.CURRENT_INFO.SALARY; begin READY PERS; START_TRANSACTION READ_ONLY; GET maxi = MAX CI.SALARY OF CI IN CURRENT_INFO; END_GET; writeln (maxi:10:2); COMMIT; FINISH; end.