1: IDENTIFICATION DIVISION.
2: PROGRAM-ID. Q14.
3: ENVIRONMENT DIVISION.
4: CONFIGURATION SECTION.
5: SOURCE-COMPUTER. IBM PC.
6: OBJECT-COMPUTER. IBM PC.
7: INPUT-OUTPUT SECTION.
8: SELECT CUSTOMER-REC-FILE ASSIGN TO "CUST_REC.DAT" ORGANIZATION
9: IS SEQUENTIAL.
10: SELECT OUT-FILE ASSIGN TO "TELBILL.TXT".
11:
12: DATA DIVISION.
13: FILE SECTION.
14: FD CUSTOMER-REC-FILE.
15: 01 IN-REC.
16: 02 IN-CUST-ID PIC 999999.
17: 02 IN-CUST-NAME PIC A(20).
18: 02 IN-CUST-ADDRESS PIC X(30).
19: 02 IN-METERED-PULSES PIC 9(4).
20: 02 IN-TELNO PIC 9(6).
21: FD OUT-FILE.
22: 01 OUT-REC PIC X(80).
23:
24:
25:
26: WORKING-STORAGE SECTION.
27: 77 EOF PIC X VALUE "N".
28: 77 HEADING1 PIC X(80) VALUE ALL "-".
29: 77 COMPANY-TITLE PIC X(80) VALUE
30: " AIRTEL TELEPHONE SERVICE ---- BHARTI TELENET LTD.".
31: 01 CUST-ID-LINE.
32: 02 F PIC X(18) VALUE "CUSTOMER ID NO.: ".
33: 02 CUST-ID PIC 9(6).
34: 02 F PIC X(37) VALUE " TELEPHONE CHARGES FOR THE MONTH ".
35: 02 BILL-MONTH PIC X(10).
36: 01 OUT-FORMAT.
37: 02 CUST-NAME PIC A(15).
38: 02 PHONE-NO PIC ZZ9999.
39: 02 F PIC X(10) VALUE SPACES.
40: 02 METRED-PULSES PIC ***9.
41: 02 F PIC X(10) VALUE SPACES.
42: 02 BILL-DUE PIC ****.**.
43: 02 F PIC X(10) VALUE SPACES.
44: 02 LATE-BILL PIC ****.**.
45:
46: 01 TITLE-LINE.
47: 02 F PIC X(80) VALUE " CUSTOMER NAME | TEL NO | METRED PUL
48: - "SES | NET CHARGES | CHARGES AFTER 15 DAYS *".
49: 01 ISSUE-DATE-LINE.
50: 02 F PIC X(20) VALUE " DATE OF ISSUE : ".
51: 02 CURR-MONTH PIC X(40).
52: 01 FOOTER-LINE.
53: 02 F PIC X(80) VALUE " *: 15 DAYS FROM THE DATE OF ISSUE AS
54: - " STATED ABOVE".
55: 77 CHARGES PIC 9(4)V99.
56: 77 PULSES PIC 9(5).
57: PROCEDURE DIVISION.
58: MAIN-PARA.
59: DISPLAY "PLS. ENTER CURRENT DATE".
60: ACCEPT CURR-MONTH .
61: OPEN INPUT CUSTOMER-REC-FILE OUTPUT OUT-FILE.
62: DISPLAY "PLS. ENTER THE MONTH FOR WHICH BILL HAS TO BE GENERATED
63: - ".....(EX. JAN, 2001)".
64: ACCEPT BILL-MONTH.
65: READ CUSTOMER-REC-FILE AT END MOVE "Y" TO EOF.
66: PERFORM CALC-PARA UNTIL EOF = "Y".
67: DISPLAY "THE TELEPHONE BILL IS GENERATED.".
68: CLOSE CUSTOMER-REC-FILE , OUT-FILE.
69: STOP RUN.
70:
71: HEADER-PARA.
72: WRITE OUT-REC FROM HEADING1 .
73: WRITE OUT-REC FROM COMPANY-TITLE.
74: WRITE OUT-REC FROM HEADING1.
75: MOVE IN-CUST-NAME TO CUST-NAME OF OUT-FORMAT.
76: MOVE IN-TELNO TO PHONE-NO.
77:
78: FOOTER-PARA.
79: WRITE OUT-REC FROM ISSUE-DATE-LINE.
80: WRITE OUT-REC FROM FOOTER-LINE.
81: MOVE "15 DAYS FROM THE DATE OF ISSUE OF BILL." TO OUT-REC.
82:
83:
84: CALC-PARA.
85: PERFORM HEADER-PARA.
86: MOVE IN-CUST-ID TO CUST-ID OF CUST-ID-LINE.
87: WRITE OUT-REC FROM CUST-ID-LINE.
88: WRITE OUT-REC FROM HEADING1.
89: WRITE OUT-REC FROM TITLE-LINE.
90: WRITE OUT-REC FROM HEADING1.
91:
92: MOVE IN-CUST-NAME TO CUST-NAME.
93: MOVE IN-METERED-PULSES TO METRED-PULSES .
94: MOVE IN-TELNO TO PHONE-NO .
95: IF IN-METERED-PULSES < 75
96: COMPUTE BILL-DUE = 250.00
97: ELSE
98: MOVE IN-METERED-PULSES TO PULSES.
99: COMPUTE CHARGES = 250.00 + ( PULSES - 75 ) * 0.8 .
100: MOVE CHARGES TO BILL-DUE.
101: COMPUTE CHARGES = CHARGES + CHARGES * 0.10.
102: MOVE CHARGES TO LATE-BILL.
103: WRITE OUT-REC FROM OUT-FORMAT .
104: PERFORM FOOTER-PARA.
105: DISPLAY IN-CUST-NAME.
106: WRITE OUT-REC FROM HEADING1 AFTER ADVANCING PAGE.
107: READ CUSTOMER-REC-FILE AT END MOVE "Y" TO EOF.
108:
Post a Comment