Skip to content

Commit 60aa9bc

Browse files
authored
Merge branch 'master' into fix-137
2 parents b0d1905 + 2c95660 commit 60aa9bc

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

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

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,24 +3192,58 @@ 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
32033228

3204-
The SEARCH statement searches a table for an element that satisfies the specified condition and adjusts the associated index to indicate that element. Tables, effectively an array of values, are created with an OCCURS clause applied to WORK-STORAGE data-names. A WHEN clause is utilized in SEARCH statements to verify if the element searched for satisfies the specified condition. Assuming FACIAL-EXP has many possible values, then SEARCH WHEN is an alternative conditional expression, observe Example 6.
3229+
The SEARCH statement searches a table for an element that satisfies the specified condition and adjusts the associated index to indicate that element. Tables, effectively an array of values, are created with an OCCURS clause applied to WORK-STORAGE data-names. A WHEN clause is utilized in SEARCH statements to verify if the element searched for satisfies the specified condition. Assuming FACIAL-EXP has many possible values, then SEARCH WHEN is an alternative conditional expression, observe Example 7.
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)