HELPLIB.HLB  —  RDML72  Statements  Rel Operators, Examples
    The following programs demonstrate the use of the LE (less than
    or equal to) operator in a FOR statement. The programs create a
    record stream of all those employees who have an employee ID less
    than or equal to 00400. The programs then print the employee IDs
    from the records in the record stream.

1  –  C Example

    #include <stdio.h>
    DATABASE PERS = FILENAME "PERSONNEL";

    main()
    {
    READY PERS;
    START_TRANSACTION READ_WRITE;

    FOR E IN EMPLOYEES WITH E.EMPLOYEE_ID LE "00400"
       printf ("%s\n", E.EMPLOYEE_ID);
    END_FOR;

    COMMIT;
    FINISH;
    }

2  –  Pascal Example

    program relation (input,output);
    DATABASE PERS = FILENAME 'PERSONNEL';

    begin
    READY PERS;
    START_TRANSACTION READ_ONLY;

    FOR E IN EMPLOYEES WITH E.EMPLOYEE_ID LE '00400'
       writeln (E.EMPLOYEE_ID);
    END_FOR;

    COMMIT;
    FINISH;
    end.
Close Help