Реферат: Cobol Program 83 Essay Research Paper 001600
Название: Cobol Program 83 Essay Research Paper 001600 Раздел: Топики по английскому языку Тип: реферат |
Cobol Program 8.3 Essay, Research Paper 0016.00 * COMPILER: MICRO FOCUS 0017.00 0018.00 ENVIRONMENT DIVISION. 0019.00 0020.00 INPUT-OUTPUT SECTION. 0021.00 0022.00 FILE-CONTROL. 0023.00 SELECT ACCOUNTS-REC-FILE 0024.00 ASSIGN TO DISK-CUSTOMER. 0025.00 0026.00 SELECT ACCOUNTS-REC-REGISTER 0027.00 ASSIGN TO PRINTER-QPRINT. 0028.00 0029.00 DATA DIVISION. 0030.00 0031.00 FILE SECTION. 0032.00 0033.00 FD ACCOUNTS-REC-FILE. 0034.00 01 CUSTOMER-RECORD PIC X(80). 0036.00 FD ACCOUNTS-REC-REGISTER. 0037.00 01 ACCOUNTS-REC-LINE-RECORD PIC X(120). 0038.00 0039.00 WORKING-STORAGE SECTION. 0040.00 * Switches 0041.00 01 PROGRAM-SWITCHES. 0042.00 05 S1-END-OF-FILE-SWITCH PIC X. 0043.00 88 S1-END-OF-FILE VALUE “Y”. 0044.00 88 S1-NOT-END-OF-FILE VALUE “N”. 0045.00 0046.00 * Report Control Fields 0047.00 01 RC-REPORT-CONTROLS. 0048.00 05 RC-PAGE-COUNT PIC 9(3). 0049.00 05 RC-LINES-PER-PAGE PIC 9(2) VALUE 54. 0050.00 05 RC-LINES-USED PIC 9(2). 0051.00 05 RC-LINE-SPACING PIC 9(2). 0052.00 0053.00 * Work Areas 0054.00 01 WA-particle-AREAS. 0055.00 05 WA-DATE-WORK PIC 9(6). 0056.00 05 WA-FINANCE-CHARGE PIC S9(5)V99. 0057.00 05 WA-MINIMUM-PAYMENT-WORK PIC S9(5)V99. 0058.00 05 WA-LATE-CHARGE PIC S9(4)V99. 0059.00 05 WA-NEW-BALANCE PIC S9(6)V99. 0060.00 05 WA-MINIMUM-PAYMENT PIC S9(5)V99. 0061.00 0062.00 01 AC-ACCUMULATORS. 0063.00 05 AC-TOTAL-BALANCE-FORWARD-ACCUM PIC S9(7)V99. 0064.00 05 AC-TOTAL-PAYMENTS-RECVD-ACCUM PIC S9(7)V99. 0065.00 05 AC-TOTAL-FINANCE-CHARGE-ACCUM PIC S9(6)V99. 0066.00 05 AC-TOTAL-LATE-CHARGE-ACCUM PIC S9(5)V99. 0067.00 05 AC-TOTAL-NEW-PURCHASES-ACCUM PIC S9(7)V99. 0068.00 05 AC-TOTAL-NEW-BALANCE-ACCUM PIC S9(7)V99. 0069.00 05 AC-TOTAL-MINIMUM-PAYMENT-ACCUM PIC S9(6)V99. 0070.00 0071.00 * Input Record Definitions 0072.00 01 CR-CUSTOMER-RECORD. 0073.00 05 CR-RECORD-CODE PIC 9(2). 0074.00 05 CR-CUSTOMER-NUMBER PIC 9(5). 0075.00 05 CR-CUSTOMER-NAME PIC X(24). 0076.00 05 PIC X(7). 0077.00 05 CR-BALANCE-FORWARD PIC S9(6)V99. 0078.00 05 CR-NEW-PURCHASES PIC S9(6)V99. 0079.00 05 PIC X(18). 0080.00 05 CR-PAYMENTS-RECEIVED PIC S9(6)V99. 0081.00 0082.00 * Heading Line Definitions 0083.00 01 H1-HEADING-LINE-1. 0084.00 05 PIC X(20) VALUE “ACCOUNTS RECEIVABLE ” 0085.00 05 PIC X(20) VALUE “REGISTER (8-3) ” 0086.00 05 PIC X(20) VALUE ” ” 0087.00 05 PIC X(20) VALUE ” ” 0088.00 05 PIC X(15) VALUE ” RUN DATE “. 0089.00 05 H1-MONTH PIC 9(2). 0090.00 05 PIC X(1) VALUE “/”. 0091.00 05 H1-DAY PIC 9(2). 0092.00 05 PIC X(1) VALUE “/”. 0093.00 05 H1-YEAR PIC 9(2). 0094.00 05 PIC X(9) VALUE ” PAGE “. 0095.00 05 H1-PAGE-NBR PIC ZZ9. 0096.00 05 PIC X(17) VALUE SPACES. 0097.00 0098.00 01 H2-HEADING-LINE-2. 0099.00 05 PIC X(20) VALUE “CUST. ” 0100.00 05 PIC X(20) VALUE ” BALANC” 0101.00 05 PIC X(20) VALUE “E PAYMENTS FIN” 0102.00 05 PIC X(20) VALUE “ANCE LATE NE” 0103.00 05 PIC X(20) VALUE “W NEW ” 0104.00 05 PIC X(20) VALUE “MINIMUM ” 0105.00 0106.00 01 H3-HEADING-LINE-3. 0107.00 05 PIC X(20) VALUE ” NO. CUSTOMER NAM” 0108.00 05 PIC X(20) VALUE “E FORWAR” 0109.00 05 PIC X(20) VALUE “D RECEIVED CH” 0110.00 05 PIC X(20) VALUE “ARGE CHARGE PURCH” 0111.00 05 PIC X(20) VALUE “ASES BALANCE ” 0112.00 05 PIC X(20) VALUE “PAYMENT STATUS ” 0113.00 0114.00 * Print Line Definitions 0115.00 01 AR-ACCOUNTS-REC-LINE. 0116.00 05 AR-CUSTOMER-NUMBER PIC 9(5). 0117.00 05 PIC X(1) VALUE SPACE. 0118.00 05 AR-CUSTOMER-NAME PIC X(24). 0119.00 05 PIC X(1) VALUE SPACE. 0120.00 05 AR-BALANCE-FORWARD PIC ZZZ,ZZZ.99-. 0121.00 05 PIC X(1) VALUE SPACE. 0122.00 05 AR-PAYMENTS-RECEIVED PIC ZZZ,ZZZ.99-. 0123.00 05 PIC X(1) VALUE SPACE. 0124.00 05 AR-FINANCE-CHARGE PIC ZZ,ZZZ.99. 0125.00 05 PIC X(1) VALUE SPACE. 0126.00 05 AR-LATE-CHARGE PIC Z,ZZZ.99. 0127.00 05 PIC X(1) VALUE SPACE. 0128.00 05 AR-NEW-PURCHASES PIC ZZZ,ZZZ.99-. 0129.00 05 PIC X(1) VALUE SPACE. 0130.00 05 AR-NEW-BALANCE PIC ZZZ,ZZZ.99-. 0131.00 05 PIC X(1) VALUE SPACE. 0132.00 05 AR-MINIMUM-PAYMENT PIC ZZ,ZZZ.99. 0133.00 05 PIC X(1) VALUE SPACE. 0134.00 05 AR-ACCOUNT-STATUS PIC X(8). 0135.00 0136.00 * Total Line Definitions 0137.00 01 RT1-TOTAL-LINE. 0138.00 05 PIC X(13) VALUE SPACES 0139.00 05 PIC X(16) 0140.00 VALUE “REPORT TOTALS ” 0141.00 05 RT1-TOTAL-BALANCE-FORWARD PIC Z,ZZZ,ZZZ.99-. 0142.00 05 PIC X(1) VALUE “*”. 0143.00 05 PIC X(11) VALUE SPACES 0144.00 05 RT1-TOTAL-FINANCE-CHARGE PIC ZZZ,ZZZ.99. 0145.00 05 PIC X(2) VALUE ” *”. 0146.00 05 PIC X(6) VALUE SPACES 0147.00 05 RT1-TOTAL-NEW-PURCHASES PIC Z,ZZZ,ZZZ.99-. 0148.00 05 PIC X(1) VALUE “*”. 0149.00 05 PIC X(11) VALUE SPACES 0150.00 05 RT1-TOTAL-MINIMUM-PAYMENT PIC ZZZ,ZZZ.99. 0151.00 05 PIC X(2) VALUE ” *”. 0152.00 0153.00 01 RT2-TOTAL-LINE. 0154.00 05 PIC X(41) VALUE SPACES 0155.00 05 RT2-TOTAL-PAYMENTS-RECEIVED PIC Z,ZZZ,ZZZ.99-. 0156.00 05 PIC X(1) VALUE “*”. 0157.00 05 PIC X(9) VALUE SPACES 0158.00 05 RT2-TOTAL-LATE-CHARGE PIC ZZ,ZZZ.99. 0159.00 05 PIC X(2) VALUE ” *”. 0160.00 05 PIC X(9) VALUE SPACES 0161.00 05 RT2-TOTAL-NEW-BALANCE PIC Z,ZZZ,ZZZ.99-. 0162.00 05 PIC X(1) VALUE “*”. 0163.00 0164.00 0165.00 0166.00 PROCEDURE DIVISION. 0167.00 0168.00 000-PRINT-ACCOUNTS-RECVBL-REG. 0169.00 ********** Initialization Sequence ********** 0170.00 OPEN INPUT ACCOUNTS-REC-FILE 0171.00 OUTPUT ACCOUNTS-REC-REGISTER 0172.00 0173.00 PERFORM 100-INITIALIZE-VARIABLE-FIELDS 0174.00 0175.00 ********** Processing Sequence ********** 0176.00 PERFORM UNTIL S1-END-OF-FILE 0177.00 0178.00 READ ACCOUNTS-REC-FILE INTO CR-CUSTOMER-RECORD 0179.00 AT END 0180.00 SET S1-END-OF-FILE TO TRUE 0181.00 NOT AT END 0182.00 PERFORM 200-PROCESS-CUSTOMER-RECORD 0183.00 END-READ 0184.00 0185.00 END-PERFORM 0186.00 ********** Termination Sequence ********** 0187.00 PERFORM 700-PRINT-TOTAL-LINES 0188.00 0189.00 CLOSE ACCOUNTS-REC-FILE 0190.00 ACCOUNTS-REC-REGISTER 0191.00 0192.00 STOP RUN 0193.00 . 0194.00 *********************************************** 0195.00 0196.00 100-INITIALIZE-VARIABLE-FIELDS. 0197.00 SET S1-NOT-END-OF-FILE TO TRUE 0198.00 0199.00 MOVE RC-LINES-PER-PAGE TO RC-LINES-USED 0200.00 0201.00 INITIALIZE RC-PAGE-COUNT 0202.00 AC-ACCUMULATORS 0203.00 0204.00 ACCEPT WA-DATE-WORK FROM DATE 0205.00 MOVE WA-DATE-WORK(3:2) TO H1-MONTH 0206.00 MOVE WA-DATE-WORK(5:2) TO H1-DAY 0207.00 MOVE WA-DATE-WORK(1:2) TO H1-YEAR 0208.00 . 0209.00 0210.00 200-PROCESS-CUSTOMER-RECORD. 0211.00 IF RC-LINES-USED *= RC-LINES-PER-PAGE 0212.00 PERFORM 870-PRINT-REPORT-HEADINGS 0213.00 END-IF 0214.00 0215.00 MOVE CR-CUSTOMER-NUMBER TO AR-CUSTOMER-NUMBER 0216.00 MOVE CR-CUSTOMER-NAME TO AR-CUSTOMER-NAME 0217.00 MOVE CR-BALANCE-FORWARD TO AR-BALANCE-FORWARD 0218.00 MOVE CR-PAYMENTS-RECEIVED TO AR-PAYMENTS-RECEIVED 0219.00 PERFORM 210-CALCULATE-FINANCE-CHARGE 0220.00 MOVE WA-FINANCE-CHARGE TO AR-FINANCE-CHARGE 0221.00 0222.00 PERFORM 220-CALCULATE-LATE-CHARGE 0223.00 MOVE WA-LATE-CHARGE TO AR-LATE-CHARGE 0224.00 MOVE CR-NEW-PURCHASES TO AR-NEW-PURCHASES 0225.00 0226.00 PERFORM 230-CALCULATE-NEW-BALANCE 0227.00 MOVE WA-NEW-BALANCE TO AR-NEW-BALANCE 0228.00 0229.00 PERFORM 240-CALCULATE-MINIMUM-PAYMENT 0230.00 MOVE WA-MINIMUM-PAYMENT TO AR-MINIMUM-PAYMENT 0231.00 0232.00 PERFORM 250-DETERMINE-ACCOUNT-STATUS 0233.00 0234.00 MOVE AR-ACCOUNTS-REC-LINE TO ACCOUNTS-REC-LINE-RECORD 0235.00 MOVE 2 TO RC-LINE-SPACING 0236.00 PERFORM 890-WRITE-REPORT-LINE 0237.00 0238.00 ADD CR-BALANCE-FORWARD TO AC-TOTAL-BALANCE-FORWARD-ACCU 0239.00 ADD CR-PAYMENTS-RECEIVED TO AC-TOTAL-PAYMENTS-RECVD-ACCUM 0240.00 ADD WA-FINANCE-CHARGE TO AC-TOTAL-FINANCE-CHARGE-ACCUM 0241.00 ADD WA-LATE-CHARGE TO AC-TOTAL-LATE-CHARGE-ACCUM 0242.00 ADD CR-NEW-PURCHASES TO AC-TOTAL-NEW-PURCHASES-ACCUM 0243.00 ADD WA-NEW-BALANCE TO AC-TOTAL-NEW-BALANCE-ACCUM 0244.00 ADD WA-MINIMUM-PAYMENT TO AC-TOTAL-MINIMUM-PAYMENT-ACCU 0245.00 . 0246.00 0247.00 210-CALCULATE-FINANCE-CHARGE. 0248.00 SUBTRACT CR-PAYMENTS-RECEIVED FROM CR-BALANCE-FORWARD 0249.00 GIVING WA-NEW-BALANCE 0250.00 0251.00 IF WA-NEW-BALANCE IS POSITIVE 0252.00 MULTIPLY WA-NEW-BALANCE BY .015 0253.00 GIVING WA-FINANCE-CHARGE ROUNDED 0254.00 ELSE 0255.00 MOVE ZERO TO WA-FINANCE-CHARGE 0256.00 END-IF 0257.00 . 0258.00 0259.00 220-CALCULATE-LATE-CHARGE. 0260.00 IF CR-BALANCE-FORWARD IS POSITIVE 0261.00 0262.00 MULTIPLY CR-BALANCE-FORWARD BY .10 0263.00 GIVING WA-MINIMUM-PAYMENT-WORK ROUNDED 0264.00 0265.00 SUBTRACT CR-PAYMENTS-RECEIVED 0266.00 FROM WA-MINIMUM-PAYMENT-WORK 0267.00 0268.00 ELSE 0269.00 MOVE ZERO TO WA-MINIMUM-PAYMENT-WORK 0270.00 END-IF 0271.00 0272.00 IF WA-MINIMUM-PAYMENT-WORK IS POSITIVE 0273.00 MULTIPLY WA-MINIMUM-PAYMENT-WORK BY .01 0274.00 GIVING WA-LATE-CHARGE ROUNDED 0275.00 ELSE 0276.00 MOVE ZEROS TO WA-LATE-CHARGE 0277.00 END-IF 0278.00 0279.00 IF WA-LATE-CHARGE IS GREATER THAN ZERO 0280.00 AND WA-LATE-CHARGE IS LESS THAN 5.00 0281.00 MOVE 5.00 TO WA-LATE-CHARGE 0282.00 END-IF 0283.00 . 0284.00 0285.00 230-CALCULATE-NEW-BALANCE. 0286.00 ADD WA-FINANCE-CHARGE WA-LATE-CHARGE CR-NEW-PURCHASES 0287.00 TO WA-NEW-BALANCE 0288.00 . 0289.00 0290.00 240-CALCULATE-MINIMUM-PAYMENT. 0291.00 IF WA-NEW-BALANCE IS POSITIVE 0292.00 MULTIPLY WA-NEW-BALANCE BY .10 0293.00 GIVING WA-MINIMUM-PAYMENT ROUNDED 0294.00 ELSE 0295.00 MOVE ZERO TO WA-MINIMUM-PAYMENT 0296.00 END-IF 0297.00 . 0298.00 0299.00 250-DETERMINE-ACCOUNT-STATUS. 0300.00 EVALUATE TRUE 0301.00 WHEN WA-NEW-BALANCE IS ZERO 0302.00 OR WA-NEW-BALANCE IS NEGATIVE 0303.00 MOVE SPACES TO AR-ACCOUNT-STATUS 0304.00 0305.00 WHEN CR-BALANCE-FORWARD IS NOT ZERO 0306.00 AND CR-PAYMENTS-RECEIVED IS ZERO 0307.00 MOVE “PAST DUE” TO AR-ACCOUNT-STATUS 0308.00 0309.00 WHEN WA-MINIMUM-PAYMENT-WORK IS POSITIVE 0310.00 MOVE “OVERDUE ” TO AR-ACCOUNT-STATUS 0311.00 0312.00 WHEN OTHER 0313.00 MOVE “CURRENT ” TO AR-ACCOUNT-STATUS 0314.00 END-EVALUATE 0315.00 . 0316.00 0317.00 700-PRINT-TOTAL-LINES. 0318.00 MOVE AC-TOTAL-BALANCE-FORWARD-ACCUM 0319.00 TO RT1-TOTAL-BALANCE-FORWARD 0320.00 MOVE AC-TOTAL-FINANCE-CHARGE-ACCUM 0321.00 TO RT1-TOTAL-FINANCE-CHARGE 0322.00 MOVE AC-TOTAL-NEW-PURCHASES-ACCUM 0323.00 TO RT1-TOTAL-NEW-PURCHASES 0324.00 MOVE AC-TOTAL-MINIMUM-PAYMENT-ACCUM 0325.00 TO RT1-TOTAL-MINIMUM-PAYMENT 0326.00 0327.00 MOVE RT1-TOTAL-LINE TO ACCOUNTS-REC-LINE-RECORD 0328.00 MOVE 3 TO RC-LINE-SPACING 0329.00 PERFORM 890-WRITE-REPORT-LINE 0330.00 0331.00 MOVE AC-TOTAL-PAYMENTS-RECVD-ACCUM 0332.00 TO RT2-TOTAL-PAYMENTS-RECEIVED 0333.00 MOVE AC-TOTAL-LATE-CHARGE-ACCUM 0334.00 TO RT2-TOTAL-LATE-CHARGE 0335.00 MOVE AC-TOTAL-NEW-BALANCE-ACCUM 0336.00 TO RT2-TOTAL-NEW-BALANCE 0337.00 0338.00 MOVE RT2-TOTAL-LINE TO ACCOUNTS-REC-LINE-RECORD 0339.00 MOVE 1 TO RC-LINE-SPACING 0340.00 PERFORM 890-WRITE-REPORT-LINE 0341.00 . 0342.00 0343.00 870-PRINT-REPORT-HEADINGS. 0344.00 ADD 1 TO RC-PAGE-COUNT 0345.00 MOVE RC-PAGE-COUNT TO H1-PAGE-NBR 0346.00 MOVE H1-HEADING-LINE-1 TO ACCOUNTS-REC-LINE-RECORD 0347.00 PERFORM 880-WRITE-REPORT-TOP-LINE 0348.00 0349.00 MOVE H2-HEADING-LINE-2 TO ACCOUNTS-REC-LINE-RECORD 0350.00 MOVE 2 TO RC-LINE-SPACING 0351.00 PERFORM 890-WRITE-REPORT-LINE 0352.00 0353.00 MOVE H3-HEADING-LINE-3 TO ACCOUNTS-REC-LINE-RECORD 0354.00 MOVE 1 TO RC-LINE-SPACING 0355.00 PERFORM 890-WRITE-REPORT-LINE 0356.00 . 0357.00 0358.00 880-WRITE-REPORT-TOP-LINE. 0359.00 WRITE ACCOUNTS-REC-LINE-RECORD 0360.00 AFTER ADVANCING PAGE 0361.00 MOVE 1 TO RC-LINES-USED 0362.00 . 0363.00 0364.00 890-WRITE-REPORT-LINE. 0365.00 WRITE ACCOUNTS-REC-LINE-RECORD 0366.00 AFTER ADVANCING RC-LINE-SPACING LINES 0367.00 ADD RC-LINE-SPACING TO RC-LINES-USED 0368.00 . ****************** End of data |