Library /sys$common/syshlp/HELPLIB.HLB  —  RDML72  Statements  WITH
    Contains a conditional expression that lets you specify
    conditions that must be true for a record to be included in a
    record stream.

1  –  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.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;
    }

1.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.

2  –  Format

  (B)0with-clause =

    qqqqqq> WITH qqq> conditional-expr qqq>

2.1  –  Format arguments

    conditional-expr       Conditional expression. An expression
                           that evaluates to true or false. For more
                           information see the entry on Conditional
                           expressions.
Close Help