RPGPGM.COM - From AS400 to IBM i › Changing name of Query/400 print file
I was asked a question about how to change the name of the spool file created by running Query/400.
The default print file for Query/400 output is QPQUPRFIL. The inquisitor wanted to change the name of the spool file to another which would allow the users to be able to identify it.
This can be achieved by using the OVRPRTF command.
Amongst the myriad of parameters available for the OVRPRTF command is the SPLFNAME parameter. Whatever is entered into this parameter will be the name of the spool file.
How is it done? The CL program below shows I could do it:
The OVRPRTF, on lines 2 and 3, is overriding the default Query/400's spool file name to be TESTQRY, which is the name of the Query/400. The OVRSCOPE parameter has been defined as *CALLLVL, which means that the override is to the current call level. Any Query/400 run by this program with the override in place will use that spool file name. Once the program has completed the override ends and Query/400 returns to using the QPQUPRFIL name again.
I have defined the QRYFILE for the RUNQRY command, line 4, as this will use the first IN_FILE in the library list, rather than the file defined within the Query/400. This makes sure that if I change the library list, for example from "production" to "testing", the Query will use the appropriate file.
If there are multiple Query/400s run in the same program the OVRPRTF command can be used to give each spool file a unique name.
After running the one query with a unique spool file name you wish to revert to using the default name for the other Query/400s you would use the DLTOVR to delete the override.
What I have shown above can be done with any spool file.
Therefore, this can be used for any reports to give the spool file a name that users can easily recognize as the report they want.
You can learn more about the override commands on the IBM website:
This article was written for OS i 7.1, and it should work with earlier releases too.
Read the original at RPGPGM.COM - From AS400 to IBM i.