Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

Type 4

LOOP
Specifies infinite iteration. FOREVER is a synonym of LOOP.

For example:

    dcl Payroll file;
    dcl 1 Payrec,
         2 Type char,
         2 Subtype char,
         2 * char(100);
 
    Readfile:
      do loop;
 
        read file(Payroll) into(Payrec);
 
        If Payrec.type = 'E'
          then leave; /* like goto After_ReadFile */
 
        If Payrec.type = '1' then
          do;
               /* process first part of record */
 
            If Payrec.subtype = 'S'
              then iterate Readfile; /* like goto End_ReadFile */
 
               /* process remainder of record */
          end;
 
    End_ReadFile:
      end;
    After_ReadFile:;

The only way to exit this loop is by a LEAVE or GO TO, or by terminating a procedure or the program.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)