Troubleshooting
Problem
This document provides information on basic printing concepts for the IBM i5/OS operating system.
Resolving The Problem
This document provides information on basic printing concepts for the IBM i5/OS operating system.
Much of this information comes directly from the System i Printing: Basic Printing publication, which is available online at:
This document was last updated on 15 May 2012.
i5/OS Printing Concepts
Read this section for an overview of the printing function and related concepts.
Overview
These steps give a high-level overview of the i5/OS printing process.
| 1. | The printing process starts when an application program runs. The application program creates output data. The output data is based on the application program and information contained in the printer file. |
![]() | |
| 2. | Spooling versus Direct Printing If print spooling is selected, the output data is placed in a spooled file and the spooled file is placed in an output queue. If direct printing is selected, the output data is sent directly to the printer. |
| Spooled Output If print spooling is selected, the output data is placed in a spooled file and the spooled file is placed in an output queue. The destination of the output data is based on values stored in several printing elements:
Note: Spooled files can also be received from other i5/OS and non-i5/OS systems. This is typically done using i5/OS NetServer print shares, using the Line Printer Requester (LPR) TCP/IP protocol, or using FTP to a printer file. | |
| Output Queues Output queues are used to store and manage spooled files. Spooled files in output queues can be:
| |
![]() | |
| Direct Printing Direct printing, which is specified by setting the Spool the data (SPOOL) parameter to *NO or SPOOL(*NO), is only allowed with printers that are twinax attached through either a local or remote workstation controller. Note: LAN printing requires generating a spooled file in an output queue, which is specified by setting the Spool the data (SPOOL) parameter to YES or SPOOL(*YES), due to the nature of printing through a Local Area Network (LAN) or Wide Area Network (WAN). This includes the following methods of configuring a printer in i5/OS:
| |
| 3. | Printer Writer The printer writer program interacts between the output queue and the printer and can be used to convert the printer data stream. The printer writer program included in i5/OS supports a variety of printer data streams. Print Services Facility™ for i5/OS provides additional function that provides support for the Advanced Function Presentation (AFP) Intelligent Printer Data Stream (IPDS). Each printer must have a printer device description. The printer device description contains a configuration description of the printer. Printers can be attached by a variety of attachment methods. A remote writer allows you to route spooled files from an output queue on your system to another system. |
![]() |
Printer File
Printers attached to System i products are supported by the i5/OS operating system through printer files.
Printer File Overview
Printer files describe how the system operates on the data as it passes between your application program and a printer.
A printer file handles every request for printing with one exception. It applies only to the Print key when the display station has an attached remote workstation controller. In this situation, the printer that is named in the device description for that display station receives the printed version of the display screen. The remote workstation controller, not the system, handles this.
Printer files contain many parameters that tell the system how the output should be formatted, what font
to use for the printed output, whether to print on both sides of the page, and more. For example, the
parameters that control how your output is handled and where it goes are:
Spool the data (SPOOL). *YES is the default value for the SPOOL parameter.
When the SPOOL parameter is set to *YES, the output from an application program (a spooled file) is sent to an output queue (OUTQ). When SPOOL = *YES, the system looks at the OUTQ parameter in the printer file to find out which output queue (OUTQ) to send the spooled file to. For example, the OUTQ value in your printer file can be OUTQ1. However, in the default printer file, QSYSPRT, the value specified is *JOB. This means that the QSYSPRT printer file tells the system to look at your job’s OUTQ attribute to determine the name of the output queue (OUTQ).
When the SPOOL parameter is set to *NO, the output from an application program is sent directly to a printer. When SPOOL = *NO, the system looks at the DEV parameter in the printer file to find out which printer to send the output to. For example, the DEV value in your printer file can be PRT01. However, in the default printer file, QSYSPRT, the value specified is *JOB. This means that the QSYSPRT printer file tells the system to look at your PRTDEV job’s attribute to determine the name of the printer device (DEV).
Device (DEV). The device parameter indicates the name of a printer device description. If SPOOL =
*NO is specified, the device parameter identifies the printer device used to produce the printed output.
If SPOOL = *YES is specified, the device (DEV) parameter is ignored unless *DEV is specified for the output queue parameter. In that case, the default output queue for the specified printer is used for the spooled files.
Spooled output queue (OUTQ). The output queue parameter indicates which output queue your spooled files are sent to. If you have a program that creates large print jobs you might consider sending them to an output queue that will hold those spooled files until most of your printer work for the day is done. Doing this can help users who have lots of small jobs get their jobs printed in a reasonable amount of time.
Spooled file owner (SPLFOWN). The SPLFOWN parameter specifies which user profile owns a file. The spooled file can be owned by the current job, a QPRTJOB for the current user, a group profile for the current user, or the group profile of the current job’s user. For example, for system job debugging purposes, you might want the current job to own all service dumps, instead of the current user. To accomplish this, you can set the parameter to the special value of *JOB for the QPSRVDMP printer file. There are two different types of printer files:
v Program-described printer files rely on the high-level language program to define records and fields to be printed.
v Externally described printer files use data description specifications (DDS) rather than the high-level language to define records and fields to be printed. DDS gives the application programmer much more format and print control over the printed output.
You can create your own printer files by using the Create Printer File (CRTPRTF) CL command, or you can use system-provided printer files. See Printer file parameter considerations for more detailed information about certain printer file parameters.
The following list contains the IBM-supplied printer files:
v QSYSPRT: A program-described printer file in library QSYS.
v QPRINT: Default spooled output printer file for normal print.
v QPRINTS: Default spooled output printer file for special forms.
v QPRINT2: Default spooled output printer file for two copies of output.
v QPSPLPRT: Default spooled output printer file for the spooling subsystem.
If another printer file is not specified, the printer uses the default printer file. The default printer file for the system is QSYSPRT.
Printer File Overrides
Overriding files (printer files, display files, diskette files, database files, and tape files) can be done by commands, from CL programs, or from high-level language programs. Overrides can be called from different levels (programs calling another program). This article discusses overriding printer files.
Overrides are used to temporarily specify a different printer file or temporarily change some of the attributes of a file. An override is only active for the current sign on session. As soon as you end your session or use the Delete Override (DLTOVR) command, the override is no longer active.
Override commands can be entered interactively from a display station or as part of a batch job. They might be included in a control language (CL) program, or they might be issued from other programs through a call to the program QCMDEXC. Regardless of how they are issued, overrides remain in effect only for the job, program, or sign on session in which they are issued. Overrides have no effect on other jobs that might be running at the same time.
Overrides are particularly useful for making minor changes to the way a program functions or for selecting the data on which it operates, without having to recompile the program. Their principal value is
in allowing you to use general purpose programs in a wider variety of circumstances. Examples of items where overrides can be used are:
v Changing the name of the file to be processed
v Indicating whether output is to be spooled
v Changing printer characteristics such as lines per inch and number of copies
It is also possible to use overrides to direct data input or data that is sent to a device of a different type.
For example, sending data that is intended for a diskette to a printer instead. This use of overrides requires somewhat more foresight than the override applications listed above. The program must be able to accommodate the different characteristics of the two devices involved. For information about the special considerations that are required for overrides that change the file type or redirect files, see the Distributed data management topic.
Files are associated with an application program by the file names specified in the program when it is created. You can override these file names or attributes of a specified file when you compile a program or run a program. The system supplies three override functions: applying overrides, deleting overrides, and displaying overrides. You can process override functions for files using the following CL commands:
v Override with Printer File (OVRPRTF) command
v Delete Override (DLTOVR) command
v Display Override (DSPOVR) command
You can use overrides to change most, but not all, of the file attributes that are specified when the file is
created. In some cases, you can specify attributes in overrides that are not part of the original file definition. Refer to the command descriptions for more information. Overriding a file is different from changing a file in that an override does not permanently change the attributes of a file. For example, if you override the number of copies specified in a printer file by requesting six copies instead of two, the file description for the printer file still specifies two copies, but six copies are printed. The override command tells the system which file to open and what its file attributes are.
CL Program Override Considerations
If a CL program overrides a file and then calls a high-level language program, the override remains in effect for the high-level language program. However, if a high-level language program calls a CL program that overrides a file, the override is deleted automatically when control returns to the high-level language program.
High-level language program:
CALL CLPGM1
CL program:
OVRPRTF FILE(PRTF1) TOFILE(MSTOUT)
.
.
.
ENDPGM
High-level language program:
OPEN PRTF1
The file opened is PRTF1, not MSTOUT. This is because the override in the CL program is deleted when the CL program ends.
Securing Printer Files
You might want to prevent the person or program that calls your program from changing the printer file
names or parameters you have specified.
You can prevent additional printer file overrides by specifying SECURE(*YES) on the printer file override command for each printer file you want to protect from overrides.
Spooled Files and Output Queues
The spooling function places spooled files (also known as printer output) in an output queue. This allows you to manage your printing operations more effectively.
Spooling Overview
Spooling functions are performed by the system without requiring any special operations by the program that creates the output. When a program opens a printer file, the operating system determines if the output is to be spooled by looking at the printer file SPOOL parameter.
When a printer file specifying spooling is opened, the spooled file containing the output of the program (data to be printed) is placed on the appropriate output queue in the system. A spooled file can be made available for printing when the printer file is opened, when the printer file is closed, or at the end of the job. This is done by specifying a particular value on the schedule parameter. *IMMED makes the spooled file available to the writer as soon as the program is opened. *FILEEND makes the spooled file available to the writer as soon as the file is closed. *JOBEND makes the spooled file available to the writer as soon as the job is complete.
This process of spooling prevents a potential job limitation imposed by the availability or speed of the printer devices. That is, the system can process application programs that generate printed output much faster than printers can print the output.
By spooling (that is, sending the output to output queues to await printing), the system does not have to wait until the printing for that application program is complete before it can start processing the next application program.
Spooling is especially important in a multiple-user environment where the number of jobs running often exceeds the number of available printer devices. Using spooling, output can be easily redirected from one output queue to another or from one printer to another.
Spooled Files
Spooling is a system function that saves data in a database file for later processing or printing. This data, which is saved and eventually printed, is called a spooled file (or printer output file). When spooling is used, spooled files are created from the application program, from a system program, or by pressing the Print key. These files are put in places called output queues.
Almost all application programs that generate printed output make use of the spooling support provided by the i5/OS operating system. The values SPOOL(*YES) and SPOOL(*NO) on the SPOOL parameter of a printer file determine whether spooling support is requested.
Using the Print key to capture an image of a display screen almost always results in a spooled file being created (SPOOL = *YES must be specified in the printer file named in the workstation device description). Unless the value has been changed, the default value for the SPOOL attribute in the QSYSPRT printer file is *YES. When the Print key is pressed, the system looks at the OUTQ parameter in the QSYSPRT printer file to determine which output queue to send the spooled file to.
Spooling (SPOOL = *YES) has several advantages over direct output (SPOOL = *NO in the printer file):
v The user’s display station remains available for work.
v Other users can request printing work without having to wait for the printer to become available.
v If special forms are required, you can have the spooled files sent to a special output queue and printed at a time when the printer is not busy.
v Because disk operations are much faster than printers, the system is used efficiently.
Output Queues
Output queues are objects, defined to the system, that provide a place for spooled files to wait until they are printed. Output queues are created by a user or by the system.
You can create an output queue using the Create Output Queue (CRTOUTQ) command. On the prompt display, specify the name for the output queue to create. The output queue will be in the library identified by the library prompt. You can create as many output queues as you want.
When a printer is configured to the system, either manually or through automatic configuration, the system creates an output queue for that printer in the QUSRSYS library. System-created output queues are commonly called device output queues and have the same name as the printer device. For example, when you configure a printer using the Create Device Description (Printer) (CRTDEVPRT) command, if you assign the printer name PRT01 in the DEVD parameter, the system creates an output queue named PRT01 in the QUSRSYS library.
If none of the IBM-supplied default values for the system have been changed, you can identify your output queue by displaying the system value Default printer (QPRTDEV). Your output queue has the same name as the value shown for the system printer.
Spooled files are created when application programs are run. If you do not want the spooled files to print right away, you can have them sent to an output queue that currently does not have a printer assigned to it. For example, let us assume that you have only one printer available. One of your application programs creates a job that has 600 pages of printed output. Since all users are using the same printer, you do not want to print the 600-page job until everyone has finished working for the day. One solution is to create two separate output queues. One output queue receives the spooled files from the application program that creates the 600 pages of printed output. The other output queue receives the spooled files from the jobs run by other users.
The program that creates the 600-page job sends the spooled file to a specific output queue. That output queue does not have a printer assigned to it. Therefore, the 600-page spooled file has to wait until a printer is assigned; meanwhile, the spooled files that are in the other output queue can be printed.
Multiple output queues can also be used with deferred printing. To print a large spooled file that exceeds the current limit for the printer’s output queue, the printer can be assigned to an output queue without any limit. Another solution is to set the maximum spooled file size to print during a specified time. For example, a maximum spooled file size of 100 pages can be set from 08:00:00 to 17:30:00 hours. During this time, only spooled files of 100 or fewer pages are printed. After 5:30 p.m. any spooled file prints. Spooled files that are too large are placed in deferred status (*DFR) until they can be printed.
[{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Print","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]
Historical Number
633945739
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1010983


