|
I found some fairly old code that I wrote many years ago - originally for the System/38 but I think it would still work today - although you may wish to modernise it!
It does a DLTOVR followed by OVRPRTF
The DLTOVR must have an error indicator because first time through there will not be an existing override to delete, unless you only print one report. Also you must do your own open and close of the printer file if you are printing more than one report. The printer file name is put in a variable, so you could use this logic for several different printer files in the same program.
In this program, the operator was given two screens of printer attributes which he could change and these are the values used for the OVRPRTF.
To save space, I have cut a lot of them out. You would need to add values for
FRONTOVL
BACKOVL
DRAWER
At the time this was written, there were no overlays or paper drawers (or they were not used)
I think for landscape you today would have to use PAGRTT. When this code was originally written, we had to send direct printer escape codes for orientation as the OVRPRTF didn't handle this as far as I remember.
CMD is an array length 200
If you have any queries, please let me know
* Execute a DLTOVR command to ensure that any exisiting overides
* for the printer file are cancelled.
C
MOVEA*BLANKS CMD
C
Z-ADD1 B
C
MOVEA'DLTOVR' CMD,B
C
ADD 7 B
C
MOVEAPRTFIL CMD,B
* PRTFIL is printer file name
C
ADD 10 B
* Set command length.
C
Z-ADD200 CMDLEN 155
* Execute DLTOVR command.
C
CALL 'QCMDEXC'
50
C
PARM CMD
C
PARM CMDLEN
* Execute OVRPRTF command to change printer file's attributes
as
* requested on printer attributes screen.
C/SPACE 1
* Initialise array & index to hold
CL command.
C
MOVEA*BLANKS CMD
C
Z-ADD1 B
30
C
MOVEA'OVRPRTF' CMD,B
C
ADD 8 B
C
MOVEAPRTFIL CMD,B
C
ADD 11 B
C
MOVEA'PAGESIZE'CMD,B
C
ADD 8 B
C
MOVEA'(' CMD,B
C
ADD 1 B
* Form length, in lines per page.
* -- if paper type eq. A4 or A5 then form
length =066 else
* use last line parameter
from printer attributes screen
C
MOVE LSTPLN FRMLEN
C
MOVEAFRMLEN CMD,B
C
ADD 4 B
* Form width, in characters per line. This
value is taken from
* the printer information file, as part
of the escape code set
C
MOVEAFRMWID CMD,B
C
ADD 3 B
* Overflow line.
C
MOVEA') OVRFLW'CMD,B
C
ADD 8 B
C
MOVEA'(' CMD,B
C
ADD 1 B
C
MOVELOVRPLN OVRLN 3
C
MOVEAOVRLN CMD,B
C
ADD 3 B
C
MOVEA') ' CMD,B
C
ADD 2 B
* Lines per inch.
C PRINT#
IFNE 000000020
C
MOVEA'LPI(' CMD,B
C
ADD 4 B
C
Z-ADDLPI FRMLP1 10
* The OVRPRTF command only allows LPI values
of 4,6,8 or 9. So
* printers may allow other values, but
those are specified in
* specific printer escape codes sets.
C FRMLP1
IFNE 4
C FRMLP1
ANDNE6
C FRMLP1
ANDNE8
C FRMLP1
ANDNE9
C
Z-ADD6 FRMLP1
C
END
C
MOVE FRMLP1 FRMLPI 1
C
MOVEAFRMLPI CMD,B
C
ADD 1 B
C
MOVEA') ' CMD,B
C
ADD 2 B
C
END
* Characters per inch.
C
MOVEA'CPI(' CMD,B
C
ADD 4 B
C
MOVELESC,66 CDEDS
C
MOVEACDEDS2 CMD,B
C
ADD CDEDS1 B
* Output queue name. Could be 21 chrs.
long, including library
C
MOVEA') OUTQ(' CMD,B
C
ADD 7 B
C
MOVEAOUTQ CMD,B
C
ADD 21 B
* Number of copies.
C
MOVEA') COPIES'CMD,B
C
ADD 8 B
C
MOVEA'(' CMD,B
C
ADD 1 B
C
MOVE COPIES COPYF 2
C
MOVEACOPYF CMD,B
C
ADD 2 B
* Hold file yes/no.
C
MOVEA') HOLD(' CMD,B
C
ADD 7 B
C HOLDF
IFEQ 'Y'
C
MOVEA'*YES)' CMD,B
C
ELSE
C
MOVEA'*NO)' CMD,B
C
END
C
ADD 6 B
* Save file yes/no.
C
MOVEA'SAVE(' CMD,B
C
ADD 5 B
C SAVEF
IFEQ 'Y'
C
MOVEA'*YES)' CMD,B
C
ELSE
C
MOVEA'*NO)' CMD,B
C
END
C
ADD 6 B
* Formtype.
C
MOVEA'FORMTYPE'CMD,B
C
ADD 8 B
C
MOVEA'(' CMD,B
C
ADD 1 B
C
MOVEAFRMTYP CMD,B
C
ADD 10 B
C
MOVEA')' CMD,B
C
ADD 002 B
* Paper alignment
C
MOVEA'ALIGN(*' CMD,B
C
ADD 007 B
C
MOVEA'NO) ' CMD,B
C ALIGN
IFEQ 'Y'
C
MOVEA'YES)' CMD,B
C
END
C
ADD 005 B
* PRINT UNPRINTABLE CHARS.
C
MOVEA'RPLUNPRT'CMD,B
C
ADD 008 B
C
MOVEA'(*NO)' CMD,B
C
ADD 006 B
C/SPACE 1
* Execute OVRPRTF command using QCAEXEC
C***
CALL 'QCAEXEC'
50
C
CALL 'QCMDEXC'
50
C
PARM CMD
C
PARM CMDLEN
C *IN50
IFEQ '1'
C
Z-ADD000000131 ERROR#
C
END
Gary Kuznitz wrote:
I'm trying to figure out how to print a form with an overlay and an
envelope in the same RPG program. It sure would be nice if someone
could share an example source or if someone knows where one is posted
that would be great. I'm trying to figure out how to do an override
for the print file inside the RPG program so I don't have to create a
CLP for every form. I'd also like to see how to select an envelope
tray and turn the printing from landscape to portrait inside an RPG
program. I'm working with an HP4050TN in PCL6. I realize the codes
may be different but if I could see some sample code of how its done
it would be a great help.
Best wishes
Rob
________________________________________________________
Erros plc
44 (0) 1844 239 339
http://www.erros.co.uk - The AS/400 Neural Database for the Internet
_________________________________________________________
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.