*---------*---------------*-----------------*----------------*---------------* | CODE | FACTOR 1 | FACTOR 2 | RESULT | INDICATORS | | | | | FIELD | | *---------*---------------*-----------------*----------------*---------------* | DOUXX | Comparand | Comparand | | | *---------*---------------*-----------------*----------------*---------------*
The DOUxx operation begins a group of operations you want to process more than once (but always at least once). An associated ENDDO statement marks the end of the group. For further information on DO groups and the meaning of xx, see Structured Programming Operations.
Factor 1 and factor 2 must contain a literal, a named constant, a field name, a table name, an array element, a figurative constant, or a data structure name. Factor 1 and factor 2 must be either both character or both numeric.
On the DOUxx statement, you indicate a relationship xx. To specify a more complex condition, immediately follow the DOUxx statement with ANDxx or ORxx statements. The operations in the DO group are processed once, and then the group is repeated while the relationship exists between factor 1 and factor 2 or the condition specified by a combined DOUxx, ANDxx, or ORxx operation exists. The group is always processed at least once even if the condition is not true at the start of the group.
In addition to the DOUxx operation itself, the conditioning indicators on the DOUxx and ENDDO statements control the DO group. The conditioning indicators on the DOUxx statement control whether or not the DOUxx operation begins. The conditioning indicators on the associated ENDDO statement can cause a DO loop to end prematurely.
The DOUxx operation follows these steps:
See LEAVE (Leave a Do Group) and ITER (Iterate) for information on how those operations affect a DOUxx operation.
See DOUxx Examples.
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C* The DOUEQ operation runs the operation within the DO group at C* least once. C FLDA DOUEQFLDB C* C* At the ENDDO operation, a test is processed to determine whether C* FLDA is equal to FLDB. If FLDA does not equal FLDB, the C* preceding operations are processed again. This loop continues C* processing until FLDA is equal to FLDB. When FLDA is equal to C* FLDB, the program branches to the operation immediately C* following the ENDDO operation. C SUB 1 FLDA C ENDDO C* C* The combined DOUEQ ANDEQ OREQ operation processes the operation C* within the DO group at least once. C FLDA DOUEQFLDB C FLDC ANDEQFLDD C FLDE OREQ 100
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C* At the ENDDO operation, a test is processed to determine whether C* the specified condition, FLDA equal to FLDB and FLDC equal to C* FLDD, exists. If the condition exists, the program branches to C* the operation immediately following the ENDDO operation. There C* is no need to test the OREQ condition, FLDE equal to 100, if the C* DOUEQ and ANDEQ conditions are met. If the specified condition C* does not exist, the OREQ condition is tested. If the OREQ C* condition is met, the program branches to the operation C* immediately following the ENDDO. Otherwise, the operations C* following the OREQ operation are processed and then the program C* processes the conditional tests starting at the second DOUEQ C* operation. If neither the DOUEQ and ANDEQ condition nor the C* OREQ condition is met, the operations following the OREQ C* operation are processed again. C SUB 1 FLDA C ADD 1 FLDC C ADD 5 FLDE C ENDDO
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.