Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collate Printing

Status
Not open for further replies.

sburden

Programmer
Dec 4, 2002
35
US
Hello:

We presently have an impact printer to print our invoices. They are a multi-part form, 5 to be exact. I've been assigned to move the invoices to print on a laser printer. I need to collate the printing so when each invoice is outputed it will print 5 copies immediately and not spool the entire job. Has anyone done something along this line?

I appreciate any and all help.

Thanks
 
Override the printer file to 5 copies in the CL program before you call the RPG:

Code:
OVRPRTF	FILE(PRT_FILE)	COPIES(5)





De mortuis nihil nisi bonum.

 
Thanks for responding but, I'm using the "OVRPRTF" copies(5) now and this is not giving me the results I need. I need the copies to be collated as though I'd be printing on an impact printer with multi part forms.

 
I suspect you will need to do something like

Do 5
Exsr PrintSR
EndDo

Depend on how the logic is in the program.

Another thought: I once had to do something like this with a canned pgm. I captured the output line to a file, then wrote a pgm to read the captured file and print the way they wanted it. Depending on setup, it may be possible.
 
We have 75 - 100 Invoice programs because they're client specific. Some use cycle printing and others exception printing. I was hoping I wouldn't have to go in and modify all the RPG programs individually, but it's beginning to look that way.
 
You may have to split this up into two programs. The first one (your existing program) will output the data to a worf file (having done all the calculations). The second one just prints from that file. The entire print logic of program #2 is in the Do 5 loop. (I'd make the number of copies a parameter to this second program, in case they change their minds about how many copies...)

De mortuis nihil nisi bonum.

 
Expanding on what flapeyre suggested, "Override the printer file to 5 copies in the CL program before you call the RPG", you will need to change the printer file to USROPN (user controlled) in your RPG code and open and close the spool file between invoices.
You will create one spool file per invoice but each will print 5 pages before the next invoice prints.




T. Bishop
"My agility dog is smarter than your honor student.
 
Thanks!

I appreciate all of your comments.
 
FWIW

I was thinking of a way I used a while ago when I had to print 3 copies of each in the same situation. My first thoughts were that I had to modify all the RPG programs individually and finally I came up with writing/modifying only some CL's (also to avoid the chore of changing a lot of programs).

I used an OPNQRYF to filter the invoices one by one. A CL program read the master invoice to select the inv# to print. From each record selected I had the choice to OVRPRTF COPIES(3) or loop 3 times on the OPNQRYF. I chose the 2nd option so that I could print a specific text with the PRTTXT parameter on the last line of the invoice splf on each copy and the 3 copies were collated separately in OUTQ. Furthermore the splf name was the invoice number, therefore it was easy to print again a "garbaged" invoice.

Off the top of my head, this is what I approximately wrote.
It's likely a bit hit and miss but in spite of some drawbacks I could cope with this solution. Going that route was certainly a lot simpler than changing many programs.

Code:
PGM
...
dclf INVMASTER
...

MainLoop:
RCVF
MONMSG CPF0864 EXEC( ... )   /* EOF */
/* Here I selected the requested invoice from the INVMASTER */
...

Loop:
OVRDBF INVMASTER SHARE(*YES)
OPNQRYF INVMASTER  QRYSLT( "INV# = " *cat &INV# )
CHGVAR &Count = ( &Count + 1 )
If (&Count = 1)  chgvar &prttxt ( 'blahblah...' *cat &... )
If (&Count = 2)  chgvar &prttxt ( 'blahblah...' *cat &... )
If (&Count = 3)  chgvar &prttxt ( 'blahblah...' *bcat &... )
OVRPRTF FILE( INVSPLF ) TOFILE( 'INV' *cat &inv# ) PRTTXT( &prttxt )...
CALL INVEDT ... /* Edit program */
DLTOVR INVSPLF
RCLRSC
If (&Count < 3) GOTO Loop
GOTO MainLoop
...
ENDPGM

HTH -- Philippe
_______________
Never test the depth of water with both feet.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top