HELPLIB.HLB  —  RDML72  Statements  BETWEEN  Examples
    The following programs demonstrate the use of the BETWEEN
    conditional expression with a numeric field. These programs form
    a record stream consisting of all the records in the relation
    CURRENT_SALARY where the field SALARY_AMOUNT contains a value
    greater than or equal to 10,000, and less than or equal to
    20,000. These programs print the last name and salary from of
    each record in the record stream.

1  –  C Example

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

    main()
    {
    READY PERS;
    START_TRANSACTION READ_WRITE;

    FOR CS IN CURRENT_SALARY
       WITH CS.SALARY_AMOUNT
       BETWEEN 10000.00 AND 20000.00
          printf ("%s %f\n", CS.LAST_NAME, CS.SALARY_AMOUNT);
    END_FOR;

    COMMIT;
    FINISH;
    }

2  –  Pascal Example

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

    begin
    READY PERS;
    START_TRANSACTION READ_ONLY;

    FOR CS IN CURRENT_SALARY
       WITH CS.SALARY_AMOUNT
       BETWEEN 10000.00 AND 20000.00
          writeln (CS.LAST_NAME, CS.SALARY_AMOUNT :10:2);
    END_FOR;

    COMMIT;
    FINISH;
    end.
Close Help