The following programs demonstrate the use of the CONTAINING
conditional expression. These programs create a record stream
containing all the records in the EMPLOYEES relation in which
the LAST_NAME field contains the string "IACO" (in upper or lower
case letters). These programs print the employee ID and last name
from all the records contained in the record stream.
1 – C Example
#include <stdio.h>
DATABASE PERS = FILENAME "PERSONNEL";
main()
{
READY PERS;
START_TRANSACTION READ_ONLY;
FOR E IN EMPLOYEES
WITH E.LAST_NAME CONTAINING "IACO"
printf ("%s %s\n", E.EMPLOYEE_ID,
E.LAST_NAME);
END_FOR;
COMMIT;
FINISH;
}
2 – Pascal Example
program containing (input,output);
DATABASE PERS = FILENAME 'PERSONNEL';
begin
READY PERS;
START_TRANSACTION READ_ONLY;
FOR E IN EMPLOYEES
WITH E.LAST_NAME CONTAINING 'IACO'
writeln (E.EMPLOYEE_ID, ' ', E.LAST_NAME);
END_FOR;
COMMIT;
FINISH;
end.