Library /sys$common/syshlp/HELPLIB.HLB  —  RDML72  Statements  Declared START STREAM
    Starts a stream that has been declared earlier in the module with
    a DECLARE_STREAM statement. A declared START_STREAM statement
    allows you to place the elements of the START_STREAM statement in
    any order within the program as long as they are executed in the
    order: START_STREAM, FETCH, END_STREAM.

1  –  Examples

    The following programs demonstrate the use of the declared
    START_STREAM statement to open a stream declared with the
    DECLARE_STREAM statement.

1.1  –  C Example

    #include <stdio.h>
    #define TRUE 1
    #define FALSE 0

    DATABASE PERS = FILENAME "PERSONNEL";

    DECLARE_STREAM sal USING SH IN SALARY_HISTORY
         WITH SH.SALARY_AMOUNT LT 10000;

    int end_of_stream;

    main()
    {
    READY PERS;
    START_TRANSACTION READ_WRITE;

        START_STREAM sal;

        FETCH sal
         AT END
           end_of_stream = TRUE;
        END_FETCH;

        while (! end_of_stream)
           {
           MODIFY SH USING
             SH.SALARY_AMOUNT = SH.SALARY_AMOUNT * (1.5);
           END_MODIFY;

           FETCH sal
             AT END
               end_of_stream = TRUE;
           END_FETCH;
           }

        END_STREAM sal;

        COMMIT;
        FINISH;
    }

1.2  –  Pascal Example

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

    var
    end_of_stream : boolean;

    DECLARE_STREAM sal USING SH IN SALARY_HISTORY
         WITH SH.SALARY_AMOUNT LT 10000;

    begin
        READY PERS;
        START_TRANSACTION READ_WRITE;

        START_STREAM sal;

        FETCH sal
         AT END
           end_of_stream := TRUE;
        END_FETCH;

        while not end_of_stream do
         begin
           MODIFY SH USING
             SH.SALARY_AMOUNT := SH.SALARY_AMOUNT * (1.5);
           END_MODIFY;

           FETCH sal
             AT END
               end_of_stream := TRUE;
           END_FETCH;

         end;

        END_STREAM sal;
        COMMIT;
        FINISH;
    end.

2  –  Format

  (B)0
  START_STREAM qqqqqqqq> declared-stream-name qqqqqqk
               lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
               mqqqqqqwqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqq>
                      mq> on-error qqj

2.1  –  Format arguments

    declared-stream-name   The name you gave to the stream when you
                           issued the DECLARE_STREAM statement.

    on-error               The ON ERROR clause. Specifies host
                           language statements or Oracle Rdb statements,
                           or both, to be performed if an error
                           occurs during the START_STREAM operation.
Close Help