Skip to content

Commit c063d1f

Browse files
authored
Merge pull request #267 from openmainframeproject/tanto259-patch-varyafter
Fix PERFORM VARYING AFTER example
2 parents 91b07fb + 0d7571d commit c063d1f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

COBOL Programming Course #1 - Getting Started/COBOL Programming Course #1 - Getting Started.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ do{
30503050
//move counter to msg-to-write
30513051
//write print-rec
30523052
}
3053-
While(counter != 10);
3053+
while(counter != 10);
30543054
```
30553055
*Example 16. Java while loop*
30563056

@@ -3066,24 +3066,22 @@ END-PERFORM.
30663066
```
30673067
*Example 17. Basic loop*
30683068

3069-
In this example, the variable counter is tested to see if it equals 11, as long as it doesn't then it is incremented, and the sentences nested within the perform statement are executed. This construct can be extended, exemplified in Example 18.
3069+
In this example, the variable counter is tested to see if it equals 11, as long as it doesn't then it is incremented, and the statements nested within the perform statement are executed. This construct can be extended, exemplified in Example 18. However, in this example, we can only execute paragraphs instead of nested statements.
30703070

30713071

30723072
```
3073-
PERFORM VARYING COUNTER FROM 01 BY 1 UNTIL COUNTER EQUAL 11
3074-
AFTER COUNTER-2 FROM 01 BY 1 UNTIL COUNTER-2 EQUAL 5
3075-
...
3076-
END-PERFORM.
3073+
PERFORM 1000-PARAGRAPH-A
3074+
VARYING COUNTER FROM 01 BY 1 UNTIL COUNTER EQUAL 11
3075+
AFTER COUNTER-2 FROM 01 BY 1 UNTIL COUNTER-2 EQUAL 5.
30773076
```
30783077
*Example 18. Extended loop*
30793078

30803079
This may seem complex, but compare it to this Java pseudo-code:
30813080

30823081
```
30833082
for(int counter = 0; counter < 11; counter++){
3084-
for(int counter2 = 0; counter2 < 5; counter2++{
3085-
//move counter to msg-to-write
3086-
//write print-rec
3083+
for(int counter2 = 0; counter2 < 5; counter2++){
3084+
paragraphA();
30873085
}
30883086
}
30893087
```

0 commit comments

Comments
 (0)