PROGRAM FOR HANDLING THE ARRAY(TABLE

)

.

JCL : COMPILER For above program .

JCL : RUN JCL For above program .

WORKING-STORAGE SECTION. 02 WS-EMPDEPT PIC X(10). 02 WS-EMPNO PIC X(5). PROGRAM-ID. PERFORM INIT-TABLE VARYING N FROM 1 BY 1 .CODING OF THE COBOL PROGRAM ID DIVISION. 02 EMP-REC OCCURS 7 TIMES ASCENDING KEY IS EMP-NO INDEXED BY N. DATA DIVISION. 03 EMP-DEPT PIC X(10). 03 EMP-NO PIC X(5). TABLEC. 01 EMP-TABLE. PROCEDURE DIVISION. ENVIRONMENT DIVISION. 02 WS-EMPNAME PIC X(10). 03 EMP-NAME PIC X(10). 01 WS-REC.

. . . . UNTIL N > 7. **************************** Bottom of Data **************************** . MOVE WS-EMPNAME TO EMP-NAME(N). . DISPLAY-PARA. . STOP RUN. . . ACCEPT WS-EMPDEPT. . ACCEPT WS-EMPNO. PERFORM DISPLAY-PARA. MOVE WS-EMPDEPT TO EMP-DEPT(N). DISPLAY EMP-REC(7). MOVE WS-EMPNO TO EMP-NO(N). SET N TO 1.PERFORM INIT-TABLE VARYING N FROM 1 BY 1 . INIT-TABLE. . . . . ACCEPT WS-EMPNAME.

Sign up to vote on this title
UsefulNot useful