Last active
September 30, 2020 06:58
-
-
Save sandeep-sparrow/4f06830f09bb4a9ae9cd5400eaa57189 to your computer and use it in GitHub Desktop.
V1 computes no of occurs for dynamic table values.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDENTIFICATION DIVISION. | |
PROGRAM-ID. CBLV1TBL. | |
AUTHOR. SANDEEP R PRAJAPATI. | |
****************************************************************** | |
*DESCRIPTION: COBOL PROGRAM LOADS DATA INTO EMPLOYEE TABLE * | |
* USING EXTERNAL FILE * | |
*DATE : 24-09-2020 * | |
****************************************************************** | |
* | |
ENVIRONMENT DIVISION. | |
* | |
INPUT-OUTPUT SECTION. | |
* | |
FILE-CONTROL. | |
* | |
SELECT IN-FILE ASSIGN TO EMPROJ. | |
* | |
DATA DIVISION. | |
* | |
FILE SECTION. | |
* | |
FD IN-FILE RECORD CONTAINS 80 CHARACTERS | |
RECORDING MODE IS F. | |
* | |
01 EMP-PROJECT-TABLE-I. | |
05 EMP-PROJECT-I PIC X(05). | |
05 EMP-NAME-I PIC X(25). | |
05 FILLER PIC X(50). | |
* | |
WORKING-STORAGE SECTION. | |
* | |
77 PROJECT-SUB PIC S9(04) COMP VALUE 1. | |
77 TABLE-MAX PIC S9(04) COMP VALUE 20. | |
77 SW-END-OF-FILE PIC X(01) VALUE SPACE. | |
88 END-OF-FILE VALUE 'Y'. | |
* | |
01 EMP-PROJECT-TABLE. *> DEFINE THE TABLE | |
05 EMP-PROJECT-ITEM OCCURS 20 TIMES. | |
10 EMP-PROJECT PIC X(05). | |
10 EMP-NAME PIC X(25). | |
* | |
PROCEDURE DIVISION. | |
* | |
INITIALIZE EMP-PROJECT-TABLE. | |
* | |
OPEN INPUT IN-FILE. | |
* | |
PERFORM 000-READ-FILE UNTIL END-OF-FILE | |
OR PROJECT-SUB > TABLE-MAX. | |
* | |
DISPLAY "---------START-----------". | |
DISPLAY EMP-PROJECT-ITEM(1). | |
DISPLAY EMP-PROJECT-ITEM(5). | |
DISPLAY EMP-PROJECT-ITEM(10). | |
DISPLAY EMP-PROJECT-ITEM(15). | |
DISPLAY EMP-PROJECT-ITEM(20). | |
DISPLAY "---------END-------------". | |
* | |
DISPLAY "---------FULL TABLE START-------------". | |
DISPLAY EMP-PROJECT-TABLE. | |
DISPLAY "---------FULL TABLE END---------------". | |
* | |
GOBACK. | |
* | |
000-READ-FILE. | |
* | |
READ IN-FILE | |
AT END | |
MOVE 'Y' TO SW-END-OF-FILE | |
NOT AT END | |
PERFORM 100-LOAD-TABLE | |
END-READ. | |
* | |
100-LOAD-TABLE. | |
* | |
MOVE EMP-PROJECT-I TO EMP-PROJECT(PROJECT-SUB) | |
MOVE EMP-NAME-I TO EMP-NAME(PROJECT-SUB) | |
ADD 1 TO PROJECT-SUB. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CUBE1SANDEEP PRAJAPATI | |
CUBE2MUKESH KHANNA | |
CUBE3SALMAN KHAN | |
CUBE4SACHIN TENDULKAR | |
CUBE5RAMESH PRAJAPATI | |
CUBE6VIKAS SINGH | |
CUBE7SHAH RUKH KHAN | |
CUBE8AKSHAY KUMAR | |
CUBE9VIVEK OBERIA | |
TEL10FREE FIRE | |
TEL11NARENDRA MODI | |
TEL12HEMA MALINI | |
TEL13RITA PRAJAPATI | |
TEL14AJAY DEVGUN | |
TEL15CALL OF DUTY | |
TEL16JATIN RANAWAT | |
TEL17MURLI PRASAD | |
TEL18UDAY PRASAD | |
TEL19JACK SPARROW | |
TEL20JAY VEER MAHARAJ | |
TEL21JATIN RANAWAT | |
TEL22MURLI PRASAD | |
TEL23UDAY PRASAD | |
TEL24JACK SPARROW | |
TEL25JACK SPARROW |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------START----------- | |
CUBE1SANDEEP PRAJAPATI | |
CUBE5RAMESH PRAJAPATI | |
TEL10FREE FIRE | |
TEL15CALL OF DUTY | |
TEL20JAY VEER MAHARAJ | |
---------END------------- | |
---------FULL TABLE START------------- | |
CUBE1SANDEEP PRAJAPATI CUBE2MUKESH KHANNA CUBE3SALMAN KHAN CUBE4SACHIN TENDULKAR | |
CUBE5RAMESH PRAJAPATI CUBE6VIKAS SINGH CUBE7SHAH RUKH KHAN CUBE8AKSHAY KUMAR | |
CUBE9VIVEK OBERIA TEL10FREE FIRE TEL11NARENDRA MODI TEL12HEMA MALINI | |
TEL13RITA PRAJAPATI TEL14AJAY DEVGUN TEL15CALL OF DUTY TEL16JATIN RANAWAT | |
TEL17MURLI PRASAD TEL18UDAY PRASAD TEL19JACK SPARROW TEL20JAY VEER MAHARAJ | |
---------FULL TABLE END--------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Defined Cross-reference of procedures References | |
65 000-READ-FILE. . . . . . . . . P48 | |
74 100-LOAD-TABLE . . . . . . . . P71 | |
PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.3.0 P200715 CBLV1TBL Date 09/24/2020 Time 05:24:13 Page 7 | |
Defined Cross-reference of programs References | |
2 CBLV1TBL | |
* Statistics for COBOL program CBLV1TBL: | |
* Source records = 79 | |
* Data Division statements = 11 | |
* Procedure Division statements = 20 | |
* Generated COBOL statements = 0 | |
* Program complexity factor = 21 | |
End of compilation 1, program CBLV1TBL, no statements flagged. | |
Return code 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment