Printing a spool on both sides of the paper

Print large spool files on both sides of the paper.

Do you want your users to print large spool files on both sides of the paper? Here is something you can do to support that:

Assumptions:

1. You have a laser printer, which supports printing on both sides of the page. (Most laser printers do support these days.)

2. The laser printer is already defined as an iSeries printer and has a particular OUTQ name. For example: PRINT01

Follow the Steps:

1. Create a new DTAQ by the following command:
CRTDTAQ DTAQ(QGPL/ZDTAQ1) MAXLEN(64512)

2. Create a OUTQ with the following command:
CRTOUTQ OUTQ(QGPL/DUPLEX) DTAQ(QGPL/ZDTAQ1)

3. Compile the following CL program after making necessary modifications to it. (You probably need to change the out queue name in the last CL command CHGPLFA)

Note 1:
The program needs to be running all the time in the system. The program doesn't take any CPU resource as it waits in DEQW status until a spool file comes in the OUTQ.

Note 2:
You may want to add the CALL to this program in the system startup program, so that it gets executed automatically, after every IPL.

So, from now on, whenever you need to print the spool file on the both sides of a paper, just send the spool file to the OUTQ DUPLEX instead of the regular OUTQ (PRINT01 in this case). The output will appear on PRINT01 (your actual existing OUTQ) only.

To print regular one-sided spool files simply send the spool files to PRINT01 (your actual existing OUTQ).

Please feel free to send your questions/comments to me at mailto:ravinp2@yahoo.com.

 
CL Program: 
/**********************************************************************/
/* Author       : Ravinder K. Pal
*/
/* Description : Print both sides of the paper (driver)
*/
/**********************************************************************/
             PGM
             DCL        VAR(&FLDLEN) TYPE(*DEC) LEN(5 0) VALUE(128)
             DCL        VAR(&FIELD) TYPE(*CHAR) LEN(128)
             DCL        VAR(&ERR) TYPE(*CHAR) LEN(50)
             DCL        VAR(&SPLNBR) TYPE(*DEC) LEN(9 0)
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
             DCL        VAR(&SPLNM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&JOBNM) TYPE(*CHAR) LEN(10)
             DCL        VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
             DCL        VAR(&ERR) TYPE(*CHAR) LEN(50)
             DCL        VAR(&TNAME) TYPE(*CHAR) LEN(50)
             DCL        VAR(&FM) TYPE(*CHAR) LEN(32)
             DCL        VAR(&SNAME) TYPE(*CHAR) LEN(8)
             DCL        VAR(&WAIT) TYPE(*DEC) LEN(5 0)
 LOOP:       CHGVAR     VAR(&WAIT) VALUE(-1) /* wait for new entry +
                          on the data queue */
             CHGVAR     VAR(&FIELD) VALUE(' ')
             CALL       PGM(QRCVDTAQ) PARM(ZDTAQ1 QGPL &FLDLEN &FIELD +
                          &WAIT)
 /* Get the Spool file number for the spool file  */
             CHGVAR     VAR(&SPLNBR) VALUE(%BIN(&FIELD 49 4))
 /* Get the Job name for the spool file   */
             CHGVAR     VAR(&JOBNM) VALUE(%SST(&FIELD 13 10))
 /* Get the user ID for the spool file   */
             CHGVAR     VAR(&USER) VALUE(%SST(&FIELD 23 10))
 /* Get the Job Number for the spool file  */
             CHGVAR     VAR(&JOBNBR) VALUE(%SST(&FIELD 33 6))
 /* Get the spool file name */
             CHGVAR     VAR(&SPLNM) VALUE(%SST(&FIELD 39 10))
   
       CHGSPLFA   FILE(&SPLNM) JOB(&JOBNBR/&USER/&JOBNM) +         
                   SPLNBR(&SPLNBR) DUPLEX(*YES)                   
                   MONMSG CPF0000                                 
       CHGSPLFA   FILE(&SPLNM) JOB(&JOBNBR/&USER/&JOBNM) +         
                   SPLNBR(&SPLNBR) OUTQ(PRINT01) 
/* PRINT01 is used as an example. Instead of PRINT01, you will use the name
of an existing OUTQ */                   
                                                                  
            GOTO       CMDLBL(LOOP)                                     
ENDPGM

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in February 2004

Dig deeper on iSeries CL programming

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close