Commands to Control Printed Output

Being able to control printed output is a natural concern. After all, you must be able to send it to the proper printer, make sure it uses the right type of forms, and so on. i5/OS provides a number of commands that let you do precisely that.

Before getting too far into the different tasks you can perform to control printer output, you should become familiar with at least two commands that present lists of reports as they exist in output queues. The two commands are:

  • Work with Output Queue (WRKOUTQ) command. If you run it without specifying any value in the OUTQ parameter, you accept the default value of *ALL. This value presents a list of output queues available in the system. From there, you can select one by keying in an option 5. Alternatively, you can display the reports in a specific output queue directly by giving its name in the OUTQ parameter. In this case, the output selection panel is skipped entirely.

  • Work with Spooled Files (WRKSPLF) command. This command lets you find reports in output queues by selection criteria other than output queue. The criteria you may use are:

    • the user who created a report;

    • the device to which a spooled file is assigned;

    • the form type;

    • the user data tag;

    • the auxiliary storage pool.

  • Work with Job (WRKJOB) command. Taking option 4 of the menu that this job displays presents a list of spooled files that were created by the job. Using this command, rather than WRKOUTQ and WRKSPLF, can save you much time and effort because the number of spooled files with which you must deal is reduced. Running WRKJOB with no parameters displays the current job. Also, be aware that commands that display lists of jobs, such as Work with Submitted Jobs (WRKSBMJOB), Work with User Jobs (WRKUSRJOB), and Work with Subsystem Jobs (WRKSBSJOB) include option 5 to execute WRKJOB and option 8 to display the spooled files created by a job.

Redirecting to a Specific Printer

A report can be redirected to a specific printer at three different times:

  • After the job begins, but before the report is generated.

  • After the report is generated, but before it begins printing. This is the best time to channel a report to a printer.

  • After it begins printing. If you discover that a report is printing on the wrong printer, you can hold it and redirect it.

To specify a printer at any of these times, you must execute the Change Spool File Attributes (CHGSPLFA) command to indicate the name of the new printer in the DEV parameter. To run the CHGSPLFA command successfully, you must give it the following information:

  • The name of the printer file, in the file parameter. This parameter is required.

  • The name of the job that generated the report, in the job parameter. This parameter defaults to *, which means your own interactive job. If you are changing someone else's report, you must supply the job name as a qualified name that consists of three parts.

  • The number of the spool file within the job, in the SPLNBR parameter. You can give an actual number, or use the special values *FIRST or *LAST.

Running CHGSPLFA manually is quite a challenge, because you probably would not have all the information required to run CHGSPLFA successfully.

Executing CHGSPLFA manually from the command line is too tedious and prone to error. It is far easier to run it as an option 2 from any of the list panels presented by the WRKXXX commands, such as WRKSPLF or WRKOUTQ. When you select option 2, the system fills out the FILE, JOB, and SPLNBR parameters for you. If the job has started but the report hasn't been produced yet, you must begin by running the Work with User Jobs (WRKUSRJOB) command and supplying the name of the user who started the job. This user may have more than one job started, so you need to find the job that will produce the report. When you find it, select option 2 to change the job, press Enter, and find the parameter that changes the printer that will print the report. Type the printer name and press Enter.

If the report has been generated, but has not started printing, use WRKOUTQ or WRKSPLF to find the report and key in option 2. When you press Enter, you will be able to change the printer name.

It is more difficult to change the printer if the report is already printing. Use WRKOUTQ or WRKSPLF to find the report, then key in option 3 to hold it. Now key in option 2 and change the printer name. Finally, key in option 6 to release the report; it will begin printing again, starting from page one. If you don't want it to start printing on page one, use option 2 to change the number of the starting page before you release the report.

Displaying a Report

Reports don't always have to be printed. Many times, the user who requested it only needs to look at the last page to check some bottom totals, or she wants to verify the report before printing it.

i5/OS makes it easy to display a report. Use WRKOUTQ or WRKSPLF to find the report, then key in option 5 to run the Display Spooled File (DSPSPLF) command, which is shown in Figure 5.3.

image from book
Figure 5.3: Example of the Display Spooled File (DSPSPLF) command.

Immediately, the system displays the first page of the report. You can roll back and forth to see other pages, use the Control input field to go to a specific part of the report, or use the Find input field to scan the report for a specific string of characters.

The Control field lets you shift the display window so that it begins on any given column. When you display the report (which runs the DSPSPLF command), the system shows the window with column 1 on the left margin of the window. If you are using an 80-column display, you won't be able to see all of it. Even 132-column displays are limited if the report is printed using more than 132 columns. Use the ‘W’ (window) command to shift the starting position for the column. To shift the window so it begins with column 41 on the left margin, for example, key in W41 and press Enter.

