Programming-Idioms

History of Idiom 78 > diff from v70 to v71

Edit summary for version 71 :
[Cobol] fix

Version 70

2019-09-27, 21:37:30

Version 71

2019-09-27, 21:38:02

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

Extra Keywords
until
Extra Keywords
until
Code
IDENTIFICATION DIVISION.
PROGRAM-ID. "do while" loop.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 boolean-c    PIC x.
   88 c-true    PIC x VALUE 't'.
   88 c-true    PIC x VALUE 'f'.
PROCEDURE DIVISION.
    PERFORM WITH TEST AFTER UNTIL c-false
       PERFORM somthing
    END-PERFORM   
STOP RUN.
Code
IDENTIFICATION DIVISION.
PROGRAM-ID. "do while" loop.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 boolean-c    PIC x.
   88 c-true    PIC x VALUE 't'.
   88 c-false   PIC x VALUE 'f'.
PROCEDURE DIVISION.
    PERFORM WITH TEST AFTER UNTIL c-false
       PERFORM somthing
    END-PERFORM   
STOP RUN.