|
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.
As an Amazon Associate we earn from qualifying purchases.
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.