REPEAT statementblock UNTIL|WHILE condition [ statementblock ]
REPEAT VARYING|LINKING indexname|identifier1 ... [FROM indexexpression]|[arithmeticexpression] ... [BY literal]|[identifier2] statementblock UNTIL|WHILE condition [ statementblock ]
REPEAT VARYING indexname|identifier1 ... [FROM indexexpression][arithmeticexpression1] ... [BY literal]|[identifier2] ... [DOWN] TO|THRU arithmeticexpression2 [ statementblock ]
REPEAT LINKING indexname|identifier1 ... [FROM indexexpression][arithmeticexpression1] ... BY identifier2 ... [DOWN] TO arithmeticexpression2 [ statementblock ]
REPEAT VARYING|LINKING clause1 . . . [... VARYING|LINKING clauseN] [ statementblock ] UNTIL|WHILE condition [ statementblock ]
REPEATstatementblock
UNTIL condition
statementblock3
REPEATstatementblock
UNTIL conditionstatementblock statementblock3
UNTIL indexname identifier1 < arithmeticexpression2
arithmetic-expression |
A legal arithmetic relation-condition |
indexexpression |
Format can be literalidentifier +|- literalindexname |
identifier2 |
Names a table entry, such as a data name with an OCCURS clause |
002010 NTRY 002020 LINE-SUB = 1 002030 PRINT-TABLE = SPACES 002040 OPEN INPUT INPUT-FILE 002050 ... OUTPUT PRINT-FILE 002060 002070 /* BEGIN FIRST LOOP 002080 REPEAT 002090 READ INPUT-FILE 002100 UNTIL AT END ON INPUT-FILE 002110 IF REC-TYPE = 'HDR' 002120 WORK-FIELD = INPUT-DATA 002130 IF WORK-FIELD NOT = SPACES 002140 COLUMN-SUB = 0 002150 /* BEGIN SECOND LOOP 002160 REPEAT 002170 COLUMN-SUB = COLUMN-SUB + 1 002180 PRINT-COL (LINE-SUB, COLUMN-SUB) = 002190 ... WORK-FIELD-CHAR (COLUMN-SUB) 002200 UNTIL COLUMN-SUB = COLUMN-SUB-LIMIT 002210 ... OR WORK-FIELD-CHAR (COLUMN-SUB) = 002211 ... '/' 002220 /* END OF SECOND LOOP 002230 LINE-SUB = LINE-SUB + 1 002240 /* END OF FIRST LOOP 002250 002260 PERFORM WRITE-PRINT-TABLE 002270 CLOSE INPUT-FILE PRINT-FILE 002280 002290 PARA WRITE-PRINT-TABLE 002300 LINE-SUB = 1 002310 WHILE PRINT-LINE (LINE-SUB) NOT = SPACES 002320 ... AND LINE-SUB NOT > LINE-SUB-LIMIT 002330 WRITE PRINT-REC FROM PRINT-LINE (LINE-SUB) 002340 LINE-SUB = LINE-SUB + 1
IF WORK-FIELD NOT = SPACES REPEAT VARYING COLUMN-SUB FROM 1 BY 1 PRINT-COL (LINE-SUB, COLUMN-SUB) = ... WORK-FIELD-CHAR (COLUMN-SUB) UNTIL COLUMN-SUB = COLUMN-SUB-LIMIT ... OR WORK-FIELD-CHAR (COLUMN-SUB) = '/' LINE-SUB = LINE-SUB + 1
REPEAT VARYING ROW-SUB FROM 1 BY 1 ... VARYING COLUMN-SUB FROM 5 DOWN THRU 1 X-FIELD (ROW-SUB) = ... TABLE-ELEMENT (ROW-SUB, COLUMN-SUB)
. 01 BLOCK-STRUCTURE. 02 BLOCK OCCURS 250 TIMES. 03 BLOCK-LINK PIC S9(9) COMP SYNC. 03 BLOCK-DATA PIC X(20). . NTRY REPEAT LINKING II FROM MY-CHAIN ... BY BLOCK-LINK TO ZERO PERFORM PASS-DATA( BLOCK-DATA (II)) . PARA PASS-DATA(+PASS-DATA-BLOCK) .
MOVE MY-CHAIN TO II. GO TO G--002. G--001. MOVE BLOCK-LINK (II) TO II. G--002. IF II NOT = ZERO MOVE BLOCK-DATA (II) TO PASS-DATA-BLOCK PERFORM PASS-DATA THRU PASS-DATA--XIT GO TO G--001.
AMB uses SET in the generated code if the subscript is an index; otherwise, AMB uses MOVE as shown above.