Skip to content

Commit 7727cc8

Browse files
committed
Fix examples on Conditional Names
Signed-off-by: Hartanto Ario Widjaya <[email protected]>
1 parent 72977e3 commit 7727cc8

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

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

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,11 +3192,36 @@ A PERFORM with UNTIL phrase is a conditional expression. In the UNTIL phrase fo
31923192

31933193

31943194
```
3195-
PERFORM SAY-SOMETHING-DIFFERENT BY FACIAL-EXP UNTIL 'HAPPY'
3195+
WORKING-STORAGE.
3196+
01 FACIAL-EXP PIC X(11) VALUE SPACES.
3197+
88 HAPPY VALUE 'HAPPY'.
3198+
....
3199+
....
3200+
PROCEDURE DIVISION.
3201+
....
3202+
....
3203+
PERFORM SAY-SOMETHING-DIFFERENT UNTIL HAPPY
31963204
END-PERFORM.
31973205
```
31983206

3199-
*Example 5. PERFORM statement*
3207+
*Example 5. PERFORM statement with 88-level conditional name*
3208+
3209+
3210+
It is also possible to use PERFORM statement without the use of a 88-level conditional name, observe Example 6.
3211+
3212+
```
3213+
WORKING-STORAGE.
3214+
01 FACIAL-EXP PIC X(11) VALUE SPACES.
3215+
....
3216+
....
3217+
PROCEDURE DIVISION.
3218+
....
3219+
....
3220+
PERFORM SAY-SOMETHING-DIFFERENT UNTIL FACIAL-EXP = "HAPPY"
3221+
END-PERFORM.
3222+
```
3223+
3224+
*Example 6. PERFORM statement without 88-level conditional name*
32003225

32013226

32023227
### SEARCH statements
@@ -3205,11 +3230,20 @@ The SEARCH statement searches a table for an element that satisfies the specifie
32053230

32063231

32073232
```
3233+
WORKING-STORAGE.
3234+
01 FACIAL-EXP-TABLE REDEFINES FACIAL-EXP-LIST.
3235+
05 FACIAL-EXP PIC X(11) OCCURS n TIMES INDEXED BY INX-A.
3236+
88 HAPPY VALUE "HAPPY".
3237+
....
3238+
....
3239+
PROCEDURE DIVISION.
3240+
....
3241+
....
32083242
SEARCH FACIAL-EXP
3209-
WHEN 'HAPPY' STOP RUN
3243+
WHEN HAPPY(INX-A) DISPLAY 'I am glad you are happy'
32103244
END-SEARCH
32113245
```
3212-
*Example 6. SEARCH WHEN statement*
3246+
*Example 7. SEARCH WHEN statement*
32133247

32143248

32153249
## Conditions

0 commit comments

Comments
 (0)