VMS Help  —  RDML72  Statements  STARTING_WITH, Examples
    The following programs demonstrate the use of the STARTING WITH
    clause. These programs create a record stream containing the
    records in the EMPLOYEES relation in which the field LAST_NAME
    has a name that begins with the string "IACO" or "Iaco". These
    programs print the employee ID and last name contained in each
    record 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 CROSS D1 IN DEGREES OVER EMPLOYEE_ID
       WITH (UNIQUE D2 IN DEGREES WITH D2.EMPLOYEE_ID = E.EMPLOYEE_ID)
       AND D1.DEGREE_FIELD = "Arts"
       AND D1.COLLEGE_CODE = "STAN"
          printf ("%s\n", E.EMPLOYEE_ID);
    END_FOR;

    COMMIT;
    FINISH;
    }

2  –  Pascal Example

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

    begin
    READY PERS;
    START_TRANSACTION READ_ONLY;

    FOR E IN EMPLOYEES CROSS D1 IN DEGREES OVER EMPLOYEE_ID
       WITH (UNIQUE D2 IN DEGREES WITH D2.EMPLOYEE_ID = E.EMPLOYEE_ID)
       AND D1.DEGREE_FIELD = 'Arts'
       AND D1.COLLEGE_CODE = 'STAN'
          writeln (E.EMPLOYEE_ID);
    END_FOR;

    COMMIT;
    FINISH;
    end.
Close Help