Microsoft KB Archive/21087

Subscripts in the SCREEN SECTION

PSS ID Number: Q21087 Article last modified on 11-16-1992

2.00 2.10 3.00 3.00a 4.00 4.50 | 3.00 3.00a 4.00 4.50 MS-DOS | OS/2

Summary: In Versions 2.x of the Microsoft COBOL Compiler, explicit reference to table/array items is prohibited in the SCREEN SECTION, as discussed on Page 132 of the “Microsoft COBOL Compiler Reference” manual. However, MS COBOL Version 3.00, 3.00a, 4.00, and 4.50 support explicit reference to table/array items in the SCREEN SECTION, as in the following example: IDENTIFICATION DIVISION. PROGRAM-ID. ARRAYSCREENS.   Example: Using subscripts in the SCREEN SECTION * ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77 X PIC 9 VALUE 2. 77 MOV-VALUE PIC 9 VALUE 1. 01 TBLE. 05 TBL-ENT OCCURS 3 TIMES PIC 9. SCREEN SECTION. 01 ARRAY-SCREEN. 05 BLANK-SCREEN. 05 LINE 5 COLUMN 10 VALUE “THIS IS TABLE ITEM #2:”. 05 PIC 9 USING TBL-ENT(X). PROCEDURE DIVISION. PARA. PERFORM LOOP-IT UNTIL MOV-VALUE = 4. PERFORM LETS-SEE-IT. STOP RUN. LOOP-IT. MOVE MOV-VALUE TO TBL-ENT(MOV-VALUE). ADD 1 TO MOV-VALUE. LETS-SEE-IT. DISPLAY ARRAY-SCREEN. ACCEPT ARRAY-SCREEN.

Copyright Microsoft Corporation 1992.