Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, 言語解説書

タイプ 4

LOOP
無限の繰り返しを指定します。 FOREVER は、LOOP の同義語です。

以下に例を示します。

    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:;

このループから出るには、LEAVE または GO TO を使用するか、もしくはプロシージャーまたはプログラムを終了するしかありません。


Terms of use | Feedback

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