Jim,

I wrote a similar CL here a few years ago. In my case I tested each parameter to see if there was anything there; if not I used CHGVAR to set it to our default. Then just issued OVRPRTF once. Issuing an OVRPRTF resets the override's parameters, which is what you are experiencing.

Short example:

IF COND(&COPIES *EQ 0) THEN(DO) CHGVAR VAR(&COPIES) VALUE(1) ENDDO IF COND(&OVRSCOPE *EQ ' ') THEN(DO) CHGVAR VAR(&OVRSCOPE) VALUE('*JOB ') ENDDO OVRPRTF FILE(&FILE) TOFILE(*FILE) +
DEV(&DEV) PAGESIZE(&LENGTH &WIDTH) +
LPI(&LPI) CPI(&CPI) OVRFLW(&OVRFLW) +
PAGRTT(&PAGRTT) REDUCE(&REDUCE) +
PRTTXT(&PRTTXT) SPOOL(&SPOOL) +
FORMTYPE(&FORMTYPE) COPIES(&COPIES) +
HOLD(&HOLD) SAVE(&SAVE) +
SPLFNAME(&SPLFNAME) OVRSCOPE(&OVRSCOPE)
* Jerry C. Adams
*IBM System i Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
615.995.7024
fax
615.995.1201
email
jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



JDHorn@xxxxxxxxxxxxxx wrote:
I am trying to create a generic jovrprtf cl program to be called by rpg
programs.
I want it to be able to test for which parameters to override and to issue
an ovrprtf command for each one that needs to be changed.
It seems that each time I issue an ovrprtf command it replaces the
previous overrides.
Am I missing something?
0018.00 PGM PARM(&xxfile + 0019.00 &XXTOfile + 0020.00 &XXTOlib + 0021.00 &XXDEV + 0022.00 &XXPAGRTT + 0023.00 &XXMULTIUP
+ 0024.00 &XXDUPLEX + 0025.00 &XXOUTQ + 0026.00 &XXOUTQL + 0027.00 &XXUSRDTA + 0028.00 &XXerror ) 0029.00 0030.00 DCL VAR(&XXfile ) TYPE(*CHAR)
LEN(10) 0031.00 DCL VAR(&XXTOfile ) TYPE(*CHAR)
LEN(10) 0032.00 DCL VAR(&XXTOlib ) TYPE(*CHAR)
LEN(10) 0033.00 DCL VAR(&XXDEV ) TYPE(*CHAR)
LEN(10) 0034.00 DCL VAR(&XXPAGRTT ) TYPE(*CHAR) LEN(
5) 0035.00 DCL VAR(&XXMULTIUP) TYPE(*CHAR) LEN(
6) 0036.00 DCL VAR(&XXDUPLEX ) TYPE(*CHAR) LEN(
7) 0037.00 DCL VAR(&XXOUTQ ) TYPE(*CHAR)
LEN(10) 0038.00 DCL VAR(&XXOUTQL ) TYPE(*CHAR)
LEN(10) 0039.00 DCL VAR(&XXUSRDTA ) TYPE(*CHAR)
LEN(10) 0040.00 DCL VAR(&xxerror) TYPE(*CHAR)
LEN(1) 0041.00 0049.00 /* OVERRIDE TO A NEW PRINTER
FILE */ 0050.00 IF COND(&XXTOFILE *GT ' ')
THEN(DO) 0051.00 OVRPRTF FILE(&XXFILE) TOFILE(&XXTOLIB/&XXTOFILE)
+ 0052.00 OVRSCOPE(*JOB) 0053.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0054.00 VAR(&xxerror)
VALUE('1')) 0055.00 ENDDO 0056.00 0057.00 0058.00 /* OVERRIDE TO A NEW
DEVICE */ 0059.00 IF COND(&XXDEV *GT ' ')
THEN(DO) 0060.00 OVRPRTF FILE(&XXFILE) TOFILE(*FILE) DEV(&XXDEV)
+ 0061.00 OVRSCOPE(*JOB) 0062.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0063.00 VAR(&xxerror)
VALUE('1')) 0064.00 ENDDO 0065.00 0067.00 /* OVERRIDE TO A NEW PAGE
ROTATION */ 0068.00 IF COND(&XXPAGRTT *GT ' ')
THEN(DO) 0069.00 OVRPRTF FILE(&XXFILE) TOFILE(*FILE)
+ 0070.00 PAGRTT(&XXPAGRTT)
OVRSCOPE(*JOB) 0071.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0072.00 VAR(&xxerror)
VALUE('1')) 0073.00 ENDDO 0074.00 0075.00 0076.00 /* OVERRIDE TO A NEW
MULTIUP */ 0077.00 IF COND(&XXMULTIUP *GT ' ')
THEN(DO) 0078.00 OVRPRTF FILE(&XXFILE) TOFILE(*FILE)
+ 0079.00 MULTIUP(&XXMULTIUP)
OVRSCOPE(*JOB) 0080.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0081.00 VAR(&xxerror)
VALUE('1')) 0082.00 ENDDO 0083.00 0084.00 0085.00 /* OVERRIDE TO A
DUPLEX */ 0086.00 IF COND(&XXDUPLEX *GT ' ')
THEN(DO) 0087.00 OVRPRTF FILE(&XXFILE) TOFILE(*FILE)
+ 0088.00 DUPLEX(&XXDUPLEX)
OVRSCOPE(*JOB) 0089.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0090.00 VAR(&xxerror)
VALUE('1')) 0091.00 ENDDO 0092.00 0093.00 0094.00 /* OVERRIDE TO A NEW OUTQ */ 0095.00 IF COND(&XXOUTQ *GT ' ')
THEN(DO) 0096.00 OVRPRTF FILE(&XXFILE) TOFILE(*FILE)
+ 0097.00 OUTQ(&XXOUTQL/&XXOUTQ)
OVRSCOPE(*JOB) 0098.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0099.00 VAR(&xxerror)
VALUE('1')) 0100.00 ENDDO 0101.00 0102.00 /* OVERRIDE TO USER DATA */ 0103.00 IF COND(&XXUSRDTA *GT ' ')
THEN(DO) 0104.00 OVRPRTF FILE(&XXFILE) TOFILE(*FILE)
USRDTA(&XXUSRDTA) + 0105.00 OVRSCOPE(*JOB) 0106.00 MONMSG MSGID(CPF0000 CPD0000) EXEC(CHGVAR
+ 0107.00 VAR(&xxerror) VALUE('1')) 0108.00 ENDDO 0109.00 0110.00 ENDPGM Jim Horn

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you are not the named addressee or an employee or agent responsible for delivering this message to the named addressee, you are not
authorized to read, print, retain copy, and disseminate
this message or any part of it. If you have received this
message in error please notify us immediately by email,
discard any paper copies and delete all electronic files of this message.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.