| 
 | 
"Tim Truax" <truax@telerama.com> wrote:
> Hey guys and gals.
> I have a CLP (1) and it loads (3) RPG programs which ALL access and WRITE
to
> (1) Print file.
> I want to create only ONE outq entry (currently I am getting 3) ..how
shall
> I do this ?
Tim - Here is a sample CL program and several RPG programs that illustrate
what you are trying to accomplish:
If you call the CL program, it will create ONE QSYSPRT spooled file, that
looks like this:
RPG_RPT1
RPG_RPT2
RPG_RPT3
Hope this helps
Steve Landess
Austin, Texas
(512) 423-0935
/***********************************************/
/* Example programs using OVRPRTF SHARE(*YES)  */
/* to share an open printer file among several */
/* programs.                                   */
/*  S. LANDESS                                 */
/***********************************************/
PGM
OVRDBF     FILE(QSYSPRT) SECURE(*YES) OVRSCOPE(*JOB) +
             SHARE(*YES)
CALL       PGM(RPG_OPNCLO) PARM('OPEN') /* Open the +
             printer file */
CALL       PGM(RPG_RPT1) /* Uses the printer file +
             already open... */
CALL       PGM(RPG_RPT2) /* Uses the printer file +
             already open... */
CALL       PGM(RPG_RPT3) /* Uses the printer file +
             already open... */
CALL       PGM(RPG_OPNCLO) PARM('CLOSE') /* Close the +
             printer file */
DLTOVR     FILE(QSYSPRT) LVL(*JOB)
ENDPGM
 *-----------------------------------------------------------------
 *   Program Name:  RPG_OPNCLO                                    *
 *   Demonstrate using shared open data path for printer file.    *
 *   This program OPENs/CLOSEs the printer file.                  *
 *-----------------------------------------------------------------
FQSYSPRT   O    F  132        PRINTER       USROPN
 *
C     *ENTRY        PLIST
C                   PARM                    OPNCLO            5
 *
C                   SELECT
C     OPNCLO        WHENEQ    'OPEN'
C                   OPEN      QSYSPRT
C                   RETURN
 *
C     OPNCLO        WHENEQ    'CLOSE'
C                   CLOSE     QSYSPRT
C                   SETON                                        LR
C                   ENDSL
 *-----------------------------------------------------------------
 *   Program Name:  RPG_RPT1
 *   Demonstrate using shared open data path for printer file...  *
 *   This is the first program...                                 *
 *-----------------------------------------------------------------
FQSYSPRT   O    F  132        PRINTER
 *
C                   EXCEPT    DET01
C                   MOVE      *ON           *INLR
 *-----------------------------------------------------------------
OQSYSPRT   E            DET01       1
O                                           20 'RPG_RPT1'
 *-----------------------------------------------------------------
 *   Program Name:  RPG_RPT2
 *   Demonstrate using shared open data path for printer file...  *
 *   This is the second program...                                *
 *-----------------------------------------------------------------
FQSYSPRT   O    F  132        PRINTER
 *
C                   EXCEPT    DET01
C                   MOVE      *ON           *INLR
 *-----------------------------------------------------------------
OQSYSPRT   E            DET01       1
O                                           20 'RPG_RPT2'
 *-----------------------------------------------------------------
 *   Program Name:  RPG_RPT2
 *   Demonstrate using shared open data path for printer file...  *
 *   This is the last program...                                  *
 *-----------------------------------------------------------------
FQSYSPRT   O    F  132        PRINTER
 *
C                   EXCEPT    DET01
C                   MOVE      *ON           *INLR
 *-----------------------------------------------------------------
OQSYSPRT   E            DET01       1
O                                           20 'RPG_RPT3'
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.