Printing a spool 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:


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:

2. Create a OUTQ with the following command:

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)
             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(' ')
 /* 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))
                   SPLNBR(&SPLNBR) DUPLEX(*YES)                   
                   MONMSG CPF0000                                 
                   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)                                     


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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.