An introduction to #ibmi spooling, printing, and electronic output Mandy Shaw | [email protected] | Version 1 | 14 July 2012 With apologies to an IBM ITSO speaker a while back, there are two things that practically every IBM i site does: database and printing. The IBM i database gets plenty of attention on the web and in the media. Printing gets almost none, despite IBM’s provision of some really great functionality, a lot of it free of charge. So here’s an attempt at an overview of IBM i’s spooling, printing, and electronic output functions. The basic principle Applications that wish to produce spooled output will typically use the standard IBM i tactic of writing to an externally described device file, specifically a printer file (PRTF). This produces a spool file on an output queue. The contents of the output queue can then be printed or distributed electronically by a writer job which connects the output queue to a physical printer or to electronic output software. Summary of the overall provision The data stream within the spool file may be plain text (called SNA Character Stream, or SCS), or may have complex formatting and graphics (Advanced Function Printing, or AFP). IBM still provides the ability to print from Windows to an IBM i spool file using the IBM i Access Virtual Print function, but this is really of historical interest only. Physical printer attach can use industry standard protocols, or IBM’s Intelligent Printer Data Stream (IPDS) technology. There are also several options for the electronic distribution of spooled output. IBM also provides a set of access controlled management functions allowing spool files to be displayed, deleted, or moved between output queues. Creating printer files Printer files normally use IBM i Data Description Specifications (DDS: see example to the left), which define what goes into the spool file data stream. The DDS is compiled into a printer file object via the CRTPRTF command. There are many other attributes we may need to specify: output queue to be used, type of paper to be used (form type), number of lines to be printed before next page is loaded, paper drawer to be chosen, etc. These are specified via CRTPRTF command parameters. A note on form types The first thing you may come up against, when you start printing IBM i output, is a console message asking you to load form type *STD. Your reaction is likely to be something like ‘What are you talking about, IBM?’ This is one of those occasional IBM i ‘history of IBM computing’ moments. The organisation has various paper types: letterheads, cheques, plain paper. It’s obviously important to make sure the spool file is printed on the right sort of paper. So you give each paper type a name, which is the form type; you specify a form type on your printer file; and the system makes you check you’ve loaded the right form type before it prints anything. If you don’t specify a form type, IBM uses a default one, *STD. Simple, effective, but so different from the way these things work in 2012 in the world outside IBM i (and mainframes) that it probably needs explaining. Writers Writer jobs run in the QSPL subsystem and are started via STRxxxWTR commands. STRPRTWTR links the output queue to a configured printer device, which is nowadays very unlikely to be physically attached to the IBM i system: rather, it will be out on the network somewhere. STRRMTWTR forwards the spool files to a spool queue on a remote server (whether IBM i or otherwise) using LPR/LPD and a remote output queue; this is no longer a recommended approach – see below. What is Advanced Function Printing (AFP)? AFP is a set of IBM technologies that together provide rich printed output and form filling capabilities: AFP Resources (separate IBM i objects): o Page Segments – rich components of a generated page, e.g. images; o Overlays – used to overlay a printed page with letterheads, watermarks, etc.; o Fonts; o Form Definitions – override the ‘form’ attributes of the printer file, e.g. print drawer, form type; o Page Definitions – override the ‘page’ attributes of the printer file, e.g. number of lines per page; AFP Data Stream (AFPDS) – this is what an AFP spool file contains, including references to the above (separately stored) AFP resource objects; AFP Designer (now marketed for IBM i as Infoprint Designer) – rather old fashioned software package previously used to define AFP resource objects. In practice Page Segments (*PAGSEG) and Overlays (*OVL) are very much more frequently used on IBM i than the other resource types. Page Segments and Overlays are typically now created via the IBM i Access AFP Workbench Viewer feature. An example is documented here. To the right is a very simple example of printer file DDS using a logo stored as a Page Segment object. Printer files actually now support direct specification of JPG or TIF images in the DDS - these are effectively treated as inline AFP page segment resources. See later for an example. AFP is frequently used on the IBM i platform for the printing of barcodes. Again see later for an example. The really key point is that AFP is all about software – it has nothing to do with printer hardware. The AFP data stream can be transformed to print on any modern printer (network attached or other). On the IBM i this is done via either Print Services Facility (full support) or Host Print Transform (limited support). PSF is a chargeable licensed program; the charge is banded according to relevant print volumes. Printer attachment With two-way communication [green arrows] IBM i is always aware of printer status (e.g. page number reached). Prints direct to printer. Configured via CRTDEVPRT. Print writer started via STRPRTWTR. Industry standard SNMP, PJL, or IPP printing: o Choice of protocol depends on situation, e.g. SNMP provides optimal printer resource sharing; IPP allows printing from outside network over SSL; PJL works on any printer that supports PCL5. o Limited support for AFP data stream via IBM i’s built-in Host Print Transform functionality. o Full support for AFP data stream can be obtained via the chargeable Infoprint Server product (see below). Or use Windows printer on desktop via emulation software (e.g. Rumba): o AFP data stream support via Host Print Transform/Infoprint Server as above. Or Intelligent Printer Data Stream: o Network attached printers with IPDS either built in or provided via specialised adapter. o AFP data stream supported fully and direct (though chargeable PSF licensed program required). Remote output queue printing (LPR/LPD) [red arrows] IBM i is not aware of printer status. Prints to queue on remote print server (i.e. remote output queue) - specified via RMTSYS and RMTPRTQ parameters on CRTOUTQ. Print writer started via STRRMTWTR. AFP data stream support via Host Print Transform/Infoprint Server as above. Historically this mechanism was widely used, but the other industry standard options now available are to be preferred. Host Print Transform and its configuration Host Print Transform translates the spool file data stream to the appropriate ASCII printer data stream. It is configured (e.g. to indicate the type of ASCII printer involved) on CRTDEVPRT or (for LPR/LPD) CRTOUTQ. The Manufacturer Type and Model (MFRTYPMDL) parameter has many possible values, covering a wide range of printers. If these do not meet your needs, you can customise the configuration by specifying MFRTYPMDL(*WSCST) and creating a Workstation Customisation object (*WSCST) to meet your needs. Fortunately it is possible, as a basis, to retrieve the source of a suitable IBM-supplied *WSCST. Just Some of the Electronic Output Possibilities The chargeable Infoprint Server product permits the transformation of AFP data stream spool files into PDF files, which can then be emailed out automatically (using IBM i’s built-in SMTP functionality) and/or stored in the IFS. PSF Configuration objects (*PSFCFG) are used to configure these facilities. SCS data stream spool files can be converted into indexed AFP ones, which when transformed into PDFs will automatically have appropriate bookmarks in place. Electronic Output Example 1 – automatically emailed PDF with inline graphic Electronic Output Example 2 – indexed PDF containing barcodes
© Copyright 2026 Paperzz