Library /sys$common/syshlp/HELPLIB.HLB  —  RDML72  Statements  WITH  Examples
    The following programs demonstrate the use of the WITH clause in
    a record selection expression. These programs:

    o  Create a record stream of all those records in the employee
       relation with an employee ID of "00169"

    o  Print the employee ID and last name from the records 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.EMPLOYEE_ID = "00169"
          printf ("%s  ", E.EMPLOYEE_ID);
          printf ("%s", E.LAST_NAME);
    END_FOR;

    COMMIT;
    FINISH;
    }

2  –  Pascal Example

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

    begin
    READY PERS;
    START_TRANSACTION READ_ONLY;

    FOR E IN EMPLOYEES
       WITH E.EMPLOYEE_ID = '00169'
          writeln (E.EMPLOYEE_ID, ' ', E.LAST_NAME);
    END_FOR;

    COMMIT;
    FINISH;
    end.
Close Help