× 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.



Hi Eric,

You may already have the answer to this, but if not.

In your paragraph 200-PROCESS-RECORD-RTN, you check to see what the line
counter is, and if its greater than or equal to the line limit, you execute
paragraph 210-HEADING-RTN, which writes out the name and address:-
0141.00        210-HEADING-RTN.
0142.00            ADD 1 TO WS-PAGE-COUNTER.
0143.00            MOVE WS-PAGE-COUNTER TO HL-PAGE.
0144.00            WRITE PRINT-RECORD-OUT FROM HEADING-1
0145.00               AFTER ADVANCING PAGE.
0146.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0147.00               AFTER ADVANCING 1 LINE.
0148.00            WRITE PRINT-RECORD-OUT FROM STREET-LABEL
0149.00               AFTER ADVANCING 1 LINE.
0150.00            WRITE PRINT-RECORD-OUT FROM ADDRESS-LABEL
0151.00               AFTER ADVANCING 1 LINE.
0152.00            MOVE SPACES TO PRINT-RECORD-OUT.
0153.00            WRITE PRINT-RECORD-OUT
0154.00               AFTER ADVANCING 2 LINES.
0155.00            MOVE 5 TO WS-LINE-COUNTER.

Your program then comes back to 200-Process-Record-RTN and executes the
following line:
0132.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0133.00                AFTER ADVANCING 1 LINE.
0134.00            ADD 1 TO WS-LINE-COUNTER.
0135.00

Because you haven't reread the customer file, the value in NAME-LABEL
hasn't changed.  Next time through this paragraph, you have read the file,
and hence you get a different name (Jane Doe).  The remainder of Janes
address is not being printed, because the address details are being written
in the 210....... paragraph, which is only executed when the line counter
gets to 60.

Hope this helps,

JP



                    "Eric Tubbs"
                    <eatubbs@email.com>       To:     cobol400-l@midrange.com
                    Sent by:                  cc:
                    cobol400-l-admin@mi       Subject:     Strange Output - 
Would Like Advice
                    drange.com                 Please


                    17/08/2002 00:41
                    Please respond to
                    cobol400-l






This is a multi-part message in MIME format...
--
Hello,

Today, I am writing you all to ask your input on one of my programs, that I
had modified form an existing program, which does work.

I am on the OS/400 V4R4, COBOL source member CBLLE:

The output of the first program is the original program, with its output
correct, per the specifications of this exercise; even though the comma
looks funny (I know now how to fix this command error, its in a later
chapter).

This is the output of the original program: (the numbers to the right of
the display show the vertical line spacing positions):

                             Display Spooled File
File  . . . . . :   QPRINT                           Page/Line   1/2
Control . . . . .                                    Columns     1 - 78
Find  . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+
          Tommy Trans                           2
          456 Vamp Ln                           3
          Roche          , NB  45678            3
          Jane Doe                              7
          666 Dead Zone                         8
          Rancho         , AZ  89567            9


This is the output of the second program: (the numbers to the right of the
display show the vertical line spacing positions):

                        Display Spooled File
File  . . . . . :   QPRINT                           Page/Line   2/1
Control . . . . .                                    Columns     1 - 78
Find  . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+
08/16/2002    MAILING LIST           PAGE  1         1
          Tommy Trans                                2
          456 Vamp Ln                                3
          Roche          , NB  45678                 4
          Tommy Trans                                7
          Jane Doe                                      8


What I am attempting to resolve: Why is Tommy Trans name being repeated?
And since his name and not the rest of the address is being repeated, why
doesnt the rest of it do the same? And why is Jane Doe not being displayed
properly?

If somebody would please shed some light on this subject, I would
appreciate it. What I have done is gone through my resulting code and have
changed numberous parameters and nothing seems to work. Maybe I am missing
a big step here or something similar. I didnt think it would be this
difficult by adding a few extra lines of code into this new program, but I
guess it messes it up pretty darn good.

I have included source code for both programs. The first source code
listing is the original program; the second listing is the second program.

I have attempted to attach a text file in case the output of this posting
doesnt fair to well in the transition.

For me my quarter is almost over, but luckily I am going to repeat this
COBOL class before I move onto the advanced course being offered. I havent
been able to master enough basic skills yet.

I do not know the best way to ask you all for help. Hopefully, by asking
you all for guidance instead of just asking for the code outright would be
a better way (guidance). What would be your reactions to this?

Thanks for all of your help,

Eric


Original Program Source Code Listing:

        *************** Beginning of data
*************************************
0001.00        PROCESS APOST.
0002.00
0003.00        IDENTIFICATION DIVISION.
0004.00
0005.00        PROGRAM-ID. CHPT0303.
0006.00
0007.00       ************************************************************
0008.00       *                                                          *
0009.00       *  This program reads the Customer Address File and will   *
0010.00       *  print a Customer Mailing List containing the following  *
0011.00       *  items in this order. Each complete record will have two *
0012.00       *  spaces before the next complete record starts.          *
0013.00       *                                                          *
0014.00       *   1. Customer Name                                       *
0015.00       *   2. Street Address                                      *
0016.00       *   3. City, State, Zip                                    *
0017.00       *                                                          *
0018.00       ************************************************************
0019.00
0020.00        ENVIRONMENT DIVISION.
0021.00
0022.00        INPUT-OUTPUT SECTION.
0023.00
0024.00        FILE-CONTROL.
0025.00             SELECT CUSTOMER-ADDRESS-FILE
0026.00                 ASSIGN TO DISK-CUSTADDRPF.
0027.00
0028.00             SELECT CUSTOMER-MAILING-LIST
0029.00                 ASSIGN TO PRINTER-QPRINT.
0030.00
0031.00        DATA DIVISION.
0032.00
0033.00        FILE SECTION.
0034.00
0035.00        FD  CUSTOMER-ADDRESS-FILE.
0036.00
0037.00        01  CUSTOMER-ADDRESS-DETAILS.
0038.00            05  CA-CUSTOMER-NAME            PIC X(20).
0039.00            05  STREET-NAME.
0040.00                10  CA-STREET-ADDRESS       PIC X(20).
0041.00            05  ADDRESS-FROM.
0042.00                10  CA-CITY                 PIC X(15).
0043.00                10  CA-STATE                PIC X(02).
0044.00                10  CA-ZIP-CODE             PIC 9(05).
0045.00
0046.00        FD  CUSTOMER-MAILING-LIST.
0047.00
0048.00        01  PRINT-RECORD-OUT                PIC X(80).
0049.00
0050.00        WORKING-STORAGE SECTION.
0051.00
0052.00        01  WS-CONTROL-FIELDS.
0053.00            05  ARE-THERE-MORE-RECORDS      PIC X(3)    VALUE 'YES'.
0054.00
0055.00        01  NAME-LABEL.
0056.00            05                              PIC X(10).
0057.00            05  DL-CUSTOMER-NAME            PIC X(20).
0058.00
0059.00        01  STREET-LABEL.
0060.00            05                              PIC X(10).
0061.00            05  DL-STREET-ADDRESS           PIC X(20).
0062.00
0063.00        01  ADDRESS-LABEL.
0064.00            05                              PIC X(10).
0065.00            05  DL-CITY                     PIC X(15).
0066.00            05                              PIC X      VALUE ','.
0067.00            05                              PIC X(01).
0068.00            05  DL-STATE                    PIC X(02).
0069.00            05                              PIC X(02).
0070.00            05  DL-ZIP-CODE                 PIC 9(05).
0071.00
0072.00        PROCEDURE DIVISION.
0073.00
0074.00        000-MAIN-MODULE.
0075.00
0076.00            OPEN INPUT  CUSTOMER-ADDRESS-FILE
0077.00                 OUTPUT CUSTOMER-MAILING-LIST.
0078.00
0079.00            READ CUSTOMER-ADDRESS-FILE
0080.00                AT END
0081.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0082.00            END-READ
0083.00            PERFORM 200-PROCESS-RECORD-RTN
0084.00                UNTIL ARE-THERE-MORE-RECORDS = 'NO '.
0085.00
0086.00            CLOSE CUSTOMER-ADDRESS-FILE
0087.00                  CUSTOMER-MAILING-LIST.
0088.00
0089.00            STOP RUN.
0090.00
0091.00        200-PROCESS-RECORD-RTN.
0092.00
0093.00            MOVE CA-CUSTOMER-NAME TO DL-CUSTOMER-NAME.
0094.00            MOVE CA-STREET-ADDRESS TO DL-STREET-ADDRESS.
0095.00            MOVE CA-CITY TO DL-CITY.
0096.00            MOVE CA-STATE TO DL-STATE.
0097.00            MOVE CA-ZIP-CODE TO DL-ZIP-CODE.
0098.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0099.00                 AFTER ADVANCING 1 LINE.
0100.00            WRITE PRINT-RECORD-OUT FROM STREET-LABEL
0101.00                 AFTER ADVANCING 1 LINE.
0102.00            WRITE PRINT-RECORD-OUT FROM ADDRESS-LABEL
0103.00                 AFTER ADVANCING 1 LINE.
0104.00            MOVE SPACES TO PRINT-RECORD-OUT.
0105.00            WRITE PRINT-RECORD-OUT
0106.00                 AFTER ADVANCING 2 LINE.
0107.00            READ CUSTOMER-ADDRESS-FILE
0108.00                AT END
0109.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0110.00            END-READ.
        ****************** End of data
****************************************

2nd Program Source Code Listing:

0001.00        PROCESS APOST.
0002.00
0003.00        IDENTIFICATION DIVISION.
0004.00
0005.00        PROGRAM-ID. CHPT0403.
0006.00
0007.00       ************************************************************
0008.00       *                                                          *
0009.00       *  This program reads the Customer Address File and will   *
0010.00       *  print a Customer Mailing List containing the following  *
0011.00       *  items in this order. Each complete record will have two *
0012.00       *  spaces before the next complete record starts.          *
0013.00       *                                                          *
0014.00       *   1. Customer Name                                       *
0015.00       *   2. Street Address                                      *
0016.00       *   3. City, State, Zip                                    *
0017.00       *                                                          *
0018.00       ************************************************************
0019.00
0020.00        ENVIRONMENT DIVISION.
0021.00
0022.00        INPUT-OUTPUT SECTION.
0023.00
0024.00        FILE-CONTROL.
0025.00             SELECT CUSTOMER-ADDRESS-FILE
0026.00                 ASSIGN TO DISK-CUSTADDRPF.
0027.00
0028.00             SELECT CUSTOMER-MAILING-LIST
0029.00                 ASSIGN TO PRINTER-QPRINT.
0030.00
0031.00        DATA DIVISION.
0032.00
0033.00        FILE SECTION.
0034.00
0035.00        FD  CUSTOMER-ADDRESS-FILE.
0036.00
0037.00        01  CUSTOMER-ADDRESS-DETAILS.
0038.00            05  CA-CUSTOMER-NAME            PIC X(20).
0039.00            05  STREET-NAME.
0040.00                10  CA-STREET-ADDRESS       PIC X(20).
0041.00            05  ADDRESS-FROM.
0042.00                10  CA-CITY                 PIC X(15).
0043.00                10  CA-STATE                PIC X(02).
0044.00                10  CA-ZIP-CODE             PIC 9(05).
0045.00
0046.00        FD  CUSTOMER-MAILING-LIST.
0047.00
0048.00        01  PRINT-RECORD-OUT                PIC X(80).
0049.00
0050.00        WORKING-STORAGE SECTION.
0051.00
0052.00        01  WS-CONTROL-FIELDS.
0053.00            05  ARE-THERE-MORE-RECORDS      PIC X(03)  VALUE 'YES'.
0054.00            05  WS-LINE-COUNTER             PIC 9(03)
PACKED-DECIMAL
0055.00                                                       VALUE 60.
0056.00            05  WS-LINE-LIMIT               PIC 9(03)
PACKED-DECIMAL
0057.00                                                       VALUE 60.
0058.00            05  WS-PAGE-COUNTER             PIC 9(03)
PACKED-DECIMAL
0059.00                                                      VALUE ZERO.
0060.00        01  WS-CURRENT-DATE.
0061.00            05  WS-CURRENT-YEAR             PIC 9(4).
0062.00            05  WS-CURRENT-MONTH            PIC 9(2).
0063.00            05  WS-CURRENT-DAY              PIC 9(2).
0064.00
0065.00        01  HEADING-1.
0066.00            05  HL-MONTH                    PIC 9(02).
0067.00            05                              PIC X      VALUE '/'.
0068.00            05  HL-DAY                      PIC 9(02).
0069.00            05                              PIC X      VALUE '/'.
0070.00            05  HL-YEAR                     PIC 9(04).
0071.00            05                              PIC X(04).
0072.00            05                              PIC X(15)
0073.00                                            VALUE 'MAILING LIST'.
0074.00            05                              PIC X(08).
0075.00            05                              PIC X(04)  VALUE 'PAGE'.
0076.00            05                              PIC X(01).
0077.00            05  HL-PAGE                     PIC Z9     VALUE ZERO.
0078.00
0079.00        01  NAME-LABEL.
0080.00            05                              PIC X(10).
0081.00            05  DL-CUSTOMER-NAME            PIC X(20).
0082.00
0083.00        01  STREET-LABEL.
0084.00            05                              PIC X(10).
0085.00            05  DL-STREET-ADDRESS           PIC X(20).
0086.00
0087.00        01  ADDRESS-LABEL.
0088.00            05                              PIC X(10).
0089.00            05  DL-CITY                     PIC X(15).
0090.00            05                              PIC X      VALUE ','.
0091.00            05                              PIC X(01).
0092.00            05  DL-STATE                    PIC X(02).
0093.00            05                              PIC X(02).
0094.00            05  DL-ZIP-CODE                 PIC 9(05).
0095.00
0096.00        PROCEDURE DIVISION.
0097.00
0098.00        000-MAIN-MODULE.
0099.00
0100.00            OPEN INPUT  CUSTOMER-ADDRESS-FILE
0101.00                 OUTPUT CUSTOMER-MAILING-LIST.
0102.00
0103.00            MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE.
0104.00            MOVE WS-CURRENT-MONTH TO HL-MONTH.
0105.00            MOVE WS-CURRENT-DAY TO HL-DAY.
0106.00            MOVE WS-CURRENT-YEAR TO HL-YEAR.
0107.00
0108.00            READ CUSTOMER-ADDRESS-FILE
0109.00                AT END
0110.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0111.00            END-READ
0112.00            PERFORM 200-PROCESS-RECORD-RTN
0113.00                UNTIL ARÈòÿ¿àÏE-THERE-MORE-RECORDS = 'NO '.
0114.00
0115.00            CLOSE CUSTOMER-ADDRESS-FILE
0116.00                  CUSTOMER-MAILING-LIST.
0117.00
0118.00            STOP RUN.
0119.00
0120.00        200-PROCESS-RECORD-RTN.
0121.00
0122.00            MOVE CA-CUSTOMER-NAME TO DL-CUSTOMER-NAME.
0123.00            MOVE CA-STREET-ADDRESS TO DL-STREET-ADDRESS.
0124.00            MOVE CA-CITY TO DL-CITY.
0125.00            MOVE CA-STATE TO DL-STATE.
0126.00            MOVE CA-ZIP-CODE TO DL-ZIP-CODE.
0127.00
0128.00            IF WS-LINE-COUNTER >= WS-LINE-LIMIT
0129.00                PERFORM 210-HEADING-RTN
0130.00            END-IF
0131.00
0132.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0133.00                AFTER ADVANCING 1 LINE.
0134.00            ADD 1 TO WS-LINE-COUNTER.
0135.00
0136.00            READ CUSTOMER-ADDRESS-FILE
0137.00                AT END
0138.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0139.00            END-READ.
0140.00
0141.00        210-HEADING-RTN.
0142.00            ADD 1 TO WS-PAGE-COUNTER.
0143.00            MOVE WS-PAGE-COUNTER TO HL-PAGE.
0144.00            WRITE PRINT-RECORD-OUT FROM HEADING-1
0145.00               AFTER ADVANCING PAGE.
0146.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0147.00               AFTER ADVANCING 1 LINE.
0148.00            WRITE PRINT-RECORD-OUT FROM STREET-LABEL
0149.00               AFTER ADVANCING 1 LINE.
0150.00            WRITE PRINT-RECORD-OUT FROM ADDRESS-LABEL
0151.00               AFTER ADVANCING 1 LINE.
0152.00            MOVE SPACES TO PRINT-RECORD-OUT.
0153.00            WRITE PRINT-RECORD-OUT
0154.00               AFTER ADVANCING 2 LINES.
0155.00            MOVE 5 TO WS-LINE-COUNTER.
        ****************** End of data
****************************************
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

--
Hello,

Today, I am writing you all to ask your input on one of my programs, that I
had modified form an existing program, which does work.

I am on the OS/400 V4R4, COBOL source member CBLLE:

The output of the first program is the original program, with its output
correct, per the specifications of this exercise; even though the comma
looks funny (I know now how to fix this command error, its in a later
chapter).

This is the output of the original program: (the numbers to the right of
the display show the vertical line spacing positions):

                             Display Spooled File
File  . . . . . :   QPRINT                           Page/Line   1/2
Control . . . . .                                    Columns     1 - 78
Find  . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+
          Tommy Trans                           2
          456 Vamp Ln                           3
          Roche          , NB  45678            3
          Jane Doe                              7
          666 Dead Zone                         8
          Rancho         , AZ  89567            9


This is the output of the second program: (the numbers to the right of the
display show the vertical line spacing positions):

                        Display Spooled File
File  . . . . . :   QPRINT                           Page/Line   2/1
Control . . . . .                                    Columns     1 - 78
Find  . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+
08/16/2002    MAILING LIST           PAGE  1         1
          Tommy Trans                                2
          456 Vamp Ln                                3
          Roche          , NB  45678                 4
          Tommy Trans                                7
          Jane Doe                                      8


What I am attempting to resolve: Why is Tommy Trans name being repeated?
And since his name and not the rest of the address is being repeated, why
doesnt the rest of it do the same? And why is Jane Doe not being displayed
properly?

If somebody would please shed some light on this subject, I would
appreciate it. What I have done is gone through my resulting code and have
changed numberous parameters and nothing seems to work. Maybe I am missing
a big step here or something similar. I didnt think it would be this
difficult by adding a few extra lines of code into this new program, but I
guess it messes it up pretty darn good.

I have included source code for both programs. The first source code
listing is the original program; the second listing is the second program.

I have attempted to attach a text file in case the output of this posting
doesnt fair to well in the transition.

For me my quarter is almost over, but luckily I am going to repeat this
COBOL class before I move onto the advanced course being offered. I havent
been able to master enough basic skills yet.

I do not know the best way to ask you all for help. Hopefully, by asking
you all for guidance instead of just asking for the code outright would be
a better way (guidance). What would be your reactions to this?

Thanks for all of your help,

Eric


Original Program Source Code Listing:

        *************** Beginning of data
*************************************
0001.00        PROCESS APOST.
0002.00
0003.00        IDENTIFICATION DIVISION.
0004.00
0005.00        PROGRAM-ID. CHPT0303.
0006.00
0007.00       ************************************************************
0008.00       *                                                          *
0009.00       *  This program reads the Customer Address File and will   *
0010.00       *  print a Customer Mailing List containing the following  *
0011.00       *  items in this order. Each complete record will have two *
0012.00       *  spaces before the next complete record starts.          *
0013.00       *                                                          *
0014.00       *   1. Customer Name                                       *
0015.00       *   2. Street Address                                      *
0016.00       *   3. City, State, Zip                                    *
0017.00       *                                                          *
0018.00       ************************************************************
0019.00
0020.00        ENVIRONMENT DIVISION.
0021.00
0022.00        INPUT-OUTPUT SECTION.
0023.00
0024.00        FILE-CONTROL.
0025.00             SELECT CUSTOMER-ADDRESS-FILE
0026.00                 ASSIGN TO DISK-CUSTADDRPF.
0027.00
0028.00             SELECT CUSTOMER-MAILING-LIST
0029.00                 ASSIGN TO PRINTER-QPRINT.
0030.00
0031.00        DATA DIVISION.
0032.00
0033.00        FILE SECTION.
0034.00
0035.00        FD  CUSTOMER-ADDRESS-FILE.
0036.00
0037.00        01  CUSTOMER-ADDRESS-DETAILS.
0038.00            05  CA-CUSTOMER-NAME            PIC X(20).
0039.00            05  STREET-NAME.
0040.00                10  CA-STREET-ADDRESS       PIC X(20).
0041.00            05  ADDRESS-FROM.
0042.00                10  CA-CITY                 PIC X(15).
0043.00                10  CA-STATE                PIC X(02).
0044.00                10  CA-ZIP-CODE             PIC 9(05).
0045.00
0046.00        FD  CUSTOMER-MAILING-LIST.
0047.00
0048.00        01  PRINT-RECORD-OUT                PIC X(80).
0049.00
0050.00        WORKING-STORAGE SECTION.
0051.00
0052.00        01  WS-CONTROL-FIELDS.
0053.00            05  ARE-THERE-MORE-RECORDS      PIC X(3)    VALUE 'YES'.
0054.00
0055.00        01  NAME-LABEL.
0056.00            05                              PIC X(10).
0057.00            05  DL-CUSTOMER-NAME            PIC X(20).
0058.00
0059.00        01  STREET-LABEL.
0060.00            05                              PIC X(10).
0061.00            05  DL-STREET-ADDRESS           PIC X(20).
0062.00
0063.00        01  ADDRESS-LABEL.
0064.00            05                              PIC X(10).
0065.00            05  DL-CITY                     PIC X(15).
0066.00            05                              PIC X      VALUE ','.
0067.00            05                              PIC X(01).
0068.00            05  DL-STATE                    PIC X(02).
0069.00            05                              PIC X(02).
0070.00            05  DL-ZIP-CODE                 PIC 9(05).
0071.00
0072.00        PROCEDURE DIVISION.
0073.00
0074.00        000-MAIN-MODULE.
0075.00
0076.00            OPEN INPUT  CUSTOMER-ADDRESS-FILE
0077.00                 OUTPUT CUSTOMER-MAILING-LIST.
0078.00
0079.00            READ CUSTOMER-ADDRESS-FILE
0080.00                AT END
0081.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0082.00            END-READ
0083.00            PERFORM 200-PROCESS-RECORD-RTN
0084.00                UNTIL ARE-THERE-MORE-RECORDS = 'NO '.
0085.00
0086.00            CLOSE CUSTOMER-ADDRESS-FILE
0087.00                  CUSTOMER-MAILING-LIST.
0088.00
0089.00            STOP RUN.
0090.00
0091.00        200-PROCESS-RECORD-RTN.
0092.00
0093.00            MOVE CA-CUSTOMER-NAME TO DL-CUSTOMER-NAME.
0094.00            MOVE CA-STREET-ADDRESS TO DL-STREET-ADDRESS.
0095.00            MOVE CA-CITY TO DL-CITY.
0096.00            MOVE CA-STATE TO DL-STATE.
0097.00            MOVE CA-ZIP-CODE TO DL-ZIP-CODE.
0098.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0099.00                 AFTER ADVANCING 1 LINE.
0100.00            WRITE PRINT-RECORD-OUT FROM STREET-LABEL
0101.00                 AFTER ADVANCING 1 LINE.
0102.00            WRITE PRINT-RECORD-OUT FROM ADDRESS-LABEL
0103.00                 AFTER ADVANCING 1 LINE.
0104.00            MOVE SPACES TO PRINT-RECORD-OUT.
0105.00            WRITE PRINT-RECORD-OUT
0106.00                 AFTER ADVANCING 2 LINE.
0107.00            READ CUSTOMER-ADDRESS-FILE
0108.00                AT END
0109.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0110.00            END-READ.
        ****************** End of data
****************************************

2nd Program Source Code Listing:

0001.00        PROCESS APOST.
0002.00
0003.00        IDENTIFICATION DIVISION.
0004.00
0005.00        PROGRAM-ID. CHPT0403.
0006.00
0007.00       ************************************************************
0008.00       *                                                          *
0009.00       *  This program reads the Customer Address File and will   *
0010.00       *  print a Customer Mailing List containing the following  *
0011.00       *  items in this order. Each complete record will have two *
0012.00       *  spaces before the next complete record starts.          *
0013.00       *                                                          *
0014.00       *   1. Customer Name                                       *
0015.00       *   2. Street Address                                      *
0016.00       *   3. City, State, Zip                                    *
0017.00       *                                                          *
0018.00       ************************************************************
0019.00
0020.00        ENVIRONMENT DIVISION.
0021.00
0022.00        INPUT-OUTPUT SECTION.
0023.00
0024.00        FILE-CONTROL.
0025.00             SELECT CUSTOMER-ADDRESS-FILE
0026.00                 ASSIGN TO DISK-CUSTADDRPF.
0027.00
0028.00             SELECT CUSTOMER-MAILING-LIST
0029.00                 ASSIGN TO PRINTER-QPRINT.
0030.00
0031.00        DATA DIVISION.
0032.00
0033.00        FILE SECTION.
0034.00
0035.00        FD  CUSTOMER-ADDRESS-FILE.
0036.00
0037.00        01  CUSTOMER-ADDRESS-DETAILS.
0038.00            05  CA-CUSTOMER-NAME            PIC X(20).
0039.00            05  STREET-NAME.
0040.00                10  CA-STREET-ADDRESS       PIC X(20).
0041.00            05  ADDRESS-FROM.
0042.00                10  CA-CITY                 PIC X(15).
0043.00                10  CA-STATE                PIC X(02).
0044.00                10  CA-ZIP-CODE             PIC 9(05).
0045.00
0046.00        FD  CUSTOMER-MAILING-LIST.
0047.00
0048.00        01  PRINT-RECORD-OUT                PIC X(80).
0049.00
0050.00        WORKING-STORAGE SECTION.
0051.00
0052.00        01  WS-CONTROL-FIELDS.
0053.00            05  ARE-THERE-MORE-RECORDS      PIC X(03)  VALUE 'YES'.
0054.00            05  WS-LINE-COUNTER             PIC 9(03)
PACKED-DECIMAL
0055.00                                                       VALUE 60.
0056.00            05  WS-LINE-LIMIT               PIC 9(03)
PACKED-DECIMAL
0057.00                                                       VALUE 60.
0058.00            05  WS-PAGE-COUNTER             PIC 9(03)
PACKED-DECIMAL
0059.00                                                      VALUE ZERO.
0060.00        01  WS-CURRENT-DATE.
0061.00            05  WS-CURRENT-YEAR             PIC 9(4).
0062.00            05  WS-CURRENT-MONTH            PIC 9(2).
0063.00            05  WS-CURRENT-DAY              PIC 9(2).
0064.00
0065.00        01  HEADING-1.
0066.00            05  HL-MONTH                    PIC 9(02).
0067.00            05                              PIC X      VALUE '/'.
0068.00            05  HL-DAY                      PIC 9(02).
0069.00            05                              PIC X      VALUE '/'.
0070.00            05  HL-YEAR                     PIC 9(04).
0071.00            05                              PIC X(04).
0072.00            05                              PIC X(15)
0073.00                                            VALUE 'MAILING LIST'.
0074.00            05                              PIC X(08).
0075.00            05                              PIC X(04)  VALUE 'PAGE'.
0076.00            05                              PIC X(01).
0077.00            05  HL-PAGE                     PIC Z9     VALUE ZERO.
0078.00
0079.00        01  NAME-LABEL.
0080.00            05                              PIC X(10).
0081.00            05  DL-CUSTOMER-NAME            PIC X(20).
0082.00
0083.00        01  STREET-LABEL.
0084.00            05                              PIC X(10).
0085.00            05  DL-STREET-ADDRESS           PIC X(20).
0086.00
0087.00        01  ADDRESS-LABEL.
0088.00            05                              PIC X(10).
0089.00            05  DL-CITY                     PIC X(15).
0090.00            05                              PIC X      VALUE ','.
0091.00            05                              PIC X(01).
0092.00            05  DL-STATE                    PIC X(02).
0093.00            05                              PIC X(02).
0094.00            05  DL-ZIP-CODE                 PIC 9(05).
0095.00
0096.00        PROCEDURE DIVISION.
0097.00
0098.00        000-MAIN-MODULE.
0099.00
0100.00            OPEN INPUT  CUSTOMER-ADDRESS-FILE
0101.00                 OUTPUT CUSTOMER-MAILING-LIST.
0102.00
0103.00            MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE.
0104.00            MOVE WS-CURRENT-MONTH TO HL-MONTH.
0105.00            MOVE WS-CURRENT-DAY TO HL-DAY.
0106.00            MOVE WS-CURRENT-YEAR TO HL-YEAR.
0107.00
0108.00            READ CUSTOMER-ADDRESS-FILE
0109.00                AT END
0110.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0111.00            END-READ
0112.00            PERFORM 200-PROCESS-RECORD-RTN
0113.00                UNTIL ARE-THERE-MORE-RECORDS = 'NO '.
0114.00
0115.00            CLOSE CUSTOMER-ADDRESS-FILE
0116.00                  CUSTOMER-MAILING-LIST.
0117.00
0118.00            STOP RUN.
0119.00
0120.00        200-PROCESS-RECORD-RTN.
0121.00
0122.00            MOVE CA-CUSTOMER-NAME TO DL-CUSTOMER-NAME.
0123.00            MOVE CA-STREET-ADDRESS TO DL-STREET-ADDRESS.
0124.00            MOVE CA-CITY TO DL-CITY.
0125.00            MOVE CA-STATE TO DL-STATE.
0126.00            MOVE CA-ZIP-CODE TO DL-ZIP-CODE.
0127.00
0128.00            IF WS-LINE-COUNTER >= WS-LINE-LIMIT
0129.00                PERFORM 210-HEADING-RTN
0130.00            END-IF
0131.00
0132.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0133.00                AFTER ADVANCING 1 LINE.
0134.00            ADD 1 TO WS-LINE-COUNTER.
0135.00
0136.00            READ CUSTOMER-ADDRESS-FILE
0137.00                AT END
0138.00                    MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
0139.00            END-READ.
0140.00
0141.00        210-HEADING-RTN.
0142.00            ADD 1 TO WS-PAGE-COUNTER.
0143.00            MOVE WS-PAGE-COUNTER TO HL-PAGE.
0144.00            WRITE PRINT-RECORD-OUT FROM HEADING-1
0145.00               AFTER ADVANCING PAGE.
0146.00            WRITE PRINT-RECORD-OUT FROM NAME-LABEL
0147.00               AFTER ADVANCING 1 LINE.
0148.00            WRITE PRINT-RECORD-OUT FROM STREET-LABEL
0149.00               AFTER ADVANCING 1 LINE.
0150.00            WRITE PRINT-RECORD-OUT FROM ADDRESS-LABEL
0151.00               AFTER ADVANCING 1 LINE.
0152.00            MOVE SPACES TO PRINT-RECORD-OUT.
0153.00            WRITE PRINT-RECORD-OUT
0154.00               AFTER ADVANCING 2 LINES.
0155.00            MOVE 5 TO WS-LINE-COUNTER.
        ****************** End of data
****************************************
_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
or email: COBOL400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.






**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

postmaster@bif.ie
**********************************************************************



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.