× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



[ Converted text/html to text/plain ]

Everyone,

If you really want a good laugh, please read below. But if you dont want to do
this, please let me know. I am about ready to throw my computer monitor across
the room really hard.

This is my current source code listing that includes headings and detail
lines. All I did was to copy the source member from my existing previous code,
which is also listed below, then I added the information for the current date,
headings and detail lines.

But for the darn of me (Leif, you can start laughing please) I cannot figure
out why these errors are comming up, since I didnt change the values for these
items. Did I lose something along the way? Am I misinterpreting something
wrong?

I hope that in this case I didnt go a stray from your wonderful teachings
Leif. Any input would be greatly welcomed here.

Throughly dazed and confused on this one.

        *************** Beginning of data
*************************************
0001.00        PROCESS APOST.
0002.00
0003.00        IDENTIFICATION DIVISION.
0004.00
0005.00        PROGRAM-ID. CHPT0404.
0006.00
0007.00       ************************************************************
0008.00       *                                                          *
0009.00       *  The Ligh-Em-Up Utility Company has requested we create  *
0010.00       *  a program that reads the Customer Usage File containing *
0011.00       *  customer records for electricity and gas consumption.   *
0012.00       *                                                          *
0013.00       *  The following items will be displayed in the printed    *
0014.00       *  report of the Customer Usage Report:                    *
0015.00       *                                                          *
0016.00       *  1. Account Number                                       *
0017.00       *  2. First & Last Name                                    *
0018.00       *  3. Electricity & Gas Used                               *
0019.00       *  4. Electricity & Gas Bill                               *
0020.00       *                                                          *
0021.00       *  This newly created program will include the use of      *
0022.00       *  detail and heading lines.                               *
0023.00       *                                                          *
0024.00       ************************************************************
0025.00
0026.00        ENVIRONMENT DIVISION.
0027.00
0028.00        INPUT-OUTPUT SECTION.
0029.00
0030.00        FILE-CONTROL.
0031.00             SELECT CUSTOMER-USAGE-FILE
0032.00                 ASSIGN TO DISK-CUSTUSAGPF.
0033.00
0034.00             SELECT CUSTOMER-USAGE-REPORT
0035.00                 ASSIGN TO PRINTER-QPRINT.
0036.00
0037.00        DATA DIVISION.
0038.00
0039.00        FILE SECTION.
0040.00
0041.00        FD  CUSTOMER-USAGE-FILE.
0042.00
0043.00        01  CUSTOMER-USAGE-RECORD.
0044.00            05  CU-ACCOUNT-NUMBER           PIC 9(05).
0045.00            05  CU-FIRST-NAME               PIC X(10).
0046.00            05  CU-LAST-NAME                PIC X(15).
0047.00            05  CU-STREET-ADDRESS           PIC X(20).
0048.00            05  CU-ELECT-USED               PIC 9(05)
PACKED-DECIMAL.
0049.00            05  CU-GAS-USED                 PIC 9(05)
PACKED-DECIMAL.
0050.00            05  CU-ELECT-BILL               PIC 9(05)V99
PACKED-DECIMAL.
0051.00            05  CU-GAS-BILL                 PIC 9(05)V99
PACKED-DECIMAL.
0052.00
0053.00        FD  CUSTOMER-USAGE-REPORT.
0054.00
0055.00        01  PRINT-RECORD-OUT                PIC X(80).
0056.00
0057.00        WORKING-STORAGE SECTION.
0058.00
0059.00        01  WS-CONTROL-FIELDS.
0060.00            05  ARE-THERE-MORE-RECORDS      PIC X(03)  VALUE 'YES'.
0061.00            05  WS-LINE-COUNTER             PIC 9(03)  PACKED-DECIMAL
0062.00                                                       VALUE 60.
0063.00            05  WS-LINE-LIMIT               PIC 9(03)  PACKED-DECIMAL
0064.00                                                       VALUE 60.
0065.00            05  WS-PAGE-COUNTER             PIC 9(03)  PACKED-DECIMAL
0066.00                                                       VALUE ZERO.
0067.00        01  WS-CURRENT-DATE.
0068.00            05  WS-CURRENT-YEAR             PIC 9(04).
0069.00            05  WS-CURRENT-MONTH            PIC 9(02).
0070.00            05  WS-CURRENT-DAY              PIC 9(02).
0071.00
0072.00        01  HEADING-1.
0073.00            05  HL-CURRENT-MONTH            PIC 9(02).
0074.00            05                              PIC X      VALUE '/'.
0075.00            05  HL-CURRENT-DAY              PIC 9(02).
0076.00            05                              PIC X      VALUE '/'.
0077.00            05  HL-CURRENT-YEAR             PIC 9(04).
0078.00            05                              PIC X(04).
0079.00            05                              PIC X(41)
0080.00                  VALUE 'CUSTOMER ELECTRICITY AND GAS USAGE REPORT'.
0081.00            05                              PIC X(09).
0082.00            05                              PIC X(04)  VALUE 'PAGE'.
0083.00            05                              PIC X(01).
0084.00            05  HL-PAGE                     PIC Z9     VALUE ZERO.
0085.00
0086.00        01  HEADING-2.
0087.00            05                              PIC X(05).
0088.00            05                              PIC X(07)  VALUE 'ACCOUNT'.
0089.00            05                              PIC X(30).
0090.00            05                              PIC X(05)  VALUE 'ELECT'.
0091.00            05                              PIC X(05).
0092.00            05                              PIC X(05)  VALUE 'ELECT'.
0093.00            05                              PIC X(07).
0094.00            05                              PIC X(03)  VALUE 'GAS'.
0095.00            05                              PIC X(06).
0096.00            05                              PIC X(03)  VALUE 'GAS'.
0097.00            05                              PIC X(04).
0098.00
0099.00        01  HEADING-3.
0100.00            05                              PIC X(05).
0101.00            05                              PIC X(06)  VALUE 'NUMBER'.
0102.00            05                              PIC X(03).
0103.00            05                              PIC X(13)
0104.00                                            VALUE 'CUSTOMER NAME'.
0105.00            05                              PIC X(16).
0106.00            05                              PIC X(04)  VALUE 'USED'.
0107.00            05                              PIC X(06).
0108.00            05                              PIC X(04)  VALUE 'BILL'.
0109.00            05                              PIC X(07).
0110.00            05                              PIC X(04)  VALUE 'USED'.
0111.00            05                              PIC X(05).
0112.00            05                              PIC X(04)  VALUE 'BILL'.
0113.00            05                              PIC X(03).
0114.00
0115.00         01 DETAIL-LINE.
0116.00            05                              PIC X(05).
0117.00            05  DL-ACCOUNT-NUMBER           PIC Z(05).
0118.00            05                              PIC X(04).
0119.00            05  DL-FIRST-NAME               PIC X(10).
0120.00            05                              PIC X(01).
0121.00            05  DL-LAST-NAME                PIC X(15).
0122.00            05                              PIC X(02).
0123.00            05  DL-ELECT-USED               PIC ZZ,ZZ9.
0124.00            05                              PIC X(03).
0125.00            05  DL-ELECT-BILL               PIC $,$$$.99.
0126.00            05                              PIC X(03).
0127.00            05  DL-GAS-USED                 PIC ZZ,ZZ9.
0128.00            05                              PIC X(03).
0129.00            05  DL-GAS-BILL                 PIC $,$$$.99.
0130.00
0131.00        PROCEDURE DIVISION.
0132.00
0133.00        000-MAIN-MODULE.
0134.00
0135.00            OPEN INPUT  CUSTOMER-USAGE-FILE
0136.00                 OUTPUT CUSTOMER-USAGE-REPORT.
0137.00
0138.00            ACCEPT WS-CURRENT-DATE FROM DATE.
0139.00            MOVE WS-CURRENT-MONTH TO HL-CURRENT-MONTH.
0140.00            MOVE WS-CURRENT-DAY TO HL-CURRENT-DAY.
0141.00            MOVE WS-CURRENT-YEAR TO HL-CURRENT-YEAR.
0142.00
0143.00            READ CUSTOMER-USAGE-FILE
0144.00                AT END
0145.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0146.00            END-READ
0147.00
0148.00            PERFORM 200-PROCESS-RECORD-RTN
0149.00                UNTIL ARE-THERE-MORE-RECORDS = 'NO '.
0150.00
0151.00            CLOSE CUSTOMER-USAGE-FILE
0152.00                  CUSTOMER-USAGE-REPORT.
0153.00
0154.00            STOP RUN.
0155.00
0156.00        200-PROCESS-RECORD-RTN.
0157.00
0158.00            MOVE CU-ACCOUNT-NUMBER TO DL-ACCOUNT-NUMBER.
0159.00            MOVE CU-FIRST-NAME TO DL-FIRST-NAME.
0160.00            MOVE CU-LAST-NAME TO DL-LAST-NAME.
0161.00            MOVE CU-ELECT-USED TO DL-ELECT-USED.
0162.00            MOVE CU-GAS-USED TO DL-GAS-USED.
0163.00            MOVE CU-ELECT-BILL TO DL-ELECT-BILL.
0164.00            MOVE CU-GAS-BILL TO DL-GAS-BILL.
0165.00
0166.00            IF WS-LINE-COUNTER >= WS-LINE-LIMIT
0167.00                PERFORM 210-HEADING-RTN
0168.00            END-IF
0169.00
0170.00            WRITE PRINT-RECORD-OUT FROM DETAIL-LINE
0171.00                AFTER ADVANCING 1 LINE.
0172.00            ADD 1 TO WS-LINE-COUNTER.
0173.00
0174.00            READ CUSTOMER-USAGE-FILE
0175.00                AT END
0176.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0177.00            END-READ.
0178.00
0179.00        210-HEADING-RTN.
0180.00            ADD 1 TO WS-PAGE-COUNTER.
0181.00            MOVE WS-PAGE-COUNTER TO HL-PAGE.
0182.00            WRITE PRINT-RECORD-OUT FROM HEADING-1
0183.00                AFTER ADVANCING PAGE.
0184.00            WRITE PRINT-RECORD-OUT FROM HEADING-2
0185.00                AFTER ADVANCING 1 LINE.
0186.00            WRITE PRINT-RECORD-OUT FROM HEADING-3
0187.00                AFTER ADVANCING 1 LINE.
0188.00            MOVE SPACES TO PRINT-RECORD-OUT.
0189.00            WRITE PRINT-RECORD-OUT
0190.00                AFTER ADVANCING 1 LINE.
0191.00            MOVE 5 TO WS-LINE-COUNTER.
        ****************** End of data
****************************************

This is the dump from running the program.

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+...
 MCH1202 exception in program CHPT0404 in TUBBS at MI instruction number 006F
COBOL statement number 97.
 Last I-O operation was at statement 94.
 LBE7903-Information pertaining to file CUSTOMER-USAGE-FILE.
 LBE7905-File is open.
 LBE7906-Last I-O operation completed for file was OPEN.
 LBE7907-Last file status for file was 00.
 LBE7910-Last extended file status for file was ****.
 LBE7903-Information pertaining to file CUSTOMER-USAGE-REPORT.
 LBE7905-File is open.
 LBE7906-Last I-O operation completed for file was OPEN.
 LBE7907-Last file status for file was 00.
 LBE7910-Last extended file status for file was ****.
 FORMATTED DATA DUMP FOR PROGRAM CHPT0404.TUBBS            19:51:36    08/02/0
 NAME                   OFFSET  ATTRIBUTES    VALUE
 ARE-THERE-MORE-RECORDS 000B80  CHAR(3)       'YES'
 CU-ACCOUNT-NUMBER      000020  ZONED(5,0)
                             **INVALID DATA  '4040404040'X
CU-ELECT-BILL          000058  PACKED(7,2)
                             **INVALID DATA  '40404040'X
CU-ELECT-USED          000052  PACKED(5,0)
                             **INVALID DATA  '404040'X
CU-FIRST-NAME          000025  CHAR(10)      '          '
CU-GAS-BILL            00005C  PACKED(7,2)
                             **INVALID DATA  '40404040'X
CU-GAS-USED            000055  PACKED(5,0)
                             **INVALID DATA  '404040'X
CU-LAST-NAME           00002F  CHAR(15)      '               '
CU-STREET-ADDRESS      00003E  CHAR(20)      '                    '
CUSTOMER-USAGE-FILE    000020  CHAR(64)      '
CUSTOMER-USAGE-RECORD  000020  CHAR(64)      '
CUSTOMER-USAGE-REPORT  000020  CHAR(80)      '
                       000020  VALUE IN HEX  '0000000000000000000000000000000
                              **INVALID DATA  '4040404040'X
 CU-ELECT-BILL          000058  PACKED(7,2)
                              **INVALID DATA  '40404040'X
 CU-ELECT-USED          000052  PACKED(5,0)
                              **INVALID DATA  '404040'X
 CU-FIRST-NAME          000025  CHAR(10)      '          '
 CU-GAS-BILL            00005C  PACKED(7,2)
                              **INVALID DATA  '40404040'X
 CU-GAS-USED            000055  PACKED(5,0)
                              **INVALID DATA  '404040'X
 CU-LAST-NAME           00002F  CHAR(15)      '               '
 CU-STREET-ADDRESS      00003E  CHAR(20)      '                    '
 HEADING-2              000BF0  CHAR(80)      '     ACCOUNT
HEADING-3              000C40  CHAR(80)      '     NUMBER   CUSTOMER NAME
HL-CURRENT-DAY         000BA3  ZONED(2,0)
                             **INVALID DATA  '4040'X
HL-CURRENT-MONTH       000BA0  ZONED(2,0)    2
HL-CURRENT-YEAR        000BA6  ZONED(4,0)
                             **INVALID DATA  '40404040'X
HL-PAGE                000BE5  CHAR(2)       '00'
PRINT-RECORD-OUT       000020  CHAR(80)      '

This is my original source code, below:

        *************** Beginning of data
*************************************
0001.00        PROCESS APOST.
0002.00
0003.00        IDENTIFICATION DIVISION.
0004.00
0005.00        PROGRAM-ID. CHPT0304.
0006.00
0007.00       ************************************************************
0008.00       *                                                          *
0009.00       *  The Ligth-Em-Up Utility Company has requested we create *
0010.00       *  a program that reads the Customer Usage File containing *
0011.00       *  customer records for electricity and gas consumption.   *
0012.00       *                                                          *
0013.00       *   The following items will be displayed in the printed   *
0014.00       *   output of the Customer Usage Report:                   *
0015.00       *                                                          *
0016.00       *   1. Account Number                                      *
0017.00       *   2. First & Last Name                                   *
0018.00       *   3. Electricity & Gas Used                              *
0019.00       *   4. Electricity & Gas Bill                              *
0020.00       *                                                          *
0021.00       ************************************************************
0022.00
0023.00        ENVIRONMENT DIVISION.
0024.00
0025.00        INPUT-OUTPUT SECTION.
0026.00
0027.00        FILE-CONTROL.
0028.00             SELECT CUSTOMER-USAGE-FILE
0029.00                 ASSIGN TO DISK-CUSTUSAGPF.
0030.00
0031.00             SELECT CUSTOMER-USAGE-REPORT
0032.00                 ASSIGN TO PRINTER-QPRINT.
0033.00
0034.00        DATA DIVISION.
0035.00
0036.00        FILE SECTION.
0037.00
0038.00        FD  CUSTOMER-USAGE-FILE
0039.00                RECORD CONTAINS 64 CHARACTERS.
0040.00
0041.00        01  CUSTOMER-USAGE-RECORD.
0042.00            05  CU-ACCOUNT-NUMBER           PIC 9(05).
0043.00            05  CU-FIRST-NAME               PIC X(10).
0044.00            05  CU-LAST-NAME                PIC X(15).
0045.00            05  CU-STREET-ADDRESS           PIC X(20).
0046.00            05  CU-ELECT-USED               PIC 9(05)
PACKED-DECIMAL.
0047.00            05  CU-GAS-USED                 PIC 9(05)
PACKED-DECIMAL.
0048.00            05  CU-ELECT-BILL               PIC 9(05)V99
PACKED-DECIMAL.
0049.00            05  CU-GAS-BILL                 PIC 9(05)V99
PACKED-DECIMAL.
0050.00
0051.00        FD  CUSTOMER-USAGE-REPORT
0052.00                RECORD CONTAINS 81 CHARACTERS.
0053.00
0054.00        01  PRINT-RECORD-OUT.
0055.00            05                              PIC X(05).
0056.00            05  DL-ACCOUNT-NUMBER           PIC Z(05).
0057.00            05                              PIC X(04).
0058.00            05  DL-FIRST-NAME               PIC X(10).
0059.00            05                              PIC X(01).
0060.00            05  DL-LAST-NAME                PIC X(15).
0061.00            05                              PIC X(02).
0062.00            05  DL-ELECT-USED               PIC ZZ,ZZ9.
0063.00            05                              PIC X(03).
0064.00            05  DL-ELECT-BILL               PIC $,$$$.99.
0065.00            05                              PIC X(03).
0066.00            05  DL-GAS-USED                 PIC ZZ,ZZ9.
0067.00            05                              PIC X(03).
0068.00            05  DL-GAS-BILL                 PIC $,$$$.99.
0069.00
0070.00        WORKING-STORAGE SECTION.
0071.00
0072.00        01  WS-CONTROL-FIELDS.
0073.00            05  ARE-THERE-MORE-RECORDS      PIC X(3)    VALUE 'YES'.
0074.00
0075.00        PROCEDURE DIVISION.
0076.00
0077.00        000-MAIN-MODULE.
0078.00
0079.00            OPEN INPUT  CUSTOMER-USAGE-FILE
0080.00                 OUTPUT CUSTOMER-USAGE-REPORT.
0081.00
0082.00            READ CUSTOMER-USAGE-FILE
0083.00                AT END
0084.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0085.00            END-READ
0086.00            PERFORM 200-PROCESS-RECORD-RTN
0087.00                UNTIL ARE-THERE-MORE-RECORDS = 'NO '.
0088.00
0089.00            CLOSE CUSTOMER-USAGE-FILE
0090.00                  CUSTOMER-USAGE-REPORT.
0091.00
0092.00            STOP RUN.
0093.00
0094.00        200-PROCESS-RECORD-RTN.
0095.00
0096.00            MOVE SPACES TO PRINT-RECORD-OUT.
0097.00            MOVE CU-ACCOUNT-NUMBER TO DL-ACCOUNT-NUMBER.
0098.00            MOVE CU-FIRST-NAME TO DL-FIRST-NAME.
0099.00            MOVE CU-LAST-NAME TO DL-LAST-NAME.
0100.00            MOVE CU-ELECT-USED TO DL-ELECT-USED.
0101.00            MOVE CU-ELECT-BILL TO DL-ELECT-BILL.
0102.00            MOVE CU-GAS-USED TO DL-GAS-USED.
0103.00            MOVE CU-GAS-BILL TO DL-GAS-BILL.
0104.00            WRITE PRINT-RECORD-OUT.
0105.00            READ CUSTOMER-USAGE-FILE
0106.00                AT END
0107.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0108.00            END-READ.
        ****************** End of data
****************************************

Physical File:

        *************** Beginning of data
*************************************
0001.00       ***********************************************************
0002.00       *                Customer Usage File                      *
0003.00       *             Physical File -- CUSTUSAGPF                 *
0004.00       *           Key Sequence - Account Number                 *
0005.00       ***********************************************************
0006.00
0007.00                                             UNIQUE
0008.00      A          R CUSTUSAGR                 TEXT('Customer Usage
Record')
0009.00      A            ACCTNUMBER     5S 0       ALIAS(CU_ACCOUNT_NUMBER)
0010.00      A            FIRSTNAME     10A         ALIAS(CU_FIRST_NAME)
0011.00      A            LASTNAME      15A         ALIAS(CU_LAST_NAME)
0012.00      A            STREETADDR    20A         ALIAS(CU_STREET_ADDRESS)
0013.00      A            ELECTUSED      5P 0       ALIAS(CU_ELECT_USED)
0014.00      A            GASUSED        5P 0       ALIAS(CU_GAS_USED)
0015.00      A            ELECTBILL      7P 2       ALIAS(CU_ELECT_BILL)
0016.00      A            GASBILL        7P 2       ALIAS(CU_GAS_BILL)
0017.00      A          K ACCTNUMBER
        ****************** End of data
****************************************



Printed Output:

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+
     12345    Yanni      Lostly            1,204    $456.00      984
$654.00
     54687    Paul       Winters           9,874     $15.04      845
$2.47

  --

_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com[1]

Get 4 DVDs for $.49 cents! plus shipping & processing.Click to join[2].

===References:===
  1. http://www.mail.com/?sr=signup
  2. http://adfarm.mediaplex.com/ad/ck/990-1736-3566-59



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.