Some parameters of the Create Device Display (CRTDEVDSP) affect printing. They are OUTQ, PRTDEV, and PRTFILE.
The workstation can determine where to send all printed output generated by any user who uses the workstation.
To enable this feature, do one of the following:
Set your users' job descriptions to OUTQ(*WRKSTN).
Set your users' job descriptions to OUTQ(*USRPRF) and their user profiles to OUTQ(*WRKSTN).
Then, use the OUTQ and PRTDEV parameters in the workstation (the display device) to direct output to a given output queue or printer device. For example, you can set the parameters so that all output goes to output queue QPRINT, using the following command:
CHGDEVDSP DEVD(xxx) OUTQ(QPRINT)
You also can set the parameters so that all printed output goes to printer SYSPRT01, as follows:
CHGDEVDSP DEVD(xxx) OUTQ(*DEV) PRTDEV(SYSPRT01)
This technique is convenient in some environments. For example, you may have users who sign on to a number of workstations and request reports or press the Print key. If you use the technique described here, the user will have the requested printouts at the printer that you assigned to the workstation (which is, hopefully, the closest one).
The PRTFILE parameter determines which printer file is used by the system when the user presses the Print key. By default, PRTFILE has a value of QSYSPRT, which is a printer file located in QSYS and provided by IBM.
You can create your own printer files and assign them to workstations. Because printer files contain a number of attributes (such as form type, form size, and print text), you can make your Print key do all sorts of things.
For example, you could create a printer file called PRTKEY as follows:
CRTDUPOBJ OBJ(QSYSPRT) FROM LIB(QSYS) OBJTYPE(*FILE)+ TOLIB(xxx) NEWOBJ(PRTKEY)
This command creates a clone of QSYSPRT, names it PRTKEY, and places it in library xxx (one of your own libraries). Now change your new printer file as follows:
CHGPRTF FILE(PRTKEY) HOLD(*YES) USRDTA('Print Key')
Finally, assign this printer file to your display station. DSP01 is used in this example:
CHGDEVDSP DEVD(DSP01) PRTFILE(PRTKEY)
From now on, anyone who signs on to DSP01 and presses the Print key will produce a screen image that is automatically on hold and has a user data of ‘Print Key.’ If you changed all workstations (in addition to DSP01) the same way, all presses of the Print key, regardless of user, would have the same attributes.
Because it is automatically on hold, the screen image would not print if, for example, the user pressed the Print key by mistake. The user may have intended to press the Help key, for example. Having a user data of ‘Print Key’ allows you to list all the screen images using a single command:
WRKSPLF SELECT(*ALL *ALL *ALL 'Print Key')