Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

Example

The program in Figure 9 reads the data created by the program in Figure 8 and uses the data set SYSPRINT to display that data. The SYSPRINT data set is associated with the CON device, so if no dissociation is made prior to executing the program, the output is displayed on the screen. (For details on SYSPRINT, see Using SYSIN and SYSPRINT files.)

Figure 9. Accessing a data set with stream-oriented data transmission
 /********************************************************************/
 /*                                                                  */
 /*  DESCRIPTION                                                     */
 /*    Read a CONSECUTIVE data set and print the 30-byte records     */
 /*    to the screen.                                                */
 /*                                                                  */
 /*  USAGE                                                           */
 /*    The following  command is required to establish     */
 /*    the environment variable to run this program:                 */
 /*                                                                  */
 /*      SET DD:WORK=BDAY.OCT                                        */
 /*                                                                  */
 /*    Note: This sample program uses the CONSECUTIVE data set       */
 /*          created by the previous sample program BDAY.            */
 /*                                                                  */
 /********************************************************************/

 BDAY1: proc options(main);
 
   put skip list('BDAY1 TEST HAS STARTED');

   dcl Work file stream input;

   dcl Eof bit(1) init('0'b);

   dcl In char(30);

   on endfile(Work) Eof='1'b;

   open file(Work);
   get file(Work) edit(In)(a(30));
   do while (¬Eof);
    put file(sysprint) skip edit(In)(a);
    get file(Work) edit(In)(a(30));
   end;
   close file(Work);
   
   put skip list('BDAY1 TEST HAS ENDED');
   
 end BDAY1;
Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide