I have used this same type of logic to accomplish the same thing (adding to
a spool file) using
'regular' COBOL.
Doesn't have to be ILE.
Just pass the first-time, not-first-time and end switch as a parm in the CL
and pass it to the COBOL program.
Then condition your open and close on the switch.


Thank you,

Karen Hodge
Senior System Analyst
Genesys Health System
1000 Healthpark Blvd, Grand Blanc, Mi 48439
Office 810.606.5180, Fax 810.606.7204
khodge@xxxxxxxxxxx


                                                                           
             "Greg Phillips"                                               
             <gphillips@zenith                                             
             admin.com>                                                 To 
             Sent by:                  "COBOL Programming on the           
             cobol400-l-bounce         iSeries/AS400"                      
             s@xxxxxxxxxxxx            <cobol400-l@xxxxxxxxxxxx>           
                                                                        cc 
                                                                           
             03/18/2005 04:33                                      Subject 
             PM                        RE: [COBOL400-L] Multiple Reports   
                                       in One Spooled File                 
                                                                           
             Please respond to                                             
             COBOL Programming                                             
                  on the                                                   
               iSeries/AS400                                               
             <cobol400-l@midra                                             
                 nge.com>                                                  
                                                                           
                                                                           




Thanks for the reply, Patrick.  I'm unfamiliar with ILE other than some
vague notions of creating non-executable modules, perhaps binding them
together, and then creating an executable object.  This will give me a good
excuse to start learning about ILE.  Thanks again.

- Greg

-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx]On Behalf Of Patrick L Archibald
Sent: Friday, March 18, 2005 11:50 AM
To: COBOL Programming on the iSeries/AS400
Subject: Re: [COBOL400-L] Multiple Reports in One Spooled File


Greg

If you don't mind ILE the following works:

  PGM

             CALLPRC    PRC(MULTIOPEN) PARM('0')

             CALLPRC    PRC(MULTIOPEN) PARM('1')

             CALLPRC    PRC(MULTIOPEN) PARM('1')

             CALLPRC    PRC(MULTIOPEN) PARM('1')

             CALLPRC    PRC(MULTIOPEN) PARM('1')

             CALLPRC    PRC(MULTIOPEN) PARM('1')

             CALLPRC    PRC(MULTIOPEN) PARM('1')

             CALLPRC    PRC(MULTIOPEN) PARM('2')

             endpgm



       PROCESS APOST.

       IDENTIFICATION DIVISION.

       PROGRAM-ID. MULTIOPEN.

       AUTHOR. PLA.

       DATE-WRITTEN. 03/18/2005.

      *

      *  Test.

      *

       ENVIRONMENT DIVISION.

       CONFIGURATION SECTION.

       SOURCE-COMPUTER. IBM-AS400.

       OBJECT-COMPUTER. IBM-AS400.

       SPECIAL-NAMES. I-O-FEEDBACK IS PRINTER-FEEDBACK.

       INPUT-OUTPUT SECTION.

       FILE-CONTROL.



           SELECT OPF-PRINT

                  ASSIGN FORMATFILE-MULTIOPEN-SI

                  FILE STATUS WS-FILE-STATUS.


       DATA DIVISION.

       FILE SECTION.


       FD  OPF-PRINT.

       01  OPR-PRINT.

           COPY DDS-ALL-FORMAT OF MULTIOPEN.


       WORKING-STORAGE SECTION.

       01  WS-FILE-STATUS                PIC X(02).


       01  WS-FIRST-TIME-INDIC           PIC S9(01) VALUE 1.

       01  WS-FEEDBACK.

           05  FILLER                    PIC X(144).

           05  WS-CURRENT-PRINT-LINE     PIC S9(02) COMP-4.


       01  INDIC-AREA.

           05  IN01  INDIC 01            PIC 1.


       LINKAGE SECTION.

       01  LS-FIRST-TIME-INDIC           PIC S9(1).

           88 FIRST-TIME                 VALUE 0.

           88 NOT-FIRST-TIME             VALUE 1.

           88 LAST-TIME                  VALUE 2.


       PROCEDURE DIVISION USING LS-FIRST-TIME-INDIC.

       OPENING-PARAGRAPH.

           IF FIRST-TIME

               OPEN OUTPUT OPF-PRINT

           END-IF.

           WRITE OPR-PRINT

                 FORMAT 'HEADER1'

                 INDIC INDIC-AREA

           END-WRITE.

           IF LAST-TIME

               CLOSE OPF-PRINT

           END-IF.

           GOBACK.

Thanx, PLA




Greg Phillips wrote:

>I've seen this problem discussed, but not by anyone who actually solved it
>in a CL that calls COBOL/400 programs.  I have a CLP that CALLs a
COBOL/400
>program multiple times in a loop.  The loop basically consists of an
>OVRPRTF, a CALL to the COBOL program, and a DLTOVR.  Each iteration
creates
>a separate spooled file.
>
>I'd like the report output from each iteration to go into a *single*
spooled
>file.  I've moved the OVRPRTF outside of the loop to before the loop gets
>executed, used SHARE(*YES) and then did my iterations.  I still received
>separate spooled files.
>
>I also tried OPNSCOPE(*JOB) by itself and with OVRSCOPE(*JOB) with no
>success.  I changed the COBOL program to either OPEN or CLOSE or do
neither
>with the printer file.  All I discovered for my trouble was that you need
to
>explicitly OPEN the printer file in the program in order to use it.  That
>makes sense.
>
>So if anyone has actually used CL and COBOL/400 to direct printed output
>from multiple CALLs of a COBOL program into a single spooled file, please
>tell me how you did it!  Thanks!
>
>- Greg Phillips
>_______________________________________________
>This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
>To post a message email: COBOL400-L@xxxxxxxxxxxx
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
>or email: COBOL400-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/cobol400-l.
>
>
>

_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.



_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2022 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.