Advance a stream pointer in an open stream in a COBOL program: CONTROL-PAR. PERFORM INIT THRU INIT-END. PERFORM LOOP UNTIL DONE = "Y". PERFORM GET-OUT. STOP RUN. INIT. &RDB& START_TRANSACTION READ_WRITE &RDB& START_STREAM WORKERS USING C IN CURRENT_INFO. INIT-END. EXIT. LOOP. &RDB& FETCH WORKERS &RDB& ON ERROR GO TO STREAM_ERROR &RDB& END_ERROR &RDB& AT END MOVE "Y" TO DONE GO TO GET-OUT &RDB& END_FETCH &RDB& GET &RDB& LAST = C.LAST; &RDB& DEPARTMENT = C.DEPARTMENT; &RDB& SALARY = C.SALARY &RDB& END_GET DISPLAY LAST, DEPARTMENT, SALARY. STREAM_ERROR. DISPLAY "Error in START_STREAM". STOP RUN. GET-OUT. &RDB& END_STREAM WORKERS &RDB& COMMIT &RDB& FINISH. This program fragment does the following: o Starts a stream and gives it the name WORKERS. The RSE specifies a set of records, in this case the whole CURRENT_ INFO view. o Uses COBOL statements to set up a loop and give the ending condition for the loop. o Uses FETCH and GET to retrieve one record on each pass through the loop and place three fields from that record into host language variables. o Uses AT END and ON ERROR to handle end-of-stream and error conditions. o Uses the COBOL DISPLAY statement to display the variables each time through the loop.