The features described in this section are ONLY supported on the IBM i.
You can override a printer file's attributes, but not by using the operating system OVRPRTF command directly from EXEC_OS400 or EXEC_CPF commands.
Use a CALL to QCMDEXC passing a command string containing the OVRPRTF command that you wish to use.
For example, write a program like this:
DEFINE #CMD TYPE(*CHAR) LENGTH(100)
DEFINE #CMDLEN TYPE(*DEC) LENGTH(15) DECIMALS(5) DEFAULT(100)
CHANGE #CMD TO('''OVRPRTF QSYSPRT COPIES(8)''')
CALL PGM(QCMDEXC) PARM(#CMD #CMDLEN) NUM_LEN(*DEFINED)
CALL PROCESS(SALES) FUNCTION(REPT01)
Where process/function SALES/REPT01 is the actual function that produces the report.
Note that the override affects file QSYSPRT.
If SALES/REPT01 used a different printer file in a DEF_REPORT command, use this name instead in the OVRPRTF command.
You will also note that the command string #CMD is a variable, so by using SUBSTRING, CONCAT, etc, you can build up command strings that contain varying information (e.g.: the number of copies in the previous example could be sub-stringed into #CMD from a variable or the FORMTYPE modified).
Additionally, this particular function (ie: the one that does the override) could be written as a general purpose program that is exchanged the output queue name, number of copies, etc and the name of the process/function to call to actually produce the report.
For instance, to invoke report process/function SALES/REPT01 to produce 6 copies onto output queue PRT15, you might code the following:
change #rpt_copies 6
change #rpt_outq 'PRT15'
change #rpt_proc 'SALES'
change #rpt_func 'REPT01'
exchange (#rpt_copies #rpt_outq #rpt_proc #rpt_func)
call process(reports) function(invoke)
submit process(reports) function(invoke)
where process/function REPORTS/INVOKE is like the first example. It issues the required overrides for copies and output queue and then uses a variable call to invoke the actual reporting program:
call process(#rpt_proc) function(#rpt_func)
This general purpose routine could be even smarter. Instead of exchanging the output queue name to it, it might look up a table keyed by the user's identification to find his/her's associated output queue.
It could become the report controller for the site or system.