Last active
October 18, 2024 13:14
-
-
Save sandeep-sparrow/f7d8375ab66c7e50b626cd1ea23565ea to your computer and use it in GitHub Desktop.
Report Generation using COBOL program
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
11 23 12345 CAREER TRAINING CTR 1234567 2222222 00000100 | |
11 23 22222 HOMELITE TEXTRON CO 3454500 0000000 00000200 | |
11 33 55555 POLOT LIFE INS. CO. 1000000 0100000 00000300 | |
12 33 00111 DAUPHIN DEPOSIT BANK 1409900 1993000 00000400 | |
12 33 12121 GENERAL SERVICES CO. 1144400 1104956 00000500 | |
12 33 24680 INFO MANGEMENT CO. 1748145 1389247 00000600 | |
12 33 14680 ZEN TECHNOLOGIES CO. 748143 89347 00000700 | |
13 41 14681 TATA COFFEE PRIVATE. 2748345 2183247 00000800 | |
13 42 14682 TATA CONSUMER CO. 5748145 5143247 00000900 | |
14 43 14683 TATA CHEMICAL LTD. 4344345 4183447 00001000 | |
14 44 14684 COAL INDIA PVT LTD 1748145 2183247 00001100 | |
14 55 14685 ZINTEC PRVIATE LTD 2748145 2183247 00001200 | |
15 34 14686 SENTIALS LOCAL PVT 3748145 2183247 00001300 | |
15 34 14686 SENTIALS LOCAL PVT 748145 2183247 00001310 | |
16 34 14687 CORAL1INDIA FINANCE. 4748145 2183247 00001400 | |
16 23 14688 CORAL2INDIA FINANCE. 5748145 2183247 00001500 |
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
------------------------------------------------------------------------------------------ | |
DATE: 13/05/2020 YEAR-TO-DATE SALES REPORT PAGE: 0001 | |
TIME: 05:59 RPT1000 | |
------------------------------------------------------------------------------------------ | |
BRANCH CUST SALES SALES CHANGE CHANGE | |
NUM NUM CUSTOMER NAME THIS YTD LAST YTD AMOUNT PERCENT | |
------------------------------------------------------------------------------------------ | |
------------------------------------------------------------------------------------------ | |
11 12345 CAREER TRAINING CTR 12,345.67 22,222.22 9,876.55- 44.4- | |
22222 HOMELITE TEXTRON CO 34,545.00 0.00 999.90 999.9 | |
55555 POLOT LIFE INS. CO. 10,000.00 1,000.00 9,000.00 900.0 | |
BRANCH TOTAL 56,890.67 23,222.22 33,668.45 | |
12 00111 DAUPHIN DEPOSIT BANK 14,099.00 19,930.00 5,831.00- 29.3- | |
12121 GENERAL SERVICES CO. 11,444.00 11,049.56 394.44 3.6 | |
24680 INFO MANGEMENT CO. 17,481.45 13,892.47 3,588.98 25.8 | |
BRANCH TOTAL 43,024.45 44,872.03 1,847.58- | |
13 14681 TATA COFFEE PRIVATE. 27,483.45 21,832.47 5,650.98 25.9 | |
14682 TATA CONSUMER CO. 57,481.45 51,432.47 6,048.98 11.8 | |
BRANCH TOTAL 84,964.90 73,264.94 11,699.96 | |
14 14683 TATA CHEMICAL LTD. 43,443.45 41,834.47 1,608.98 3.8 | |
14684 COAL INDIA PVT LTD 17,481.45 21,832.47 4,351.02- 19.9- | |
14685 ZINTEC PRVIATE LTD 27,481.45 21,832.47 5,648.98 25.9 | |
BRANCH TOTAL 88,406.35 85,499.41 2,906.94 | |
15 14686 SENTIALS LOCAL PVT 37,481.45 21,832.47 15,648.98 71.7 | |
BRANCH TOTAL 37,481.45 21,832.47 15,648.98 | |
16 14687 CORAL1INDIA FINANCE. 47,481.45 21,832.47 25,648.98 117.5 | |
14688 CORAL2INDIA FINANCE. 57,481.45 21,832.47 35,648.98 163.3 | |
BRANCH TOTAL 104,962.90 43,664.94 61,297.96 | |
------------------------------------------------------------------------------------------ | |
------------------------------------------------------------------------------------------ | |
GRAND TOTAL 415,730.72 292,356.01 123,374.71 42.2 |
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
****************************************************************** | |
* Author: SANDEEP PRAJAPATI * | |
* Date: 10-05-2020 * | |
* Purpose: REPORT GENERATION USING COBOL PROGRAM. * | |
* : THIS PROGRAM READS A CUSTOMER MASTER FILE * | |
* : WHICH WRITES A REPORT FORMAT FOR ALL CUSTOMER'S HAVING* | |
* : SALES VALUE OG THIS YEAR >= THEN 10000 AND * | |
* : COMPUTES TOTAL CHANGE & CHANGE PERCENT IN SALES, * | |
* : AT THE END OF EACH BRANCH A TOTAL SALES IS DISPLAYED * | |
* : A GRAND TOTAL OF ALL CUSTOMER IS DISPLAYED IN THE END.* | |
****************************************************************** | |
IDENTIFICATION DIVISION. | |
* | |
PROGRAM-ID. RPT2000. | |
* | |
ENVIRONMENT DIVISION. | |
* | |
INPUT-OUTPUT SECTION. | |
* | |
FILE-CONTROL. | |
SELECT CUSTMAST ASSIGN TO CUSTMAST | |
ACCESS IS SEQUENTIAL. | |
* | |
SELECT SALESRPT ASSIGN TO SALESRPT | |
ACCESS IS SEQUENTIAL. | |
* | |
DATA DIVISION. | |
* | |
FILE SECTION. | |
* | |
FD CUSTMAST RECORDING MODE F. | |
* | |
01 CUSTOMER-MASTER-RECORD. | |
05 CM-BRANCH-NUMBER PIC X(02). | |
05 FILLER PIC X(01). | |
05 CM-SALESREP-NUMBER PIC 9(02). | |
05 FILLER PIC X(01). | |
05 CM-CUSTOMER-NUMBER PIC 9(05). | |
05 FILLER PIC X(01). | |
05 CM-CUSTOMER-NAME PIC X(20). | |
05 FILLER PIC X(01). | |
05 CM-SALES-THIS-YTD PIC S9(05)V9(02). | |
05 FILLER PIC X(01). | |
05 CM-SALES-LAST-YTD PIC S9(05)V9(02). | |
05 FILLER PIC X(32). | |
* | |
FD SALESRPT RECORDING MODE F. | |
* | |
01 PRINT-AREA PIC X(132). | |
* | |
WORKING-STORAGE SECTION. | |
* | |
01 SWITCHES. | |
05 CUSTMAST-EOF-SWITCH PIC X(01) VALUE 'N'. | |
05 BRANCH-SWITCH PIC X(01) VALUE 'N'. | |
* | |
01 PRINT-FIELDS. | |
05 PAGE-COUNT PIC S9(03) VALUE ZERO. | |
05 LINES-ON-PAGE PIC S9(03) VALUE +55. | |
05 LINE-COUNT PIC S9(03) VALUE +99. | |
* | |
01 TOTAL-FIELDS. | |
05 GRAND-TOTAL-THIS-YTD PIC S9(07)V99 VALUE ZERO. | |
05 GRAND-TOTAL-LAST-YTD PIC S9(07)V99 VALUE ZERO. | |
05 BRANCH-TOTAL-THIS-YTD PIC S9(07)V99 VALUE ZERO. | |
05 BRANCH-TOTAL-LAST-YTD PIC S9(07)V99 VALUE ZERO. | |
05 HIGHFEN PIC X(90) VALUE ALL '-'. | |
* | |
01 CURRENT-DATE-AND-TIME. | |
05 CD-YEAR PIC 9999. | |
05 CD-MONTH PIC 99. | |
05 CD-DAY PIC 99. | |
05 CD-HOURS PIC 99. | |
05 CD-MINUTES PIC 99. | |
05 FILLER PIC X(09). | |
* | |
01 OLD-BRANCH-NUMBER PIC X(02). | |
* | |
01 CALCULATED-FIELD. | |
05 CHANGE-AMOUNT PIC S9(07)V99. | |
05 CHANGE-PERCENT PIC S9(03)V9. | |
* | |
* --------------- LINES FORMAT END EDITED CLAUSE ----------------* | |
* | |
01 HEADING-LINE-01. | |
05 FILLER PIC X(07) VALUE 'DATE: '. | |
05 HL1-DAY PIC 9(02). | |
05 FILLER PIC X(01) VALUE '/'. | |
05 HL1-MONTH PIC 9(02). | |
05 FILLER PIC X(01) VALUE '/'. | |
05 HL1-YEAR PIC 9(04). | |
05 FILLER PIC X(11) VALUE SPACES. | |
05 FILLER PIC X(32) | |
VALUE 'YEAR-TO-DATE SALES REPORT '. | |
05 FILLER PIC X(10) VALUE SPACES. | |
05 FILLER PIC X(06) VALUE 'PAGE: '. | |
05 HL1-PAGE PIC 9(04). | |
05 FILLER PIC X(52) VALUE SPACES. | |
* | |
01 HEADING-LINE-02. | |
05 FILLER PIC X(07) VALUE 'TIME: '. | |
05 HL2-HOURS PIC 9(02). | |
05 FILLER PIC X(01) VALUE ':'. | |
05 HL2-MINUTES PIC 9(02). | |
05 FILLER PIC X(58) VALUE SPACES. | |
05 FILLER PIC X(10) VALUE 'RPT1000 '. | |
05 FILLER PIC X(52) VALUE SPACES. | |
* | |
01 HEADING-LINE-03. | |
05 FILLER PIC X(08) | |
VALUE 'BRANCH '. | |
05 FILLER PIC X(20) | |
VALUE 'CUST '. | |
05 FILLER PIC X(20) | |
VALUE ' SALES '. | |
05 FILLER PIC X(20) | |
VALUE ' SALES '. | |
05 FILLER PIC X(20) | |
VALUE 'CHANGE CHANGE '. | |
05 FILLER PIC X(44) VALUE SPACES. | |
* | |
01 HEADING-LINE-04. | |
05 FILLER PIC X(08) | |
VALUE ' NUM '. | |
05 FILLER PIC X(20) | |
VALUE 'NUM CUSTOMER NAME'. | |
05 FILLER PIC X(20) | |
VALUE ' THIS YTD '. | |
05 FILLER PIC X(20) | |
VALUE ' LAST YTD '. | |
05 FILLER PIC X(20) | |
VALUE 'AMOUNT PERCENT '. | |
05 FILLER PIC X(44) VALUE SPACES. | |
* | |
01 CUSTOMER-LINE. | |
05 FILLER PIC X(02) VALUE SPACES. | |
05 CL-BRANCH-NUMBER PIC X(02). | |
05 FILLER PIC X(04) VALUE SPACES. | |
05 CL-CUSTOMER-NUMBER PIC 9(05). | |
05 FILLER PIC X(02) VALUE SPACES. | |
05 CL-CUSTOMER-NAME PIC X(20). | |
05 FILLER PIC X(03) VALUE SPACES. | |
05 CL-SALES-THIS-YTD PIC ZZ,ZZ9.99-. | |
05 FILLER PIC X(04) VALUE SPACES. | |
05 CL-SALES-LAST-YTD PIC ZZ,ZZ9.99-. | |
05 FILLER PIC X(04) VALUE SPACES. | |
05 CL-CHANGE-AMOUNT PIC ZZ,ZZ9.99-. | |
05 FILLER PIC X(03) VALUE SPACES. | |
05 CL-CHANGE-PERCENT PIC ZZZ.9-. | |
05 FILLER PIC X(47) VALUE SPACES. | |
* | |
01 BRANCH-LINE. | |
05 FILLER PIC X(20) VALUE SPACES. | |
05 FILLER PIC X(15) | |
VALUE 'BRANCH TOTAL '. | |
05 BTL-SALES-THIS-YTD PIC Z,ZZZ,ZZ9.99-. | |
05 FILLER PIC X(01) VALUE SPACES. | |
05 BTL-SALES-LAST-YTD PIC Z,ZZZ,ZZ9.99-. | |
05 FILLER PIC X(01) VALUE SPACES. | |
05 BTL-CHANGE-AMOUNT PIC Z,ZZZ,ZZ9.99-. | |
05 FILLER PIC X(03) VALUE SPACES. | |
05 BTL-CHANGE-PERCENT PIC ZZZ.9-. | |
05 FILLER PIC X(48) VALUE SPACES. | |
* | |
01 GRAND-TOTAL-LINE. | |
05 FILLER PIC X(20) VALUE SPACES. | |
05 FILLER PIC X(15) | |
VALUE ' GRAND TOTAL '. | |
05 GTL-SALES-THIS-YTD PIC Z,ZZZ,ZZ9.99-. | |
05 FILLER PIC X(01) VALUE SPACES. | |
05 GTL-SALES-LAST-YTD PIC Z,ZZZ,ZZ9.99-. | |
05 FILLER PIC X(01) VALUE SPACES. | |
05 GTL-CHANGE-AMOUNT PIC Z,ZZZ,ZZ9.99-. | |
05 FILLER PIC X(03) VALUE SPACES. | |
05 GTL-CHANGE-PERCENT PIC ZZZ.9-. | |
05 FILLER PIC X(48) VALUE SPACES. | |
* | |
PROCEDURE DIVISION. | |
* | |
000-PREPARE-SALES-REPORT. | |
* | |
OPEN INPUT CUSTMAST | |
OUTPUT SALESRPT. | |
* | |
PERFORM 100-FORMAT-REPORT-HEADING. | |
PERFORM 200-INITIALIZE-SALES-REPORT. | |
PERFORM 300-PREPARE-SALES-LINES | |
UNTIL CUSTMAST-EOF-SWITCH = "Y". | |
PERFORM 400-PRINT-GRAND-TOTALS. | |
* | |
CLOSE CUSTMAST | |
SALESRPT. | |
* | |
STOP RUN. | |
* | |
100-FORMAT-REPORT-HEADING. | |
* | |
MOVE FUNCTION CURRENT-DATE TO CURRENT-DATE-AND-TIME. | |
MOVE CD-DAY TO HL1-DAY. | |
MOVE CD-MONTH TO HL1-MONTH. | |
MOVE CD-YEAR TO HL1-YEAR. | |
MOVE CD-HOURS TO HL2-HOURS. | |
MOVE CD-MINUTES TO HL2-MINUTES. | |
* | |
200-INITIALIZE-SALES-REPORT. | |
* | |
PERFORM 210-READ-CUSTOMER-RECORD. | |
IF CUSTMAST-EOF-SWITCH = "N" | |
PERFORM 220-PRINT-CUSTOMER-LINE. | |
MOVE CM-BRANCH-NUMBER TO OLD-BRANCH-NUMBER. | |
* | |
300-PREPARE-SALES-LINES. | |
* | |
PERFORM 210-READ-CUSTOMER-RECORD. | |
IF CUSTMAST-EOF-SWITCH = "N" | |
IF CM-SALES-THIS-YTD >= 10000 | |
IF CM-BRANCH-NUMBER = OLD-BRANCH-NUMBER | |
MOVE 'Y' TO BRANCH-SWITCH | |
PERFORM 220-PRINT-CUSTOMER-LINE | |
ELSE | |
MOVE 'N' TO BRANCH-SWITCH | |
PERFORM 240-PRINT-BRANCH-LINE | |
PERFORM 220-PRINT-CUSTOMER-LINE | |
MOVE CM-BRANCH-NUMBER TO OLD-BRANCH-NUMBER | |
END-IF | |
END-IF | |
ELSE | |
PERFORM 240-PRINT-BRANCH-LINE | |
END-IF. | |
* | |
210-READ-CUSTOMER-RECORD. | |
* | |
READ CUSTMAST | |
AT END | |
MOVE "Y" TO CUSTMAST-EOF-SWITCH. | |
* | |
220-PRINT-CUSTOMER-LINE. | |
* | |
IF LINE-COUNT >= LINES-ON-PAGE | |
PERFORM 230-PRINT-HEADING-LINE | |
END-IF. | |
* | |
IF BRANCH-SWITCH = "Y" | |
MOVE SPACE TO CL-BRANCH-NUMBER | |
ELSE | |
MOVE CM-BRANCH-NUMBER TO CL-BRANCH-NUMBER | |
END-IF. | |
MOVE CM-CUSTOMER-NUMBER TO CL-CUSTOMER-NUMBER. | |
MOVE CM-CUSTOMER-NAME TO CL-CUSTOMER-NAME. | |
MOVE CM-SALES-THIS-YTD TO CL-SALES-THIS-YTD. | |
MOVE CM-SALES-LAST-YTD TO CL-SALES-LAST-YTD. | |
* | |
COMPUTE CHANGE-AMOUNT ROUNDED = CM-SALES-THIS-YTD - | |
CM-SALES-LAST-YTD. | |
MOVE CHANGE-AMOUNT TO CL-CHANGE-AMOUNT. | |
* | |
IF CM-SALES-LAST-YTD = ZERO | |
MOVE 999.9 TO CL-CHANGE-AMOUNT | |
MOVE 999.9 TO CHANGE-PERCENT | |
ELSE | |
COMPUTE CHANGE-PERCENT ROUNDED = | |
CHANGE-AMOUNT * 100 / CM-SALES-LAST-YTD | |
ON SIZE ERROR | |
MOVE 999.9 TO CL-CHANGE-PERCENT | |
END-IF. | |
* | |
MOVE CHANGE-PERCENT TO CL-CHANGE-PERCENT. | |
MOVE CUSTOMER-LINE TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
ADD 1 TO LINE-COUNT. | |
ADD CM-SALES-THIS-YTD TO GRAND-TOTAL-THIS-YTD | |
BRANCH-TOTAL-THIS-YTD | |
ADD CM-SALES-LAST-YTD TO GRAND-TOTAL-LAST-YTD | |
BRANCH-TOTAL-LAST-YTD . | |
* | |
230-PRINT-HEADING-LINE. | |
* | |
ADD 1 TO PAGE-COUNT. | |
* | |
MOVE HIGHFEN TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
MOVE PAGE-COUNT TO HL1-PAGE. | |
MOVE HEADING-LINE-01 TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
MOVE HEADING-LINE-02 TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE HIGHFEN TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE HEADING-LINE-03 TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
MOVE HEADING-LINE-04 TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE HIGHFEN TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
MOVE HIGHFEN TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE ZERO TO LINE-COUNT. | |
* | |
240-PRINT-BRANCH-LINE. | |
* | |
MOVE SPACES TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE BRANCH-TOTAL-THIS-YTD TO BTL-SALES-THIS-YTD. | |
MOVE BRANCH-TOTAL-LAST-YTD TO BTL-SALES-LAST-YTD. | |
COMPUTE CHANGE-AMOUNT = | |
BRANCH-TOTAL-THIS-YTD - BRANCH-TOTAL-LAST-YTD. | |
MOVE CHANGE-AMOUNT TO BTL-CHANGE-AMOUNT. | |
IF BRANCH-TOTAL-LAST-YTD = ZERO | |
MOVE 999.9 TO GTL-CHANGE-AMOUNT | |
MOVE 999.9 TO CHANGE-PERCENT | |
ELSE | |
COMPUTE CHANGE-PERCENT ROUNDED = | |
CHANGE-AMOUNT * 100 / BRANCH-TOTAL-LAST-YTD | |
ON SIZE ERROR | |
MOVE 999.9 TO BTL-CHANGE-PERCENT | |
END-IF. | |
MOVE BRANCH-LINE TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE ZEROES TO BRANCH-TOTAL-THIS-YTD | |
BRANCH-TOTAL-LAST-YTD. | |
* | |
MOVE SPACES TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
400-PRINT-GRAND-TOTALS. | |
* | |
MOVE HIGHFEN TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
MOVE HIGHFEN TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
MOVE SPACES TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
MOVE GRAND-TOTAL-THIS-YTD TO GTL-SALES-THIS-YTD. | |
MOVE GRAND-TOTAL-LAST-YTD TO GTL-SALES-LAST-YTD. | |
COMPUTE CHANGE-AMOUNT = | |
GRAND-TOTAL-THIS-YTD - GRAND-TOTAL-LAST-YTD. | |
MOVE CHANGE-AMOUNT TO GTL-CHANGE-AMOUNT. | |
IF GRAND-TOTAL-LAST-YTD = ZERO | |
MOVE 999.9 TO GTL-CHANGE-AMOUNT | |
MOVE 999.9 TO CHANGE-PERCENT | |
ELSE | |
COMPUTE CHANGE-PERCENT ROUNDED = | |
CHANGE-AMOUNT * 100 / GRAND-TOTAL-LAST-YTD | |
ON SIZE ERROR | |
MOVE 999.9 TO GTL-CHANGE-PERCENT | |
END-IF. | |
MOVE CHANGE-PERCENT TO GTL-CHANGE-PERCENT. | |
MOVE GRAND-TOTAL-LINE TO PRINT-AREA. | |
WRITE PRINT-AREA. | |
* | |
END PROGRAM RPT2000. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment