Microsoft KB Archive/44411

How to Use OCCURS Clause (Subscripting) in SCREEN SECTION

PSS ID Number: Q44411 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: Microsoft COBOL Versions 3.0 and 3.0a allow you to use the OCCURS clause on a SCREEN SECTION data item to easily display subscripted data items (which are also known as tables, or arrays).

Code Example: The following code example demonstrates how to ACCEPT and DISPLAY a table with six occurrences using the OCCURS clause in the SCREEN SECTION: $SET ANS85 WORKING-STORAGE SECTION. 01 ray-val. 04 t-1 PIC 9(7) VALUE 10000. 04 t-2 PIC 9(7) VALUE 20000. 04 t-3 PIC 9(7) VALUE 30000. 04 t-4 PIC 9(7) VALUE 40000. 04 t-5 PIC 9(7) VALUE 50000. 04 t-6 PIC 9(7) VALUE 60000. 01 array REDEFINES ray-val. 02 ray-list OCCURS 6 TIMES. 04 a1 PIC 9(7). SCREEN SECTION. 01 screen-stuff. 02 BLANK SCREEN. 02 LINE 5 COLUMN 5 VALUE “This is a list”. 02 screen-line OCCURS 6 TIMES. 04 LINE PLUS 1 COLUMN 10 PIC Z(7) USING a1. PROCEDURE DIVISION. Main-line. DISPLAY screen-stuff. ACCEPT screen-stuff. STOP RUN.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.