Skip to content

Commit 9855138

Browse files
authored
Merge branch 'master' into add-table-handling-with-labs
2 parents c85e072 + 0658cae commit 9855138

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
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
@@ -3518,24 +3518,58 @@ A PERFORM with UNTIL phrase is a conditional expression. In the UNTIL phrase fo
35183518

35193519

35203520
```
3521-
PERFORM SAY-SOMETHING-DIFFERENT BY FACIAL-EXP UNTIL 'HAPPY'
3521+
WORKING-STORAGE.
3522+
01 FACIAL-EXP PIC X(11) VALUE SPACES.
3523+
88 HAPPY VALUE 'HAPPY'.
3524+
....
3525+
....
3526+
PROCEDURE DIVISION.
3527+
....
3528+
....
3529+
PERFORM SAY-SOMETHING-DIFFERENT UNTIL HAPPY
35223530
END-PERFORM.
35233531
```
35243532

3525-
*Example 5. PERFORM statement*
3533+
*Example 5. PERFORM statement with 88-level conditional name*
3534+
3535+
3536+
It is also possible to use PERFORM statement without the use of a 88-level conditional name, observe Example 6.
3537+
3538+
```
3539+
WORKING-STORAGE.
3540+
01 FACIAL-EXP PIC X(11) VALUE SPACES.
3541+
....
3542+
....
3543+
PROCEDURE DIVISION.
3544+
....
3545+
....
3546+
PERFORM SAY-SOMETHING-DIFFERENT UNTIL FACIAL-EXP = "HAPPY"
3547+
END-PERFORM.
3548+
```
3549+
3550+
*Example 6. PERFORM statement without 88-level conditional name*
35263551

35273552

35283553
### SEARCH statements
35293554

3530-
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.
3555+
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.
35313556

35323557

35333558
```
3559+
WORKING-STORAGE.
3560+
01 FACIAL-EXP-TABLE REDEFINES FACIAL-EXP-LIST.
3561+
05 FACIAL-EXP PIC X(11) OCCURS n TIMES INDEXED BY INX-A.
3562+
88 HAPPY VALUE "HAPPY".
3563+
....
3564+
....
3565+
PROCEDURE DIVISION.
3566+
....
3567+
....
35343568
SEARCH FACIAL-EXP
3535-
WHEN 'HAPPY' STOP RUN
3569+
WHEN HAPPY(INX-A) DISPLAY 'I am glad you are happy'
35363570
END-SEARCH
35373571
```
3538-
*Example 6. SEARCH WHEN statement*
3572+
*Example 7. SEARCH WHEN statement*
35393573

35403574

35413575
## Conditions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ Note:
1919

2020
**data** folder
2121
- member **data** must be transferred binary to z/OS because the data contains EBCDIC and Packed Decimal
22-
- member **datax** is a viewable ASCII data but the packed decimal fields were translated to ASCII and are unreadable
22+
- member **xdata** is a viewable ASCII data but the packed decimal fields were translated to ASCII and are unreadable
2323

0 Bytes
Binary file not shown.
44 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)