Library /sys$common/syshlp/HELPLIB.HLB  —  RDML72  Statements  ANY  Examples
    The following programs demonstrate the use of the ANY conditional
    expression. These programs create a record stream containing
    all the records from the SALARY_HISTORY relation that hold a
    value greater than fifty thousand in the field SALARY_AMOUNT.
    These programs then print an informational message if one or more
    records are found that meet the above condition. Note that the
    host language print statements do not have access to the context
    created in the if statement.

1  –  C Example

    #include <stdio.h>

    DATABASE PERS = FILENAME "PERSONNEL";

    int who;

    main()
    {
    READY PERS;
    START_TRANSACTION READ_ONLY;

    GET
     who = ANY SH IN SALARY_HISTORY WITH SH.SALARY_AMOUNT > 50000.00;
    END_GET;

    COMMIT;

    if (who)
        printf ("Someone is not underpaid \n");

    FINISH;
    }

2  –  Pascal Example

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

    who : boolean;

    begin
    READY PERS;
    START_TRANSACTION READ_WRITE;

    GET
     who = ANY SH IN SALARY_HISTORY WITH SH.SALARY_AMOUNT > 50000.00
    END_GET;

    COMMIT;

    if (who) then
       writeln ('Someone is not underpaid.');

    FINISH;
    end.
Close Help