The specific code that is written in Pacbase can contain DO and CO loops. These loops cannot be inserted like the other condition types (DW and IT for example) with the Rational® Programming Patterns subfunction creation wizard. However, they are migrated and you must know how to maintain them.
This loop can be indicated in a subfunction only. It runs a processing between two bounds according to a positive or negative step. The bounds are required whereas the step is optional. An index represents the subfunction code in the work areas.
A SF LIN OPE OPERANDS LVTY CONDITION
BD N COMPATIBILITY VERIFICATION 15DO 1 ITA00M
BD 100 M ZERO T-TA00-00540 (J48BDR)
When the Program that includes this DO subfunction is generated and migrated to Rational Programming Patterns, the following lines are displayed in the COBOL editor:
*N48BD. NOTE *COMPATIBILITY VERIFICATION *.DO
F48BD.
MOVE 1 TO J48BDR
GO TO F48BD-B.
F48BD-A.
ADD 1 TO J48BDR.
F48BD-B.
IF J48BDR > ITA00M
GO TO F48BD-FN.
MOVE ZERO TO T-TA00-00540 (J48BDR).
F48BD-900. GO TO F48BD-A.
F48BD-FN. EXIT.
05 J48BDR PICTURE S9(4) VALUE ZERO.
MOVE 1 TO J48BDR
In
this example, 1 is the starting bound. IF J48BDR > ITA00M
In
this example, ITA00M is the ending bound. ADD 1 TO J48BDR.
In
this example, 1 is the step. It is preceded by ADD because
it has a positive value. 01 INDICES COMPUTATIONAL SYNC.
You can complete these actions with the find and replace wizard. You find the old subfunction and replace it with the new code.
You can copy and paste an existing DO subfunction. However, to indicate that a processing must be run in a repetitive way, you are advised to insert the Loop insertion snippet. This snippet is available from the Snippets view, in the RPP Snippets category. This snippet inserts a PERFORM COBOL statement.
A SF LIN OPE OPERANDS LVTY CONDITION
BB N TEST ON TOWN CODE 10CO $1-COVIL
- -- --- --- ----------------------------- ---- ---------
CB N 75001 CASE 15IT "75001"
CB 100 M "PARIS 01" $1-LIVIL
F26BB
000 *N26BB. NOTE *TEST ON TOWN CODE *.
*LV=10
010 *!CO "$1-COVIL"
F26CB
000 *N26CB. NOTE *75001 CASE *.
*IT LV15
"75001"
100 MOVE "PARIS 01" TO $1-LIVIL
*N26BB. NOTE *TEST ON TOWN CODE *.
*F26BB. EXIT.
*N26CB. NOTE *75001 CASE *.IT
F26CB. IF WW00-COVIL =
"75001"
NEXT SENTENCE ELSE GO TO F26CB-FN
MOVE "PARIS 01" TO WW00-LIVIL.
F26CB-900. GO TO F26BB-FN.
F26CB-FN. EXIT.
*N26BB. NOTE *TEST ON TOWN CODE *.
*F26BB. EXIT.
*N26CB. NOTE *75001 CASE *.IT
F26CB. IF WW01-COVIL =
"75001"
NEXT SENTENCE ELSE GO TO F26CB-FN
MOVE "PARIS 01" TO WW01-LIVIL.
F26CB-900. GO TO F26BB-FN.
F26CB-FN. EXIT.
*N26CE. NOTE *TEST ON SPECIFIC CODE *.IT
F26CE.
IF WW00-COVIL =
"75004"
NEXT SENTENCE ELSE GO TO F26CE-FN
MOVE "PARIS 04" TO WW00-LIVIL
F26CE-FN. EXIT.