View Full Version : OVRPRTF to a different call level
01-01-1995, 02:00 AM
I have written an RPG program that is called from menu CL's to OVRPRTF to the printers closest to the user. The RPG builds the OVRPRTF command and uses QCMDEXC to execute it. To make the override available once I leave the RPG I have been scoping it to LVL(*JOB), which has been causing some problems for me by interfering with other overrides. What I would like to be able to do is get the override scoped to the previous call level (the menu) without having to run an extra command in the menu.
11-01-2000, 08:00 AM
I'm not sure I follow what you are trying to do. If you always want the default printer to be the printer closest to the workstation, you can assign a default print device to the workstation itself. Dave
11-01-2000, 08:27 AM
There are many more decisions that this program is making rather than just where to send the printout. It is also deciding on different formtypes for different printers, different drawers, etc...
11-01-2000, 09:17 AM
Try the keywords SECURE(*YES) OVRSCOPE(*JOB). HTH John Panzenhagen
11-01-2000, 12:17 PM
The problem with scoping to the *JOB is best explained in the following example. /* PGM_A */ PGM OVRPRTMST FILE(QSYSPRT) FORMTYPE(LETTER) LVL(*JOB) /* From inside RPG */ CALL PGM(RPG_A) /* This RPG program calls PGM_B */ ENDPGM /* PGM_B */ OVRPRTMST FILE(QSYSPRT) FORMTYPE(LEGAL) LVL(*JOB) /* From inside RPG */ CALL PGM(RPG_B) ENDPGM When the override in PGM_B is executed, it will replace the override from PGM_A. Then when I return to RPG_A, I now have the wrong override. This scenario would work however if I would use call level scoping, but keep in mind that the overrides are actually being done inside of an RPG program. Scoping them to LVL(*JOB) is the only way that I can make them available beyond the RPG because the RPG has its own call level and the override would disappear once the RPG ends.
11-05-2000, 10:04 PM
Randy, May I suggest a different tack? The RPG program is already being called from the menu's CL programs right? Why not let the calling CL programs do the override? All you have to do is make the RPG program pass back the OVRPRTF code to the calling CL program and let the CL program execute it. This will eliminate the need to scope to LVL(*JOB).
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.