To go to a specific page, key in a ‘P’ followed by the page number. For example, ‘P75’ takes you directly to page 75. You can go directly to the first page with the ‘T’ (top) command, or to the bottom of the last page with the ‘B’ (bottom) command.

Other commands let you advance or move back through the window by a certain number of lines. For example, ‘-12’ takes you back 12 lines, and ‘+80’ moves you forward 80 lines. You can always display help information by placing the cursor on the control field and pressing the Help key.

The Find field is easy to use. Key in the string of characters you want to scan for and press F16 to scan. Each time you press F16, the scan resumes. This summary can continue until you reach the end of the report. You must enter alphabetic characters in the proper cases, because the scan is case-sensitive.

Changing a Report

You have already seen how to change a report so that it is redirected to a different printer. You can change many other attributes of a report. (Some attributes are unchangeable, however, such as the number of lines per page or the number of characters per inch.)

The process of changing report attributes is the same regardless of which attribute you want to change: Find the report first, then key in option 2 to change it. If the report is already printing, you will have to hold it first using option 3, and release it using option 6 after you have changed it.

Suppose you want to change the form type of a report (which you have already found) from *STD to *NCR2 (two-part NCR carbonless paper). Key in option 2 and roll the panel presented until you reach the form type prompt, as shown in Figure 5.4.

image from book
Figure 5.4: Example of the Change Spooled File Attributes (CHGSPLFA) command.

Key in *NCR 2 in lieu of *STD and press Enter; the report is then changed. This process can be tedious if several (or many) reports must be changed the same way. You can take a shortcut from either the WRKOUTQ or WRKSPLF panels: In option 2 for each report you want to change (they can be in different "pages" of the panel), move the cursor to the command line, type FORMTYPE(*NCR 2), and press Enter. See Figure 5.5.

image from book
Figure 5.5: Changing the form type of numerous spooled files at once.

All reports you marked with option 2 are changed at once.

This shortcut works because option 2 executes the CHGSPLFA command. The parameter to change the form type is FORMTYPE. You can change more than one attribute at the same time, for more than one report, using the same technique. For example, if you had to change not only the form type, but also the number of copies to 3, key in option 2 for each report, type FORMTYPE (*NCR 2) COPIES (3) at the command line and press Enter.

Deleting a Report

There are times when a user requests a report and then decides it isn't needed, or when the system generates some printed output that you do not want. In these cases, you must delete the reports. You can do that using the Delete Spool File (DLTSPLF) command. It is much easier, however, to use option 4 from either WRKOUTQ or WRKSPLF.

When you key in option 4 and press Enter, the system first asks you to confirm your intentions with the panel shown in Figure 5.6.

image from book
Figure 5.6: Delete spooled file confirmation panel.

You might have entered a 4 by mistake (maybe you wanted a 5 to display the report), or you might have placed the 4 next to the wrong report. If you change your mind, press F12 to cancel your delete request. If you want to continue, press Enter again.


If you need to delete many reports at one time, use the DLT-SPLF *SELECT option. This allows you to select which reports to delete by user, print device, form type, or user data. By default, it deletes every spooled file owned by the person issuing the command.

Holding and Releasing Spooled Files

If you want to make sure that a report doesn't print, but you do not want to delete it, you can hold it. The report will stay in the output queue, on hold, until it is released and printed or until someone deletes it.


If you need to start and stop the writer frequently, you should consider performing "soft" starts and stops using the Hold Writer (HLDWTR) and Release Writer (RLSWTR) commands.

To hold a report, you must run the Hold Spool File (HLDSPLF) command, or key in option 3 from either the WRKOUTQ or WRKSPLF command panel.

To release the report, run the Release Spool File (RLSSPLF) command, or key in option 6 from either of the panels mentioned above. Once released, the report becomes eligible for printing again, and it will start printing at the first page according to the PAGERANGE parameter.

Printing Part of a Report

At times, you may wish to print only part of a report. To do so, change the spooled file's PAGERANGE attribute. The PAGERANGE attribute consists of two values—the numbers of the first and last pages to print. For example, to print pages 10 through 25 of a report, use the following command:

      CHGSPLFA ... PAGERANGE(10 25) 

You may use the special *END for the second value to indicate that the last page to print is the last page of the report. You may use the special value *ENDPAGE to indicate that the only page to be printed is the one specified by the second value.

Restarting a Report

In the event of printer failure, you may have to restart the printing of a report at a certain page. To restart a report at a certain page, do the following:

  1. Hold the report.

  2. Change the report by specifying the desired start page number in the RESTART parameter.

  3. Release the report.

Once released, the report begins printing at the top of the page you specified in the second step.

IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
Year: 2004
Pages: 245 © 2008-2017.
If you may any questions please contact us: