The following programs demonstrate the use of the MISSING and
NOT MISSING conditional expressions. These programs form a record
stream containing the records in the COLLEGES relation that have
nothing stored in the field STATE, but do have a college code
stored in the field COLLEGE_CODE. Each record in the COLLEGES
relation is tested for the above condition; if a record meets the
condition these programs print an informational message and the
college code of the newest record added to the record stream.
1 – C Example
#include <stdio.h>
DATABASE PERS = FILENAME "PERSONNEL";
main()
{
READY PERS;
START_TRANSACTION READ_WRITE;
FOR C IN COLLEGES
WITH C.STATE MISSING
AND C.COLLEGE_CODE NOT MISSING;
printf ("State Missing for COLLEGE: %s\n", C.COLLEGE_CODE);
END_FOR;
COMMIT;
FINISH;
}
2 – Pascal Example
program missing (input,output);
DATABASE PERS = FILENAME 'PERSONNEL';
begin
READY PERS;
START_TRANSACTION READ_WRITE;
FOR C IN COLLEGES
WITH C.STATE MISSING
AND C.COLLEGE_CODE NOT MISSING;
writeln ('State Missing for COLLEGE:', C.COLLEGE_CODE);
END_FOR;
COMMIT;
FINISH;
end.