0% found this document useful (0 votes)
47 views589 pages

Printer Device Programming

The document is the fifth edition of the iSeries Printer Device Programming manual, specifically for version 5 release 1 of the IBM Operating System/400. It covers various aspects of printer file support, spooling, and advanced function printing (AFP), providing detailed information on printer file parameters, output processing, and remote system printing. The manual is intended for users involved in printer device programming and includes numerous examples and commands for effective usage.

Uploaded by

afau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views589 pages

Printer Device Programming

The document is the fifth edition of the iSeries Printer Device Programming manual, specifically for version 5 release 1 of the IBM Operating System/400. It covers various aspects of printer file support, spooling, and advanced function printing (AFP), providing detailed information on printer file parameters, output processing, and remote system printing. The manual is intended for users involved in printer device programming and includes numerous examples and commands for effective usage.

Uploaded by

afau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd



iSeries
Printer Device Programming
Version 5
SC41-5713-04


iSeries
Printer Device Programming
Version 5
SC41-5713-04
Note
Before using this information and the product it supports, be sure to read the information in
“Notices” on page 551.

Fifth Edition (May 2001)


+ This edition applies to version 5 release 1, modification 0 of the licensed program IBM Operating System/400
+ (Program 5769-SS1), and to all subsequent releases and modifications until otherwise indicated in new editions. This
+ edition applies only to reduced instruction set computer (RISC) systems.
+ This edition replaces SC41-5713-03.
© Copyright International Business Machines Corporation 1997, 2001. All rights reserved.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
About Printer Device Programming Chapter 2. Printer file support . . . . . 41
(SC41-5713) . . . . . . . . . . . . . ix What is a printer file? . . . . . . . . . . . 41
Who Should Read This Book. . . . . . . . . ix Different types of printer files . . . . . . . 41
Conventions and Terminology Used in This Book . . ix What parameters make up a printer file? . . . 41
AS/400 Operations Navigator . . . . . . . . ix Creating a printer file . . . . . . . . . . . 46
Prerequisite and Related Information . . . . . . ix IBM-supplied printer files . . . . . . . . 46
Using Print Services Facility for OS/400 (PSF/400) x User-created printer files . . . . . . . . . 46
When is PSF/400 Required? . . . . . . . . x Using a program-described printer file with an
When is PSF/400 Optional? . . . . . . . . xi application program . . . . . . . . . . . 47
Printer File Parameter Keywords Requiring Open processing. . . . . . . . . . . . 49
PSF/400 . . . . . . . . . . . . . . xi Output processing . . . . . . . . . . . 56
PrintManager/400 . . . . . . . . . . . xii Close processing. . . . . . . . . . . . 58
How to send your comments . . . . . . . . xii Using an externally-described printer file with an
application program . . . . . . . . . . . 59
Summary of Changes . . . . . . . . xv Open processing. . . . . . . . . . . . 60
Output processing . . . . . . . . . . . 61
Close processing. . . . . . . . . . . . 67
Part 1. Introduction to printing on Output from the example application programs . . 68
AS/400 . . . . . . . . . . . . . . . 1 Using a program-described printer file . . . . 68
Using an externally described printer file (using
DDS) . . . . . . . . . . . . . . . 68
Chapter 1. Understanding printing
Overriding printer files . . . . . . . . . . 69
elements of the AS/400 system . . . . . 3 Applying overrides . . . . . . . . . . . 70
Learning about printing elements and terminology . 3 Deleting overrides . . . . . . . . . . . 73
Learning how printing is done on the AS/400 Displaying overrides . . . . . . . . . . 74
system . . . . . . . . . . . . . . . 5 Changing printer files . . . . . . . . . . . 74
Learning where printed output goes . . . . . 6 Using printer file parameters . . . . . . . . 75
Learning about printer files . . . . . . . . 7 Using the device type (DEVTYPE) parameter . . 75
Learning about spooling and spooled files . . . 10 Using the SCHEDULE parameter . . . . . . 76
Learning about output queues (CRTOUTQ). . . 12 Using the OUTPTY parameter . . . . . . . 77
Controlling print activity . . . . . . . . . . 13 Using the align (ALIGN) parameter . . . . . 77
Learning about the printer writer program . . . 14 Using the page rotation (PAGRTT) parameter . . 78
Understanding the hierarchy of the printing Using the MULTIUP(1, 2, 3, or 4) and
elements . . . . . . . . . . . . . . 15 REDUCE(*TEXT) parameters . . . . . . . 81
How the printing elements control print activity 22 Using the MULTIUP(1, 2, 3, or 4) and
Other elements that control print activity . . . 22 REDUCE(*NONE) parameters . . . . . . . 86
Examples: where your printing would go . . . . 23 Using the fidelity (FIDELITY) parameter . . . 88
Example 1: Determine your output queue . . . 23 Using the overlay (FRONTOVL and BACKOVL)
Example 2: Determine your output queue . . . 24 parameters . . . . . . . . . . . . . 89
| Example 3: Determine your output queue . . . 25 Using the margin (FRONTMGN and
| Example 4: Determine your output queue . . . 26 BACKMGN) parameters . . . . . . . . . 93
| Example 5: Determine your output queue . . . 26 Using the corner staple (CORNERSTPL)
Example 6: Determine your output queue . . . 28 parameter . . . . . . . . . . . . . . 96
Example 7: Determine your output queue . . . 28 Using the edge stitch (EDGESTITCH) parameter 96
| Example 8: Determine Your Printer Name . . . 29 Using the saddle stitch (SADLSTITCH)
| Example 9: Determine Your Printer Name . . . 30 parameter . . . . . . . . . . . . . . 98
Printing in a batch environment . . . . . . 31 Using the DBCS coded font (IGCCDEFNT)
Self-test: Determining output queue and printer parameter . . . . . . . . . . . . . . 99
device . . . . . . . . . . . . . . . . 33 Using the font character set (FNTCHRSET)
Self-test answers . . . . . . . . . . . . 34 parameter . . . . . . . . . . . . . . 99
Where to find more examples . . . . . . . . 36 Using the coded font (CDEFNT) parameter . . 100
Special printer file considerations. . . . . . . 100
Part 2. Printer file and spooling Direct print considerations . . . . . . . . 100
Open considerations . . . . . . . . . . 100
support . . . . . . . . . . . . . . 37
Output considerations . . . . . . . . . 101
Close considerations . . . . . . . . . . 101

© Copyright IBM Corp. 1997, 2001 iii


First-character forms-control data. . . . . . 101 Using the DSPUSRPRTI Command . . . . . 173
Printer font support . . . . . . . . . . 103 Using the RTVUSRPRTI Command . . . . . 173
Using graphic symbol sets . . . . . . . . 106 Send and Defer Status of Spooled Output Files . . 174
Replacing on unprintable characters . . . . . 106 Spooled Output File Attributes . . . . . . 175
Using alternative character sets and code pages Preparing AS/400 V3R1 or later to AS/400 V3R1 or
for printer output . . . . . . . . . . . 107 later for Remote System Printing . . . . . . . 176
Print text . . . . . . . . . . . . . . 109 Source System Activity - Creating the Remote
Editing output fields . . . . . . . . . . 110 Output Queue . . . . . . . . . . . . 178
Effect of changing fields in a file description . . 111 Target System Activity - Printing Spooled
Redirecting output. . . . . . . . . . . 112 Output Files from the Source System . . . . 179
3812 and 3816 SCS printer considerations . . . 116 Preparing AS/400 V3R1 or later to AS/400 V2R3
3835 printer considerations . . . . . . . . 116 for Remote System Printing . . . . . . . . 181
3912, 3916, and 4028 printer considerations . . 116 Source System Activity - Creating the Remote
Printing a graphic along with other output . . 117 Output Queue . . . . . . . . . . . . 183
Special printer file considerations for AFPDS . . . 118 Target System Activity - Printing Spooled
Considerations for printer file parameters . . . 118 Output Files from the Source System . . . . 185
Considerations for sending an AFPDS spooled Preparing AS/400 V3R1 or later to VM/MVS for
file to another system. . . . . . . . . . 118 Remote System Printing . . . . . . . . . . 186
Special DDS considerations for AFPDS . . . . . 119 Source System Activity - Creating the Remote
Performance considerations. . . . . . . . . 120 Output Queue . . . . . . . . . . . . 188
Target System Activity - Printing Spooled
Chapter 3. Spool support . . . . . . 123 Output Files from the Source System . . . . 189
Overview: Why spooling is important . . . . . 123 Preparing AS/400 V3R1 or later to PS/2 with PSF
Spooling elements . . . . . . . . . . . . 124 for OS/2 for Remote System Printing . . . . . 189
Application program . . . . . . . . . . 124 Source System Activity - Creating the Remote
Printer file . . . . . . . . . . . . . 125 Output Queue . . . . . . . . . . . . 190
Printer device descriptions . . . . . . . . 125 Target System Activity - Printing Spooled
Output queues . . . . . . . . . . . . 125 Output Files from the Source System . . . . 192
Printer writer program . . . . . . . . . 138 Preparing AS/400 V3R7 or later to NetWare for
Remote writer program . . . . . . . . . 139 Remote System Printing . . . . . . . . . . 192
Using multiple printer writer support . . . . 140 Source System Activity - Creating the Remote
Using a printer for both spooled files and direct Output Queue . . . . . . . . . . . . 193
print jobs . . . . . . . . . . . . . . . 141 Target System Activity - Printing Spooled
Enabling the allow direct print function . . . 141 Output Files from the Source System . . . . 194
Managing spooled files . . . . . . . . . . 142
Using the work with spooled files (WRKSPLF) Chapter 5. Working with the OS/400
command . . . . . . . . . . . . . 142 Network Print Server . . . . . . . . 195
Restarting and controlling printing . . . . . 148 How is the network print server accessed? . . . 195
Spooled file security . . . . . . . . . . 148 Prestart Jobs and the Network Print Server . . 196
Controlling the number of spooled files in your Exit Points and the Network Print Server . . . . 197
system . . . . . . . . . . . . . . 150 AS/400 Registration Facility and the Network
Spooled file names . . . . . . . . . . 151 Print Server . . . . . . . . . . . . . 198
Redirecting spooled files. . . . . . . . . 152 Using the OS/400 Network Print Server Exit Points 198
Copying spooled files . . . . . . . . . 152 Exit Point QIBM_QNPS_ENTRY . . . . . . 199
| Sample commands for additional spooling Exit Point QIBM_QNPS_SPLF . . . . . . . 200
| support . . . . . . . . . . . . . . 156 Parameter Field Descriptions . . . . . . . 202
Working with job and file separators . . . . 156
Using application program interfaces (APIs) . . 157
Working with a QPRTJOB . . . . . . . . 157 Part 3. Advanced function printing
(AFP) . . . . . . . . . . . . . . 203
Chapter 4. Remote System Printing 159
Benefits of Using Remote System Printing . . . . 159 Chapter 6. What Is Advanced Function
How remote system printing works . . . . . . 160 Printing (AFP)? . . . . . . . . . . 205
The Role of the Create Output Queue Frequently used terms . . . . . . . . . . 205
(CRTOUTQ) Command in Remote System Advanced Function Printing Data Stream (AFPDS) 206
Printing . . . . . . . . . . . . . . 161 What this part of the manual will do for you . . . 206
Role of the Start Remote Writer (STRRMTWTR) Using the configuration examples . . . . . . 207
Command When Using Remote System Printing 169
Working With User Print Information . . . . . 173
Using the CHGUSRPRTI Command . . . . . 173

iv OS/400 Printer Device Programming V5R1


Chapter 7. Resources needed to Printing AFPDS data on the AS/400 system . . 243
perform Advanced Function Printing
(AFP) . . . . . . . . . . . . . . . 209 Chapter 10. Working with print
Working with AFP resources and libraries . . . . 210 services facility (PSF) configuration
Fonts and font libraries . . . . . . . . . . 210 objects . . . . . . . . . . . . . . 245
Font resource objects . . . . . . . . . . 211 About PSF configuration commands. . . . . . 245
Fonts from System/390 . . . . . . . . . 211 Creating a PSF configuration object . . . . . 245
Fonts provided by the OS/400 program . . . 212 Changing a PSF configuration object . . . . 245
Advanced Function Printing Fonts/400 Displaying a PSF configuration object . . . . 245
(Program 5769-FNT) . . . . . . . . . . 213 Deleting a PSF configuration object . . . . . 245
AFP font collection . . . . . . . . . . 213 Working with PSF configuration objects . . . 245
Advanced Function Printing DBCS Fonts/400 Using PSF configuration objects . . . . . . 246
(Program 5769-FN1) . . . . . . . . . . 216 Working with IPDS pass-through support for PSF
Page segments . . . . . . . . . . . . . 216 for OS/400 . . . . . . . . . . . . . . 246
Overlays . . . . . . . . . . . . . . . 216 Why use IPDS pass-through support? . . . . 246
Form definitions . . . . . . . . . . . . 217 How IPDS pass-through function works . . . 247
Created with AFP PrintSuite for OS/400 . . . 217 IPDS pass-through limitations . . . . . . . 247
Provided with the AS/400 system . . . . . 217 Enabling IPDS pass-through support . . . . 248
Downloaded from System/390 . . . . . . 218 | IPDS to PDF transform . . . . . . . . . . 250
Inline from System/390 . . . . . . . . . 218 | Format of the printer file’s USRDFNDTA mail
FORMDF parameter on printer file . . . . . 218 | information . . . . . . . . . . . . . 250
Page definitions . . . . . . . . . . . . 219 | Format of the STRPAGGRP mail tag. . . . . 250
PAGDFN parameter on printer file . . . . . 221 | IPDS to PDF transform device configuration . . 251
Sharing print sessions and IPDS dialogs . . . . 254
Chapter 8. Working with line data. . . 223 Parameters supporting printer session and
DEVTYPE values . . . . . . . . . . . . 223 dialog sharing . . . . . . . . . . . . 255
CTLCHAR values . . . . . . . . . . . . 224 Additional information on session sharing. . . 257
TBLREFCHR parameter . . . . . . . . . . 224 Parameters supporting automatic session
AFPCHARS parameter . . . . . . . . . . 225 recovery . . . . . . . . . . . . . . 257
| CVTLINDTA parameter . . . . . . . . . . 225 User and device resource library lists . . . . . 258
Application considerations for line data . . . . 225 User resource library list . . . . . . . . 258
Device type considerations . . . . . . . . . 226 Device resource library list . . . . . . . . 259
Carriage control characters . . . . . . . . . 226
ANSI carriage control characters . . . . . . 227 Part 4. Other printing functions
Machine carriage control characters . . . . . 227
Table reference characters (TRC) . . . . . . . 229
available on the AS/400 system . . 261
Line data and IGC parameters. . . . . . . . 229
INVDTAMAP (invoke data map) keyword . . . 231 Chapter 11. Working with ASCII
INVMMAP (medium-map-name) DDS keyword 232 Lexlink protocol LAN-attached
Restrictions when using line data and mixed data 232 printers . . . . . . . . . . . . . . 263
Benefits of using ASCII LAN-attached printers . . 263
Chapter 9. Printing AFPDS data . . . 235 How ASCII LAN-attached printing works . . . . 264
Printing AFPDS data generated on the AS/400 Restrictions when using ASCII LAN-attached
system . . . . . . . . . . . . . . . 235 printers . . . . . . . . . . . . . . 266
System/390 AFPDS and line data . . . . . . 235 Line, controller, and device description parameters
Working with the System/390 . . . . . . . . 236 that support ASCII LAN-attached printers. . . . 267
Sending print data to the output queue of a Line description parameters that support ASCII
user ID . . . . . . . . . . . . . . 236 LAN-attached printers . . . . . . . . . 267
System/390 parameters and matching AS/400 Controller and device description parameters
printer file parameters . . . . . . . . . 237 that support ASCII LAN-attached printers. . . 267
Managing print data sent to an AS/400 output Network device description parameters that
queue . . . . . . . . . . . . . . . 240 support ASCII LAN-attached printers . . . . 268
Sending resources and AFPDS data to network Printer device description parameters that
files . . . . . . . . . . . . . . . 241 support ASCII LAN-attached printers . . . . 268
Receiving resources and AFPDS data sent to Configuring and starting ASCII LAN-attached
network files . . . . . . . . . . . . . 241 printers . . . . . . . . . . . . . . 271
Using the Work with Network Files
(WRKNETF) and Receive Network File Chapter 12. Working with ASCII
(RCVNETF) Commands . . . . . . . . . 242 TCP/IP network-attached printers . . . 273
Creating resources on the AS/400 system . . . 243

Contents v
HP printer job language (PJL) . . . . . . . . 273 Chapter 14. Working with the image
| Simple network management protocol (SNMP) . . 273 print transform function . . . . . . . 303
Benefits of using ASCII TCP/IP network-attached What is the image print transform function? . . . 303
printers . . . . . . . . . . . . . . . 273 Why use the image print transform function? . . 303
How ASCII TCP/IP network-attached printing Printing with image print transform function . . . 304
works . . . . . . . . . . . . . . . . 274 Printing to an ASCII printer . . . . . . . 304
Restrictions when using ASCII TCP/IP Printing to an IPDS printer . . . . . . . . 304
network-attached printers . . . . . . . . 276 Printing with remote output queues . . . . . 305
Printer device description parameters that support How output attributes are derived . . . . . 305
ASCII TCP/IP network-attached printers . . . . 277 Determining if input data stream is in final form 305
Configuring and starting ASCII TCP/IP Printing with convert image API . . . . . . . 306
network-attached printers . . . . . . . . . 280 Image configuration objects. . . . . . . . . 306
Special values of image configurations . . . . 306
Chapter 13. Working with the host Converting postscript data streams . . . . . . 312
print transform function . . . . . . . 283 Fonts . . . . . . . . . . . . . . . 312
Why use the host print transform function? . . . 283 User supplied fonts . . . . . . . . . . 313
How the host print transform function works . . 284 Font substitutions . . . . . . . . . . . 314
Using AFP-to-ASCII transform function . . . . 285 PostScript data streams . . . . . . . . . 315
Using bar codes . . . . . . . . . . . 286 How page size is determined . . . . . . . . 315
Limitations of AFP-to-ASCII transform function 286 Troubleshooting . . . . . . . . . . . . 315
Using the host print transform in raster mode . . 287 Additional documentation . . . . . . . . . 316
Why use raster mode? . . . . . . . . . 287
Enabling raster mode. . . . . . . . . . 287 Chapter 15. Other printing functions
Limitations of raster mode . . . . . . . . 287 provided by the OS/400 program . . . 317
Enabling the host print transform function using PrintManager/400 . . . . . . . . . . . . 317
printer device description parameters . . . . . 288 Data Description Specifications (DDS) . . . . . 318
Parameters supporting the host print transform Advanced Printer Function . . . . . . . . . 318
function . . . . . . . . . . . . . . 288 Functions of APF . . . . . . . . . . . 318
Working with printer device descriptions . . . . 289 Graphical Data Display Manager (GDDM) . . . 319
Creating printer device descriptions using a Required AS/400 System Hardware . . . . . 319
command . . . . . . . . . . . . . 290 Required AS/400 System Software . . . . . 320
Automatically creating printer device Required Knowledge . . . . . . . . . . 320
descriptions . . . . . . . . . . . . . 290 QWP4019 Program . . . . . . . . . . . 321
Changing an existing printer device description 290 QWP4019 Parameter Names and Functions . . 321
Displaying the printer device description . . . 291 How Does the QWP4019 Program Work? . . . 323
Using the host print transform function with an QWP4019 Program Examples . . . . . . . 323
emulator . . . . . . . . . . . . . . . 291
Using the host print transform function with the
IBM Client Access Express work station function 291
Chapter 16. Other printing functions
Using the host print transform function with the provided by licensed programs and
3486/3487/3488 InfoWindow display . . . . 293 AS/400 system hardware . . . . . . 325
Using the host print transform function with the Advanced function printing utilities/400 . . . . 325
3477 InfoWindow display . . . . . . . . 294 What is AFP utilities/400? . . . . . . . . 325
Using the host print transform function with the Overlay utility . . . . . . . . . . . . 325
3197 display station . . . . . . . . . . 295 Print format utility . . . . . . . . . . 327
Using the host print transform function with the Resource management utility . . . . . . . 328
ASCII work station controller . . . . . . . 296 Advanced DBCS printer support/400 . . . . . 329
Using the host print transform function with Business graphics utility (BGU) . . . . . . . 330
OS/2 5250 work station feature . . . . . . 297 What is BGU? . . . . . . . . . . . . 330
Using the host print transform function with Data access capability . . . . . . . . . 331
OS/2 5250 emulation . . . . . . . . . . 299 Client Access Express. . . . . . . . . . . 332
Using the host print transform function with the Network printer function . . . . . . . . 332
RUMBA/400 program . . . . . . . . . 299 Printer emulation . . . . . . . . . . . 333
Using the host print transform function with the Introducing sharing personal printers . . . . 334
IBM enhanced 5250 or the IBM S36/38 work IBM InfoWindow 3477, 3486, 3487, and 3488
station emulation program . . . . . . . . 300 printer support . . . . . . . . . . . . . 335
Using the host print transform function with the ASCII work station controller . . . . . . . . 335
IBM remote 5250 emulation program . . . . 301 Sending and printing files with TCP/IP . . . . 336

Part 5. Network printing . . . . . . 337

vi OS/400 Printer Device Programming V5R1


Chapter 17. Network Printing. . . . . 339 Appendix B. CL Commands
3270 Printer Emulation . . . . . . . . . . 339 Frequently Used While Working with
BSC 3270 Printer Emulation . . . . . . . 339 Printing Tasks . . . . . . . . . . . 369
SNA 3270 Printer Emulation . . . . . . . 339 Commands Used with a User Profile . . . . . 369
RJE Printing . . . . . . . . . . . . . . 340 Commands Used with a Job Description . . . . 369
Configuring for RJE Printing . . . . . . . 340 Commands Used with Spooled Files . . . . . 370
Communications Line Protocols for RJE . . . 341 Commands Used with Output Queues . . . . . 370
Printing Using RJE . . . . . . . . . . 343 Commands Used with Writers. . . . . . . . 371
Record Length of Output Data . . . . . . 345
Printing Using FCFC . . . . . . . . . . 346
Using a User Program to Receive Host-System
Appendix C. Printer File Return Codes 373
Output . . . . . . . . . . . . . . 348 Major Code 00 . . . . . . . . . . . . . 373
3x74 Attached Printers . . . . . . . . . . 348 Major Code 80 . . . . . . . . . . . . . 375
DBCS Printer Considerations . . . . . . . 348 Major Code 81 . . . . . . . . . . . . . 379
Distributed Data Management (DDM) Printing . . 349 Major Code 82 . . . . . . . . . . . . . 381
Object Distribution Printing . . . . . . . . 350 Major Code 83 . . . . . . . . . . . . . 383

| Chapter 18. The IBM Internet Printing Appendix D. Working with Fonts, Font
| Protocol (IPP) server for AS/400 . . . 351 Character Sets, Code Pages, CHRIDs,
| What is the Internet Printing Protocol? . . . . . 351 and Coded Fonts . . . . . . . . . . 387
| Why use the IPP server?. . . . . . . . . . 351 Fonts and the AS/400 System . . . . . . . . 387
| What is supported by the IPP server? . . . . . 351 Downloading . . . . . . . . . . . . 387
| Setting up the IPP server . . . . . . . . . 352 Font Character Sets and Font Global Identifiers
| Setting up your Internet browser . . . . . . 352 (FGID) . . . . . . . . . . . . . . . 388
| Using the Administrator Interface . . . . . 352 Font Character Sets . . . . . . . . . . 388
| Configuring the IPP server . . . . . . . . . 353 Font Global Identifiers (FGIDs) . . . . . . 390
| Creating an IPP Printer Configuration . . . . 354 Code Pages . . . . . . . . . . . . . . 392
| Viewing an IPP printer configuration . . . . 354 Standalone Code Pages . . . . . . . . . 393
| Deleting an IPP printer configuration . . . . 354 Character Set and Code Page Combination
| Managing the IBM IPP server . . . . . . . . 354 (CHRIDs). . . . . . . . . . . . . . 395
| Troubleshooting . . . . . . . . . . . . 355 Coded Fonts. . . . . . . . . . . . . 396
Font Capturing . . . . . . . . . . . . . 397
Activating Font Capturing . . . . . . . . 397
Part 6. Appendixes . . . . . . . . 357 Making Character Sets and Code Pages Eligible
for Capturing . . . . . . . . . . . . 397
Appendix A. Examples of Working Eligibility Rules . . . . . . . . . . . 398
with Printing Elements . . . . . . . 359 Migrating Font Libraries from Other Operating
Structure of Examples in This Appendix . . . . 359 Environments . . . . . . . . . . . . 398
Working with Your User Profile . . . . . . . 359 Considerations . . . . . . . . . . . . 398
Displaying Your User Profile . . . . . . . 359 Font Substitution Tables . . . . . . . . . . 400
Changing Your User Profile . . . . . . . 360 Font Attributes . . . . . . . . . . . . 400
Working with System Values . . . . . . . . 360 Font Substitution . . . . . . . . . . . 400
Displaying the System Value for the System Font Substitution by Font ID Range . . . . . 401
Printer. . . . . . . . . . . . . . . 360 Host Resident to Printer Resident Font
Changing System Values . . . . . . . . 361 Character Set Mapping . . . . . . . . . 401
Working with Output Queues . . . . . . . . 361 Printer Resident to Host Resident Font
Using the Printer File to Select a Different Character Set Mapping . . . . . . . . . 401
Output Queue . . . . . . . . . . . . 362 Printer Resident to Host Resident Code Page
Moving a Spooled File to a Different Output Mapping . . . . . . . . . . . . . . 401
Queue . . . . . . . . . . . . . . . . 363 Character Identifier (CHRID) Values Supported 402
Different Methods to Move Spooled Files . . . 363 Host Resident to Printer Resident Code Page
Working with Printer Writers (WRKWTR) . . . . 365 Mapping . . . . . . . . . . . . . . 402
Assigning a Printer to a Different Output Queue 365 Lines Per Inch (LPI) Values Supported . . . . 402
Locating Spooled Files . . . . . . . . . . 367 Characters Per Inch (CPI) Values Supported . . 402
Using the Work with Spooled Files (WRKSPLF) 4019 Printer Information. . . . . . . . . 402
Command . . . . . . . . . . . . . 367 4234 Compressed Font Substitution . . . . . 402
Using the Work with Job (WRKJOB) Command 367
Options You Can Select Using WRKSPLF or Appendix E. Printer Data Streams . . 493
WRKJOB . . . . . . . . . . . . . . 367 SNA Character String (SCS) . . . . . . . . 493
How Print Attributes Are Implemented by SCS 493

Contents vii
Final-Form Text: Document Content Architecture Examples of using QPQCHGCF . . . . . . 529
(FFT DCA) . . . . . . . . . . . . . . 494 Restrictions on using the QPQCHGCF program 530
Advanced Function Printing Data Stream (AFPDS) 495 Coded fonts whose font character sets are
Source Programs That Generate AFPDS . . . 495 resident in the 3130 . . . . . . . . . . 530
Advanced Function Printing . . . . . . . 496 QPQCHGCF instructions for marking coded
Intelligent Printer Data Stream (IPDS) . . . . . 496 fonts. . . . . . . . . . . . . . . . 531
Introduction to IPDS Architecture . . . . . 496
The IPDS Page Environment . . . . . . . 498 Appendix G. Feedback Area Layouts 533
Processing IPDS Commands . . . . . . . 502 Open Feedback Area for Printer . . . . . . . 533
The IPDS Command Format . . . . . . . 503 Device Definition List . . . . . . . . . 536
IPDS Operating States . . . . . . . . . 503 I/O Feedback Area . . . . . . . . . . . 537
Default Handling . . . . . . . . . . . 505 Common I/O Feedback Area . . . . . . . . 538
Mixed Object: Document Content Architecture I/O Feedback Area for Printer Files . . . . . 540
(MO:DCA) . . . . . . . . . . . . . 505
American National Standard Code for Information
Appendix H. Using DDS with
Interchange (ASCII) . . . . . . . . . . . 508
PostScript . . . . . . . . . . . . . . 508 High-Level Languages (HLL) . . . . . 541
Data Description Specifications (DDS) . . . . . 541
DDS Coding Example Using the Row/column
Appendix F. Double-Byte Character
Method of Positioning . . . . . . . . . 541
Set Support . . . . . . . . . . . . 511 DDS Coding Example Using the Absolute
Double-Byte Character Set Fundamentals . . . . 511 Method of Positioning . . . . . . . . . 541
DBCS Code Scheme . . . . . . . . . . 512 COBOL and RPG Source Code . . . . . . . 542
Shift-Control Characters . . . . . . . . . 514 Example Output from the DDS, COBOL, and RPG
Invalid Double-Byte Code and Undefined Source . . . . . . . . . . . . . . . . 545
Double-Byte Code . . . . . . . . . . . 515 Example 1: DDS and Row/Column Positioning 545
Using Double-Byte Data . . . . . . . . . 515 Example 2: DDS and Absolute Positioning. . . 546
Double-Byte Character Size. . . . . . . . 515
Processing Double-Byte Characters . . . . . . 516
Appendix I. What Does a Font Look
Basic Characters . . . . . . . . . . . 516
Extended Characters . . . . . . . . . . 516 Like? . . . . . . . . . . . . . . . 547
What Happens When Extended Characters Are Getting Started . . . . . . . . . . . . . 547
Not Processed . . . . . . . . . . . . 516 DDS Source Code . . . . . . . . . . . 548
Device File Support . . . . . . . . . . . 517 C Source Code . . . . . . . . . . . . 549
What a DBCS File Is . . . . . . . . . . 517 Pascal Source Code . . . . . . . . . . 549
When to Indicate a DBCS File . . . . . . . 517 RPG Source Code . . . . . . . . . . . 549
How to Indicate a DBCS File . . . . . . . 517 COBOL Source Code . . . . . . . . . . 550
Improperly Indicated DBCS Files . . . . . . 519
Making Printer Files Capable of DBCS . . . . 519 Notices . . . . . . . . . . . . . . 551
Printer Support. . . . . . . . . . . . . 521 Programming Interface Information . . . . . . 552
Special DBCS Printer Functions . . . . . . 521 Trademarks . . . . . . . . . . . . . . 552
Double-Byte Character Printing Considerations 523
Spool Support . . . . . . . . . . . . . 527 Bibliography . . . . . . . . . . . . 555
Applying Overrides in Printing . . . . . . 527
3130 Printer Resident Font Support . . . . . . 528
Index . . . . . . . . . . . . . . . 557
How to use the QPQCHGCF program. . . . . 528

viii OS/400 Printer Device Programming V5R1


About Printer Device Programming (SC41-5713)
This book provides information about printing elements of AS/400, printer file and
spooling support for printing operation, Advanced Function Printing (AFP), as
well as printing in a network environment.

Who Should Read This Book


This book is intended for the application programmer and system programmer.
Some system operators may also find this book helpful in understanding printer
fields and spooling support. To use this book, you should be familiar with the
different types of printers your business uses, as well as job and queue
management.

Conventions and Terminology Used in This Book


The commands, parameters, and displays shown in this book reflect the
intermediate assistance level (*INTERMED). The level of assistance (ASTLVL) is
specified in the user profile. The following is a list of values for the assistance
levels:
v *SYSVAL
v *BASIC
v *INTERMED
v *ADVANCED

AS/400 Operations Navigator


IBM iSeries Operations Navigator is a powerful graphical interface for managing
your iSeries and AS/400e servers. Operations Navigator functionality includes
system navigation, configuration, planning capabilities, and online help to guide
you through your tasks. Operations Navigator makes operation and administration
of the server easier and more productive and is the only user interface to the new,
advanced features of the OS/400 operating system. It also includes Management
Central for managing multiple servers from a central server.

For more information on Operations Navigator, see the iSeries Information Center.

Prerequisite and Related Information


Use the iSeries Information Center as your starting point for looking up iSeries and
AS/400e technical information. You can access the Information Center two ways:
v From the following Web site:
http://www.ibm.com/eserver/iseries/infocenter
v From CD-ROMs that ship with your Operating System/400 order:
iSeries Information Center, SK3T-4091-00. This package also includes the PDF
versions of iSeries manuals, iSeries Information Center: Supplemental Manuals,
SK3T-4092-00, which replaces the Softcopy Library CD-ROM.

The iSeries Information Center contains advisors and important topics such as CL
commands, system application programming interfaces (APIs), logical partitions,

© Copyright IBM Corp. 1997, 2001 ix


clustering, Java, TCP/IP, Web serving, and secured networks. It also includes links
to related IBM Redbooks and Internet links to other IBM Web sites such as the
Technical Studio and the IBM home page.

With every new hardware order, you receive the following CD-ROM information:
v iSeries 400 Installation and Service Library, SK3T-4096-00. This CD-ROM contains
PDF manuals needed for installation and system maintenance of an IBM ~
iSeries 400 server.
v iSeries 400 Setup and Operations CD-ROM, SK3T-4098-00. This CD-ROM contains
IBM iSeries Client Access Express for Windows and the EZ-Setup wizard. Client
Access Express offers a powerful set of client and server capabilities for
connecting PCs to iSeries servers. The EZ-Setup wizard automates many of the
iSeries setup tasks.

For related information, see the “Bibliography” on page 555.

Using Print Services Facility for OS/400 (PSF/400)


Beginning with OS/400 V3R1, the advanced function printing (AFP) function is a
separately orderable feature of OS/400 called Print Services Facility for OS/400
(PSF/400).

The OS/400 printing function continues to support line printers and a subset of
IBM IPDS printers and print functions when PSF/400 is not installed.

Full support for all IPDS printers is provided by the integrated AFP printing
function. The printing function used to process application output is determined
by the device description of the target printer. Only printers defined as
DEVTYPE(*IPDS) and AFP(*YES) (both specified in the printer device description)
are controlled by the AFP printing function.

When is PSF/400 Required?


The PSF/400 feature is required when:
v Any of the following IBM printers are used:
– IBM 3820 Page Printer
– IBM 3825 Page Printer
– IBM 3827 Page Printer
– IBM 3828 Advanced Function MICR Printer
– IBM 3829 Advanced Function Printer :
– IBM 3831 Page Printer (in 3835 emulation mode; available only in Japan)
– IBM 3835-001 Page Printer
– IBM 3835-002 Advanced Function Printer
– IBM 3900 Advanced Function Printer
– IBM 3130 Advanced Function Page Printer
– IBM 3160 Advanced Function Page Printer
– IBM 3935 Advanced Function Page Printer
– IBM InfoPrint 60
– IBM InfoPrint 62
| – IBM InfoPrint 70
| – IBM InfoPrint 2000
| – IBM InfoPrint 3300

x OS/400 Printer Device Programming V5R1


– IBM InfoPrint 4000
v Any printer that has the DEVTYPE parameter specified as *IPDS and the AFP
parameter specified as *YES.
v Distributed print to IPDS or Hewlett-Packard** PCL4 or PCL5 printers attached
to Print Services Facility for OS/2 (PSF for OS/2) LAN print server.
v The Advanced Function Printing Utilities/400 licensed program is to be used.

When is PSF/400 Optional?


When the following IPDS printers or IPDS printer models are installed, PSF/400 is
optional. These printers can be driven by the original OS/400 printing subsystem.
However, PSF/400 is required if the functions provided by the AFP subsystem are
to be used.
v IBM 3112 and 3116 Page Printers
v IBM 3812 and 3816 Page Printers
v IBM 3912 and 3916 Page Printers
v IBM 3930 Page Printer
v IBM LaserPrinter 4028
v IBM 4224 and 4234 Printers
v IBM 4230 Print
v IBM 4247 Printer
v IBM Network Printers (4312, 4317, and 4324)
v IBM 6408 Printer 1
v IBM 6412 Printer
v IBM InfoPrint 20
v IBM InfoPrint 32
| v IBM InfoPrint 21
| v IBM InfoPrint 40
| v IBM 4400
| v IBM 6400

Printer File Parameter Keywords Requiring PSF/400


The following shows printer file parameters and DDS keywords that affect print
formatting and handling. When used to print on IPDS printers, they require
PSF/400.

Printer File Parameters


v AFP characters (AFPCHARS)
v Back margin (BACKMGN)
v Back overlay (BACKOVL
v Coded font (CDEFNT)
v Corner staple (CORNERSTPL)
v Device type (*AFPDS, *LINE, *AFPDSLINE)
v Edge stitch (EDGESTITCH)
v Font character set (FNTCHRSET)
v Font resolution (FNTRSL)
v Front margin (FRONTMGN)
v Form definition (FORMDF)

About Printer Device Programming (SC41-5713) xi


v Front overlay (FRONTOVL)
v IPDS pass through (IPDSPASTHR(*YES|*NO))
v Multi-up (MULTIUP REDUCE(*NONE))
v Output bin (OUTBIN)
v Page definition (PAGDFN)
v Saddle stitch (SADLSTITCH)
v Table reference characters (TBLREFCHR)
v User-defined data (USRDFNDTA (IPDSPASTHR(*YES|*NO))
v User-defined data (USRDFNDTA(USRRCSLIBL (lib1 lib2 lib3 lib4))
v User resource library list (USRRSCLLIBL)

DDS Keywords
v Box (BOX)
v Coded font (CDEFNT)
v Data Stream Command (DTASTMCMD)
v Document Index Tag (DOCIDXTAG)
v End Page (ENDPAGE)
v End Page Group (ENDPAGGRP)
v Font character set (FNTCHRSET)
v Graphic data file (GDF)
v Invoke medium map (INVMMAP)
v Line (LINE)
v Overlay (OVERLAY)
v Page segment (PAGSEG)
v Position (POSITION)
v Start Page Group (STRPAGGRP)
v Text rotate (TXTRTT)
v Z fold (ZFOLD)
v Force (FORCE)
v Duplex (DUPLEX)
v Outbin (OUTBIN)

PrintManager/400
PrintManager/400 remains part of the OS/400 operating system. Print Services
Facility for OS/400 is required if you use PrintManager/400 to place data on
AS/400 spool or select page and form definition resources (AFP print objects as
used on System/390 and RS/6000).

How to send your comments


Your feedback is important in helping to provide the most accurate and
high-quality information. If you have any comments about this book or any other
AS/400 documentation, fill out the readers’ comment form at the back of this
book.
v If you prefer to send comments by mail, use the readers’ comment form with the
address that is printed on the back. If you are mailing a readers’ comment form
from a country other than the United States, you can give the form to the local
IBM branch office or IBM representative for postage-paid mailing.

xii OS/400 Printer Device Programming V5R1


v If you prefer to send comments by FAX, use either of the following numbers:
– United States and Canada: 1-800-937-3430
– Other countries: 1-507-253-5192
v If you prefer to send comments electronically, use one of these e-mail addresses:
– Comments on books:
[email protected]
IBMMAIL, to IBMMAIL(USIB56RZ)
– Comments on the AS/400 Information Center:
[email protected]
Be sure to include the following:
v The name of the book.
v The publication number of the book.
v The page number or topic to which your comment applies.

About Printer Device Programming (SC41-5713) xiii


xiv OS/400 Printer Device Programming V5R1
Summary of Changes
| A vertical line (|) to the left of the text indicates a change or | addition.

| The following changes and additions were made to this manual:


| v Chapter 1: Changes to the Understanding printer files section to address job
| attribute where necessary.
| v Chapter 2: Add CVTLINDTA parameter. Added UCS-2 to IGCDTA parameter
| description. Added CCSID DDS printer keyword. Removed DDS keyword
| descriptions and will include link to the DDS reference information in the
| AS/400 Information Center.
| v Chapter 3: Added trackable data queue section. Added information about the
| increased maximum number of allowed spooled files. Added new SETGID and
| SETUID Unix-type APIs.
| v Chapter 7:″Choosing your AFP environment″ was removed
| v Chapter 9:Added CVTLINDTA parameter, and CCSID DDS keyword.
| v Chapter 13: ASCII TCP/IP network-attached printers now support both PJL and
| SNMP.
| v Chapter 17: Removed OfficeVision/400, no longer supported.
| v Chapter 18: Internet Printing Protocol chapter added..
| v Appendix G: In Open feedback area table, updated Offsets 79, 81, 82 to support
| spooled file number.

© Copyright IBM Corp. 1997, 2001 xv


xvi OS/400 Printer Device Programming V5R1
|

Part 1. Introduction to printing on AS/400


Chapter 1. Understanding printing elements of the
AS/400 system . . . . . . . . . . . . . 3
Learning about printing elements and terminology . 3
Learning how printing is done on the AS/400
system . . . . . . . . . . . . . . . 5
Learning where printed output goes . . . . . 6
Learning about printer files . . . . . . . . 7
SPOOL parameter = *YES . . . . . . . . 9
SPOOL parameter = *NO . . . . . . . . 9
Device (DEV) parameter . . . . . . . . 10
Spooled file owner (SPLFOWN) parameter . . 10
Output queue (OUTQ) parameter . . . . . 10
Learning about spooling and spooled files . . . 10
Spooling and application programs . . . . 11
Spooling and the print key . . . . . . . 11
Why use spooling to manage your printing
workload? . . . . . . . . . . . . . 12
Learning about output queues (CRTOUTQ). . . 12
User-created output queues . . . . . . . 12
System-created output queues . . . . . . 12
How to determine your output queue . . . 12
Why use multiple output queues? . . . . . 12
Controlling print activity . . . . . . . . . . 13
Learning about the printer writer program . . . 14
Understanding the hierarchy of the printing
elements . . . . . . . . . . . . . . 15
| Stage 1: Job initiation . . . . . . . . . 16
Understanding the user profile . . . . . . 17
Understanding the workstation description . . 18
| Stage 2: Job run time . . . . . . . . . 19
Understanding printer files . . . . . . . 19
Understanding system values . . . . . . 22
Where did the output go? . . . . . . . 22
How the printing elements control print activity 22
Other elements that control print activity . . . 22
Examples: where your printing would go . . . . 23
Example 1: Determine your output queue . . . 23
Example 2: Determine your output queue . . . 24
| Example 3: Determine your output queue . . . 25
| Example 4: Determine your output queue . . . 26
| Example 5: Determine your output queue . . . 26
Example 6: Determine your output queue . . . 28
Example 7: Determine your output queue . . . 28
| Example 8: Determine Your Printer Name . . . 29
| Example 9: Determine Your Printer Name . . . 30
Printing in a batch environment . . . . . . 31
How output is routed in a batch job . . . . 32
Example 1 . . . . . . . . . . . . . 32
Example 2 . . . . . . . . . . . . . 32
Example 3 . . . . . . . . . . . . . 33
Self-test: Determining output queue and printer
device . . . . . . . . . . . . . . . . 33
Self-test answers . . . . . . . . . . . . 34
Where to find more examples . . . . . . . . 36

© Copyright IBM Corp. 1997, 2001 1


2 OS/400 Printer Device Programming V5R1
Chapter 1. Understanding printing elements of the AS/400
system
How is printing done on this system?

Where did my printed output go?

How can I control where my printouts go?

How can I print something on a different printer?

To know the answer to these and other printing questions you need to:
v Understand the elements that make printing happen.
v Understand which elements have precedence over other elements. For example;
your job description has precedence over your user profile in determining which
printer your output will print on.

After reading through this chapter and the examples in Appendix A. Examples of
Working with Printing Elements, you will be familiar with the elements that make
printing happen and you will be able to:
v Display your user profile.
v Change your user profile.
v Create an output queue.
v Move spooled files from one output queue to a different output queue.
v Start printers printing.
v Stop printers from printing.
v Assign a printer to print spooled files from an output queue that it is currently
not assigned to.

Note to Readers:

There are examples in “Appendix A. Examples of Working with


Printing Elements” on page 359 of this guide that show you how
the printing elements work together to enable you to manage
your printing work.

Learning about printing elements and terminology


Many elements within the AS/400 system contribute to creating and handling data
that you want printed. To understand those elements, you should become familiar
with the terminology that describes them.

Read through the following list to familiarize yourself with the elements, but do
not worry about trying to memorize each definition. A thorough explanation of the
elements and how they interact with each other will follow.
Printing Elements
Element Definition
Spooled File
A file that holds output data waiting to be printed.

© Copyright IBM Corp. 1997, 2001 3


A spooled file is usually the result of a system program, an application
program being run, or the Print key being pressed.
Output Queue
An object that contains a list of spooled files to be printed.
Output queues can receive spooled files from more than one application
program and more than one user.
Printer Writer
A function of the operating system that writes (sends) the spooled file from
an output queue to a printer.
In most cases the application program sends the spooled file to an output
queue first. Then the printer writer program sends it to a printer.
Remote Writer
A function of the operating system that writes (sends) the spooled file from
an output queue to another system. The other system is usually connected
through a communications line.
Print Devices
The physical printers that can be attached to the AS/400 system.
Print devices (printers) should not be confused with the printer writer
program or printer files.
Printer Files
Files that describe how the system is to operate on data as it passes
between a program and a printer.
A printer file has many parameters. The spooling parameter (SPOOL)
determines if your output goes to an output queue or directly to a printer.
The device (DEV) parameter is the name of the printer your output is
printed on. The output queue (OUTQ) parameter is the name of the output
queue your spooled files are sent to.
| Job Description
| A system object, made up of many parameters, that defines how a job is to
| be processed. Once a job begins, the parameters in the job description
| become the attributes of the job. For more detailed information about job
| descriptions and job attributes, see the Work Management topic in the
| AS/400 Information Center.
| Printer device (PRTDEV) and output queue (OUTQ) are the two
| parameters that help determine where your output will go.
Workstation Description
Information collected from the device description for the display. Two of
the device description parameters, printer device (PRTDEV) and output
queue (OUTQ), help determine where your output will go. Go to
“Understanding the workstation description” on page 18 for more
information about the workstation description.
User Profile
An object with a unique name that contains the user’s password, the list of
special authorities assigned to a user, and the objects the user owns.
A user profile has many parameters. Printer device (PRTDEV) and output
queue (OUTQ) are the two parameters that help determine where your
output will go.

4 OS/400 Printer Device Programming V5R1


System Values
Values that control information for operating certain parts of the system.
System administrators can change system values to redefine the working
environment.
The system value most important to printing is the default system printer.
Messages
Responses from the system to a user of that system.
When printing operations are started, the system often asks the user to
respond to a forms alignment message. Also, an application program could
send a message asking the user to perform a variety of checks before
printing starts. It is important to remember to respond to messages when
requesting printing. Failure to respond to messages can prevent a printer
from printing.

Learning how printing is done on the AS/400 system


The diagram below illustrates many of the elements that control how printing
work originates and flows through the system to a printer. Study the diagram to
become familiar with the elements. Information on the following pages provides
more detail and explains the relationships between the elements.

Chapter 1. Understanding printing elements of the AS/400 system 5


AS/400

Application
An application program is run
Program
or the Print key is pressed.
Runs or a
Print Key
Is Pressed

Printer File Application program looks


at printer file to determine
System-Supplied output queue name if spooling
or User-Created is to be used, or printer device
name if spooling is not used.

Spooled files are the


Spooled File
result of programs being run
Created
or Print key being used.

Output Queue Output queue holds spooled


files. Output queues are
Spooled File created by the system or by
Spooled File the user using the Create
Spooled File Output Queue (CRTOUTQ)
command.

A system-supplied program
Printer Writer takes spooled files from
Program output queues and sends
them to a printer.

A physical printer is configured


Printer to the system by Autoconfiguration
or manually using the
CRTDEVPRT command.
RV2H327-0

As the diagram illustrates, there are many elements (such as printer files and
output queues) and many actions (creating spooled files, starting printer writer
programs) involved in processing your printing requests.

The remainder of the chapter explains the elements and the processes that combine
to produce printed output.

Learning where printed output goes


The next three topics in this chapter discuss printer files, spooled files, and
output queues.

Generally, when the user initiates a print request or runs a program, a printer file
is accessed, a spooled file is generated, and that spooled file is sent to an output
queue. The next three topics discuss the relationship between printer files, spooled
files, and output queues.

6 OS/400 Printer Device Programming V5R1


Learning about printer files
Note: The information in this chapter on printer files is quite brief and intended
only to introduce the printer file concept to you. For more detailed
information on printer file support, go to “Chapter 2. Printer file support”
on page 41.

Printers attached to the AS/400 system are supported by the operating system
through printer files. Printer files describe how the system is to operate on the
data as it passes between your application program and a printer.

A printer file handles every request for printing. You can create your own printer
files by using the Create Printer File (CRTPRTF) command, or you can use
system-provided printer files.

Note: There is one exception to this. 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 screen. The remote work station
controller, not the AS/400 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. The parameters that control how your output is
handled and where it goes are:
1 Spool the data (SPOOL)
2 Device (DEV)
3 Spooled output queue (OUTQ)
4 Spooled File Owner(SPLFOWN)

| If another printer file is not specified, the printer uses the default printer file. The
| default printer file for the system is QSYSPRT. The following page identifies the
| SPOOL, DEV, OUTQ, and SPLFOWN parameters on the default printer file,
| QSYSPRT.
Display Spooled File

File . . . . . : QPDSPFD Page/Line 1/1


Control . . . . . Columns 1 - 78
Find . . . . . .

2/09/98 Display File Description

DSPFD Command Input


File . . . . . . . . . . . . . . . . . . . : FILE QSYSPRT
Library . . . . . . . . . . . . . . . . . : *LIBL
Type of information . . . . . . . . . . . . : TYPE *ALL
File attributes . . . . . . . . . . . . . . : FILEATR *ALL
System . . . . . . . . . . . . . . . . . . : SYSTEM *LCL
File Description Header
File . . . . . . . . . . . . . . . . . . . : FILE QSYSPRT
Library . . . . . . . . . . . . . . . . . . : QSYS
Type of file . . . . . . . . . . . . . . . : Device
Device type . . . . . . . . . . . . . . . . : Printer
Auxiliary storage pool ID . . . . . . . . . : 01
Device File Attributes
Externally described file . . . . . . . . . : No
File level identifier . . . . . . . . . . . : 0980109013920

Chapter 1. Understanding printing elements of the AS/400 system 7


Creation date . . . . . . . . . . . . : 01/09/98
Text 'description' . . . . . . . . . . . . : TEXT System non-describ
**********************************************************************************
1 Spool the data . . . . . . . . . . . . . . : SPOOL *YES
**********************************************************************************
Maximum devices . . . . . . . . . . . . . . : 1
User specified DBCS data . . . . . . . . . : IGCDTA *NO
Maximum file wait time . . . . . . . . . . : WAITFILE *IMMED
Share open data path . . . . . . . . . . . : SHARE *NO
Record format level check . . . . . . . . . : LVLCHK *NO
Number of record formats . . . . . . . . . : 1
User buffer length . . . . . . . . . . . . : 0
Number of devices . . . . . . . . . . . . . : 1
Separate indicator area . . . . . . . . . . : INDARA No
Coded character set identifier . . . . . . : CCSID 0
Printer Attributes
**********************************************************************************
2 Device . . . . . . . . . . . . . . . . . . : DEV *JOB
**********************************************************************************
Printer device type . . . . . . . . . . . . : DEVTYPE *SCS Page size
Length . . . . . . . . . . . . . . . . . : 34
Width . . . . . . . . . . . . . . . . . . : 132
Measurement Method . . . . . . . . . . . : *ROWCOL
Lines per inch . . . . . . . . . . . . . . : LPI 6
Characters per inch . . . . . . . . . . . . : CPI 10
Front margin . . . . . . . . . . . . . . . : FRONTMGN *DEVD
Back margin . . . . . . . . . . . . . . . . : BACKMGN *FRONTMGN
Overflow line number . . . . . . . . . . . : OVRFLW 30
Fold records . . . . . . . . . . . . . . . : FOLD *NO
Degree of page rotation . . . . . . . . . . : PAGRTT *AUTO
Hardware justification . . . . . . . . . . : JUSTIFY 0
Print on both sides . . . . . . . . . . . . : DUPLEX *NO
Defer Write . . . . . . . . . . . . . . . . : DFRWRT *YES
Unprintable character action RPLUNPRT
Replace character . . . . . . . . . . . . : *YES
Replacement character . . . . . . . . . . : ' ' X'40'
Print text . . . . . . . . . . . . . . . . : PRTTXT *JOB
Align page . . . . . . . . . . . . . . . . : ALIGN *NO
Control character . . . . . . . . . . . . . : CTLCHAR *NONE
Channel values . . . . . . . . . . . . . . : CHLVAL *NORMAL
Fidelity . . . . . . . . . . . . . . . . . : FIDELITY *CONTENT
Printer quality . . . . . . . . . . . . . . : PRTQLTY *STD
Form feed . . . . . . . . . . . . . . . . . : FORMFEED *DEVD
Source drawer . . . . . . . . . . . . . . . : DRAWER 1
Output bin . . . . . . . . . . . . . . . . : OUTBIN *DEVD
Font FONT
Identifier . . . . . . . . . . . . . . . : *CPI
Point size . . . . . . . . . . . . . . . : *NONE
Character identifier . . . . . . . . . . . : CHRID *CHRIDCTL
Decimal format . . . . . . . . . . . . . . : DECFMT *JOB
Font character set . . . . . . . . . . . . : FNTCHRSET *FONT
Coded font . . . . . . . . . . . . . . . . : CDEFNT *FNTCHRSET
Table Reference Characters . . . . . . . . : TBLREFCHR *NO
AFP Chars . . . . . . . . . . . . . . . . . : AFPCHARS *NONE
Page definition . . . . . . . . . . . . . . : PAGDFN *NONE
Form definition . . . . . . . . . . . . . . : FORMDF *NONE
Form type . . . . . . . . . . . . . . . . . : FORMTYPE *STD
Pages per side . . . . . . . . . . . . . . : MULTIUP 1
Reduce output . . . . . . . . . . . . . . . : REDUCE *TEXT
Unit of measure . . . . . . . . . . . . . . : UOM *INCH
Front side overlay . . . . . . . . . . . . : FRONTOVL *NONE
Back side overlay . . . . . . . . . . . . . : BACKOVL *FRONTOVL
IPDS pass through . . . . . . . . . . . . . : IPDSPASTHR *DEVD
Convert line data . . . . . . . . . . . . . : CVTLINDTA *NO
User resource library list . . . . . . . . : USRRSCLIBL *DEVD
Corner staple . . . . . . . . . . . . . . . : CORNERSTPL *NONE
Edge stitch EDGESTITCH

8 OS/400 Printer Device Programming V5R1


Reference edge . . . . . . . . . . . . . . : *NONE
Font resolution . . . . . . . . . . . . . . : FNTRSL *DEVD
Saddle stitch : SADLSTITCH
Reference edge . . . . . . . . . . . . . : *NONE
DBCS extension characters . . . . . . . . . : IGCEXNCHR *YES
DBCS character rotation . . . . . . . . . . : IGCCHRRTT *NO
DBCS characters per inch . . . . . . . . . : IGCCPI *CPI
DBCS SO/SI spacing . . . . . . . . . . . . : IGCSOSI *YES
DBCS Coded font . . . . . . . . . . . . . . : IGCCDEFNT *SYSVAL
Spooling Description
**********************************************************************************
3 Spooled output queue . . . : OUTQ *JOB
**********************************************************************************
Max spooled output records . . . . . . . . : MAXRCDS 100000
Spooled output schedule . . . . . . . . . . : SCHEDULE *FILEEND
Copies . . . . . . . . . . . . . . . . . . : COPIES 1
Page range to print PAGERANGE
Starting page . . . . . . . . . . . . . . : 1
Ending page . . . . . . . . . . . . . . . : *END
File separators . . . . . . . . . . . . . . : FILESEP 0
Hold spooled file . . . . . . . . . . . . . : HOLD *NO
Save spooled file . . . . . . . . . . . . . : SAVE *NO
Output priority (on OUTQ) . . . . . . . . . : OUTPTY *JOB
User data . . . . . . . . . . . . . . . . . : USRDTA *SOURCE
**************************************************************************************
4Spooled file owner . . . . . . . . . . . . . : SPLFOWN *CURUSRPRF
***************************************************************************************
User defined option . . . . . . . . . . . . : USRDFNOPT *NONE
User defined data . . . . . . . . . . . . . : USRDFNDTA *NONE
User defined object USRDFNOBJ
Object . . . . . . . . . . . . . . . . . : *NONE
Library . . . . . . . . . . . . . . . . :
Object type . . . . . . . . . . . . . . . :
Record Format List
Record Format Level
Format Fields Length Identifier
QSYSPRT 0 0 0000000000000
Text . . . . . . . . . . . . . . . . . . . :
Total number of formats . . . . . . . . . . : 1
Total number of fields . . . . . . . . . . . : 0
Total record length . . . . . . . . . . . . : 0

SPOOL parameter = *YES


*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 could 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).

SPOOL parameter = *NO


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 could be PRT01.

Chapter 1. Understanding printing elements of the AS/400 system 9


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
attribute to determine the name of the printer device (DEV).

Device (DEV) parameter


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 *DEVD is specified for the output queue parameter. In
that case, the default output queue for the specified printer is used for the spooled
files. For more information about output queues, see “Learning about output
queues (CRTOUTQ)” on page 12.

Spooled file owner (SPLFOWN) parameter


| 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 debugging purposes, you might want the current job to spool and
own all service dumps, instead of an individual user. To accomplish this, you
could set the parameter to the special value of *JOB for the QPSRVDMP printer
file.

Output queue (OUTQ) parameter


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. For more
information about output queues, see “Learning about output queues
(CRTOUTQ)” on page 12.

Learning about spooling and spooled files


Note: The information in this chapter on spooling is quite brief and intended only
to introduce the spooling concept to you. A more detailed explanation of
spool support is provided in Chapter 3. Spool support.

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.

When spooling is used, spooled files) are created from the application program, a
system program, or the pressing of the Print key. These files are put on disk in
places called output queues.

The diagram below shows an AS/400 system with three application programs.
When these application programs are run, they take information from a printer
file.

Information in the printer file determines if the output should be spooled, and
which output queue the spooled file is sent to.

A key concept to remember is that you can create and use multiple printer files
and multiple output queues to accomplish your printing needs. Also, two different

10 OS/400 Printer Device Programming V5R1


application programs can send spooled files to the same output queue. This is
shown in the bottom portion of the diagram.

AS/400

Output Queue
Application Program Name = OUTQONE
Using a Printer File
Called PRTFONE Spooled File
Printer File Spooled File
Name = PRTFONE Spooled File
OUTQ = OUTQONE

Printer File
Application Program
Using a Printer File Name = PRTFTWO
Called PRTFTWO OUTQ = OUTQTWO

Output Queue
Name = OUTQTWO
Application Program
Using a Printer File Spooled File
Called PRTFTHREE Spooled File
Printer File
Spooled File
Name = PRTFTHREE
OUTQ = OUTQTWO
RV2H326-0

Spooling and application programs


Almost all application programs that generate printed output make use of the
spooling support provided with the AS/400 system. Whether spooling support is
requested is determined by specifying SPOOL = *YES or SPOOL = *NO on the
SPOOL parameter of a printer file.

By creating and using your own printer file instead of using a system-supplied
printer file, you can specify the printing control instructions that your application
program receives.

You can use the Create Printer File (CRTPRTF) command to create your own
printer file.

For more detailed information and examples about printer files, see Chapter 2.
Printer file support.

Spooling and the print key


Using the Print key to capture an image of a 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.

Chapter 1. Understanding printing elements of the AS/400 system 11


Why use spooling to manage your printing workload?
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 Since disk operations are much faster than printers, the system is used
efficiently.

Learning about output queues (CRTOUTQ)


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 in two ways:


v By the user
v By the system

User-created output queues


| 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.

System-created output queues


When a printer is configured to the system, either manually or through automatic
configuration, the system creates an output queue for that printer.

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.

How to determine your output queue


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 QPRTDEV. Your
output queue has the same name as the value shown for the system printer.

Why use multiple output queues?


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, as shown in the diagram below.

12 OS/400 Printer Device Programming V5R1


AS/400

Output Queue
Application
Program Spooled File
(600-page job) Printer

Output Queue
Other Users’
Jobs Spooled Files
(all other jobs)

RV2H325-0

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 which 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 could be set from 08:00:00 to 17:30:00
hours. During this time, only spooled files of 100 or less pages would print. After
5:30 PM, any spooled file prints. Spooled files which are too large are placed in
deferred status (*DFR) until they can be printed. See “Controlling printing from an
output queue by spooled file size” on page 131 and “Controlling multiple output
queues” on page 136 for more information on using multiple output queues with
deferred printing.

Controlling print activity


In the first part of this chapter you read about spooled files and output queues.
These elements are identified by 1 in the diagram below.

The remainder of this chapter discusses the elements that control or direct the
printing activity.
v The printer writer program.
This element is identified by 2 in the diagram below.

Note: The Start Remote Writer (STRRMTWTR) command is similar to the Start
Printer Writer (STRPRTWTR) command. The STRRMTWTR command
provides function that allows spooled files to be sent to a remote system
for printing. For more information, see “Chapter 4. Remote System
Printing” on page 159.
+ v Printer files, job attributes, user profiles, workstation descriptions, job
+ descriptions, and system values.
+ These elements are identified by 3 in the diagram below.

Chapter 1. Understanding printing elements of the AS/400 system 13


This diagram is designed to show you, by use of the joined circles, that the
elements that control printing are interrelated; to produce printed output, the
attributes that are common to all the elements must be correctly matched.

These important attributes, common to the elements that control printing, are:
v Output queues
v Printer devices

Learning about the printer writer program


The printer writer program is a system-supplied program that enables the user to
work with the printers attached to the AS/400 system.

Note: Do not confuse the printer writer program with an actual printer device or a
printer file. The printer device is a physical printer and the printer writer is
the program that allows you to assign an actual printer device to an output
queue and select spooled files from the output queue to be printed.

The diagram below illustrates how the printer writer program interacts with the
output queue and the physical printer to take spooled files from an output queue
and send them to a printer.

14 OS/400 Printer Device Programming V5R1


|
AS/400

Application
Program
Runs or a
Print Key
Is Pressed

Printer Writer
Printer File
Program
System-Supplied (system-
or User-Created supplied)

Spooled File Physical Device


Created Printer Description

Output Queue

Spooled File
Spooled File Printed
Spooled File Output
RV2H324-0
|
Printer device descriptions have to be created for each printer attached to the
system. If you use automatic configuration, this is done for you by the system,
with the exception of printers attached to an ASCII work station controller. Or you
can use the Create Device Description (Printer) (CRTDEVPRT) command to assign
a name to each printer.

The Start Printer Writer (STRPRTWTR) command and the Work with Writers
(WRKWTR) command provide you with the ability to assign any configured
printer to any output queue.
Notes:
1. Even though the name of the command (Work with Writers) indicates you are
working with printer writers, you are actually using the printer writer program
to make a match between an output queue and a physical printer.
2. If your printer stops for any reason (out of paper, for example), the AS/400
system does not automatically assign a different printer to continue printing the
jobs in the output queue that your printer was assigned to. You have to
manually assign another printer to that output queue.

Understanding the hierarchy of the printing elements


| The elements that control printing have a defined hierarchy. The following diagram
| shows that hierarchy. The system looks first for the output queue and print device
| in the printer file. The hierachy is broken in to two stages: job initiation and job
| run time.

| Assuming that the method used to start the job does not override the output
| queue or printer device values specified in the device description, the order
| followed for job initiation is: job description, user profile, workstation description,

Chapter 1. Understanding printing elements of the AS/400 system 15


| and system value. The results of the job initiation stage are called job
| attribues.These job attributes are characteristics that define how the system should
| process a job.

| For job run time, the order followed is printer file and job attributes. In the
| following diagram you can see how these stages work. For additional information
| about job attributes and manipulating job attributes, see the Work Management
| topic in the online Information Center.

|
Note: If the printer identified in the system value does not exist on your AS/400
system, the output goes to output queue QPRINT.

| The OUTQ and printer selection proccess occurs in two stages:


| v Stage 1: Job initiation
| v Stage 2: Job run time

| Stage 1: Job initiation


| During stage 1, the following order is used to determine the output queue (OUTQ)
| and printer device (PRTDEV) values: job description, user profile, workstation
| description, and system values. The system stores the values for OUTQ and
| PRTDEV locally, as job attributes, with the job to be used during the run-time
| stage.

16 OS/400 Printer Device Programming V5R1


| The IBM-supplied default job description, containing default job attributes, is
| QDFTJOBD.

| For more detailed information about job attributes, see the Work Management
| topic in the AS/400 Information Center.

Understanding the user profile


On the following page is an example of a user profile with the attribute values set
to the system-supplied defaults.

To become a user of the system you must have a user profile. In most cases,
someone having security officer authority adds new users to the system. A user
profile is created for each new user added to the system. The user profile has three
parameters (highlighted on the following page) that provide information to
determine where the user’s printed output will go.
1 Job Description
2 Output Queue
3 Printer Device

Job description: In the example user profile, this parameter and its value of
QDFTJOBD (item 1 in the following example) mean that when the user requests
a printing job, the system scans the QDFTJOBD job description to determine which
output queue (OUTQ) and printer device (PRTDEV or DEV) it should use. If the
job description has the value of *USRPRF specified for these parameters, the
system comes back to the user profile and continues to look for the printer and the
output queue to use.

The system looks, in the user profile, at the parameters of output queue and
printer device.

Output queue: In the example user profile, you can see the output queue value
(item 2) specified is *WRKSTN. This tells the system to use the value specified in
the output queue (OUTQ) parameter of the workstation description as the output
queue name.

Go to “Understanding the workstation description” on page 18.


Display User Profile - *BASIC
User profile . . . . . . . . . . . . . : LAWSON
Previous sign-on . . . . . . . . . . . : 04/15/91 13:47:07
Sign-on attempts not valid . . . . . . : 0
Date password last changed . . . . . . : 04/09/91
Password expiration interval . . . . . : *SYSVAL
Date password expires . . . . . . . . : 05/09/91
Set password to expired . . . . . . . . : *NO
User class . . . . . . . . . . . . . . : *PGMR
Special authority . . . . . . . . . . . : *ALLOBJ
*JOBCTL
*SAVSYS
*SECADM
*SPLCTL
Group profile . . . . . . . . . . . . . : *NONE
Owner . . . . . . . . . . . . . . . . . : *USRPRF
Group authority . . . . . . . . . . . . : *NONE
Assistance level. . . . . . . . . . . . : *INTERMED
Current library . . . . . . . . . . . . : *CRTDFT
Initial menu . . . . . . . . . . . . . : MAIN
Library . . . . . . . . . . . . . . . : *LIBL
Initial program . . . . . . . . . . . . : *NONE

Chapter 1. Understanding printing elements of the AS/400 system 17


Library . . . . . . . . . . . . . . . :
Limit capabilities . . . . . . . . . . : *NO
Text . . . . . . . . . . . . . . . . . :
pat lawson 534/030-2 3-6051
Display sign-on information . . . . . . : *SYSVAL
Limit device sessions . . . . . . . . . : *SYSVAL
Keyboard buffering. . . . . . . . . . . : *SYSVAL
Maximum storage allowed . . . . . . . . : *NOMAX
Storage used . . . . . . . . . . . . . : 519
Highest scheduling priority . . . . . . : 3
**************************************************************************
1 Job description . . . . . . . . . . : QDFTJOBD
**************************************************************************
Library . . . . . . . . . . . . . . . : QGPL
Accounting code . . . . . . . . . . . . :
Message queue . . . . . . . . . . . . . : LAWSON
Library . . . . . . . . . . . . . . . : QUSRSYS
Message queue delivery . . . . . . . . : *NOTIFY
Message queue severity . . . . . . . . : 0
**************************************************************************
2 Output queue . . . . . . . . . . . : *WRKSTN
Library . . . . . . . . . . . . . . . :
**************************************************************************
3 Printer device . . . . . . . . . . : *WRKSTN
**************************************************************************
Special Environment . . . . . . . . . . : *SYSVAL
Attention program . . . . . . . . . . . : *NONE
Library . . . . . . . . . . . . . . . :
User options . . . . . . . . . . . . . : *NONE

Understanding the workstation description


On the following page is an example of a workstation description with the values
set to the system-supplied defaults.

Each user signs on to the system at a display station. Many display stations can be
attached to an AS/400 system. Each display station that is attached to the system
has a workstation description.

The workstation description, for a display station, is a collection of information


that tells the system how the display station is to be used.

From a printing standpoint, the parameters labeled 1 Printer device and 2
Output queue are very important.

When you sign on to the system, if no defaults or system values have been
changed, your output will be sent to the output queue and the printer device
specified in the workstation description of the display station where you are
signed on.

Note: Any batch job submitted from the interactive job would use the same printer
device or output queue that is currently specified in the workstation
description.

Output queue: In the example workstation description, you can see the output
queue value (item 2) specified is *DEV. This tells the system to use the value
specified in the printer device parameter of the printer file as the output queue
name.

| In our example, the value in the PRTDEV parameter of the job description is
| *USRPRF, which tells the system to look at the PRTDEV parameter in the user

18 OS/400 Printer Device Programming V5R1


| profile. The value in that parameter is *WRKSTN, which tells the system to look at
| the PRTDEV parameter in the workstation description.

Printer device: In the example workstation description, you can see the printer
device value (item 1) specified is *SYSVAL. This tells the system to look at the
system value QPRTDEV. This IBM-supplied system value has a printer assigned to
it. For example: PRT01 could be the value assigned to the system value QPRTDEV.

To find out what printer is assigned to QPRTDEV, see “Understanding system


values” on page 22.
Display Device Description MSP38360

Device description . . . . . . . . : DSP10


Option . . . . . . . . . . . . . . : *BASIC
Category of device . . . . . . . . : *DSP
Device class . . . . . . . . . . . : *LCL

Device type . . . . . . . . . . . : 5291


Device model . . . . . . . . . . . : 2
Port number . . . . . . . . . . . : 6
Switch setting . . . . . . . . . . : 6
Online at IPL . . . . . . . . . . : *YES
Attached controller . . . . . . . : CTL02
Keyboard language type . . . . . . : USB
Character identifier . . . . . . . : *KBDTYPE
Allow blinking cursor . . . . . . : *YES
**************************************************************************
1 Printer device . . . . . . . . . . : *SYSVAL
2 Output queue . . . . . . . . . . . : *DEV
Library . . . . . . . . . . . . . . . :
**************************************************************************
Printer file . . . . . . . . . . . : QSYSPRT
Library . . . . . . . . . . . . : *LIBL
Text . . . . . . . . . . . . . . . : CREATED BY AUTO-CONFIGURATION

| Stage 2: Job run time


| At job run time, the values in the printer file and the job attributes are used. For
| additional information about how the OUTQ and PRTDEV job attributes can be
| changed, see the Work Management topic in theInformation Center.

Understanding printer files


Notes:
1. The information in this chapter on printer files is quite brief and intended only
to introduce the printer file concept to you. For more detailed information on
printer file support go to “Chapter 2. Printer file support” on page 41.
2. Also, for this discussion, assume that the printer file parameter SPOOL is set to
*YES. This means that spooled files will be sent to an output queue (OUTQ).

| As you learned earlier in this chapter, printer files contain many parameters that
| describe how the system is to operate on the data as it passes between your
| application program and the printer. One of these parameters, the output queue
| (OUTQ) parameter, tells the system which output queue receives your spooled
| files.

On the following page is a diagram of the system-supplied printer file called


QSYSPRT. Locate the spooled output queue parameter (1) on that diagram.

Chapter 1. Understanding printing elements of the AS/400 system 19


You might expect that the location of your printed output can be determined by
knowing the name of the spooled output queue specified in your printer file.
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
| attributes to determine the name of the output queue (OUTQ).

| For more detailed information about job attributes, see the Work Management
| topic in the AS/400 Information Center.
| Display Spooled File File . . . . . : QPDSPFD
| Control . . . . . Columns 1 - 78
| Find . . . . . .
| 2/09/98 Display File Description
|
| DSPFD Command Input
| File . . . . . . . . . . . . . . . . . . . : FILE QSYSPRT
| Library . . . . . . . . . . . . . . . . . : *LIBL
| Type of information . . . . . . . . . . . . : TYPE *ALL
| File attributes . . . . . . . . . . . . . . : FILEATR *ALL
| System . . . . . . . . . . . . . . . . . . : SYSTEM *LCL
| File Description Header
| File . . . . . . . . . . . . . . . . . . . : FILE QSYSPRT
| Library . . . . . . . . . . . . . . . . . . : QSYS
| Type of file . . . . . . . . . . . . . . . : Device
| Device type . . . . . . . . . . . . . . . . : Printer
| Auxiliary storage pool ID . . . . . . . . . : 01
| Device File Attributes
| Externally described file . . . . . . . . . : No
| File level identifier . . . . . . . . . . . : 0980109013920
| Creation date . . . . . . . . . . . . . . . : 01/09/98
| Text 'description' . . . . . . . . . . . . : TEXT System non-describ
| Spool the data . . . . . . . . . . . . . . : SPOOL *YES
| Maximum devices . . . . . . . . . . . . . . : 1
| User specified DBCS data . . . . . . . . . : IGCDTA *NO
| Maximum file wait time . . . . . . . . . . : WAITFILE *IMMED
| Share open data path . . . . . . . . . . . : SHARE *NO
| Record format level check . . . . . . . . . : LVLCHK *NO
| Number of record formats . . . . . . . . . : 1
| User buffer length . . . . . . . . . . . . : 0
| Number of devices . . . . . . . . . . . . . : 1
| Separate indicator area . . . . . . . . . . : INDARA No
| Coded character set identifier . . . . . . : CCSID 0
| Printer Attributes
| Device . . . . . . . . . . . . . . . . . . : DEV *JOB
| Printer device type . . . . . . . . . . . . : DEVTYPE *SCS
| Page size PAGESIZE
| Length . . . . . . . . . . . . . . . . . : 34
| Width . . . . . . . . . . . . . . . . . . : 132
| Measurement Method . . . . . . . . . . . : *ROWCOL
| Lines per inch . . . . . . . . . . . . . . : LPI 6
| Characters per inch . . . . . . . . . . . . : CPI 10
| Front margin . . . . . . . . . . . . . . . : FRONTMGN *DEVD
| Back margin . . . . . . . . . . . . . . . . : BACKMGN *FRONTMGN
| Overflow line number . . . . . . . . . . . : OVRFLW 30
| Fold records . . . . . . . . . . . . . . . : FOLD *NO
| Degree of page rotation . . . . . . . . . . : PAGRTT *AUTO
| Hardware justification . . . . . . . . . . : JUSTIFY 0
| Print on both sides . . . . . . . . . . . . : DUPLEX *NO
| Defer Write . . . . . . . . . . . . . . . . : DFRWRT *YES
| Unprintable character action RPLUNPRT
| Replace character . . . . . . . . . . . . : *YES
| Replacement character . . . . . . . . . . : ' ' X'40'
| Print text . . . . . . . . . . . . . . . . : PRTTXT *JOB
| Align page . . . . . . . . . . . . . . . . : ALIGN *NO
| Control character . . . . . . . . . . . . . : CTLCHAR *NONE

20 OS/400 Printer Device Programming V5R1


| Channel values . . . . . . . . . . . . . . : CHLVAL *NORMAL
| Fidelity . . . . . . . . . . . . . . . . . : FIDELITY *CONTENT
| Printer quality . . . . . . . . . . . . . . : PRTQLTY *STD
| Form feed . . . . . . . . . . . . . . . . . : FORMFEED *DEVD
| Source drawer . . . . . . . . . . . . . . . : DRAWER 1
| Output bin . . . . . . . . . . . . . . . . : OUTBIN *DEVD
| Font FONT
| Identifier . . . . . . . . . . . . . . . : *CPI
| Point size . . . . . . . . . . . . . . . : *NONE
| Character identifier . . . . . . . . . . . : CHRID *CHRIDCTL
| Decimal format . . . . . . . . . . . . . . : DECFMT *JOB
| Font character set . . . . . . . . . . . . : FNTCHRSET *FONT
| Coded font . . . . . . . . . . . . . . . . : CDEFNT *FNTCHRSET
| Table Reference Characters . . . . . . . . : TBLREFCHR *NO
| AFP Chars . . . . . . . . . . . . . . . . . : AFPCHARS *NONE
| Page definition . . . . . . . . . . . . . . : PAGDFN *NONE
| Form definition . . . . . . . . . . . . . . : FORMDF *NONE
| Form type . . . . . . . . . . . . . . . . . : FORMTYPE *STD
| Pages per side . . . . . . . . . . . . . . : MULTIUP 1
| Reduce output . . . . . . . . . . . . . . . : REDUCE *TEXT
| Unit of measure . . . . . . . . . . . . . . : UOM *INCH
| Front side overlay . . . . . . . . . . . . : FRONTOVL *NONE
| Back side overlay . . . . . . . . . . . . . : BACKOVL *FRONTOVL
| IPDS pass through . . . . . . . . . . . . . : IPDSPASTHR *DEVD
| Convert line data . . . . . . . . . . . . . : CVTLINDTA *NO
| User resource library list . . . . . . . . : USRRSCLIBL *DEVD
| Corner staple . . . . . . . . . . . . . . . : CORNERSTPL *NONE
| Edge stitch . . . . . . . . . . . . . . . : EDGESTITCH
| Reference edge . . . . . . . . . . . . . . : *NONE
| Saddle stitch . . . . . . . . . . . . . . . : SADLSTITCH
| Reference edge . . . . . . . . . . . . . . : *NONE
| Font resolution . . . . . . . . . . . . . : FNTRSL *DEVD
| DBCS extension characters . . . . . . . . . : IGCEXNCHR *YES
| DBCS character rotation . . . . . . . . . . : IGCCHRRTT *NO
| DBCS characters per inch . . . . . . . . . : IGCCPI *CPI
| DBCS SO/SI spacing . . . . . . . . . . . . : IGCSOSI *YES
| DBCS Coded font . . . . . . . . . . . . . . : IGCCDEFNT *SYSVAL
| Spooling Description
| **********************************************************************************
| 1 Spooled output queue . . . : OUTQ *JOB
| **********************************************************************************
| Max spooled output records . . . . . . . . : MAXRCDS 100000
| Spooled output schedule . . . . . . . . . . : SCHEDULE *FILEEND
| Copies . . . . . . . . . . . . . . . . . . : COPIES 1
| Page range to print PAGERANGE
| Starting page . . . . . . . . . . . . . . : 1
| Ending page . . . . . . . . . . . . . . . : *END
| File separators . . . . . . . . . . . . . . : FILESEP 0
| Hold spooled file . . . . . . . . . . . . . : HOLD *NO
| Save spooled file . . . . . . . . . . . . . : SAVE *NO
| Output priority (on OUTQ) . . . . . . . . . : OUTPTY *JOB
| User data . . . . . . . . . . . . . . . . . : USRDTA *SOURCE
| Spool file owner . . . . . . . . . . . . . : SPLFOWN *CURUSRPRF
| User defined option . . . . . . . . . . . . : USRDFNOPT *NONE
| User defined data . . . . . . . . . . . . . : USRDFNDTA *NONE
| User defined object USRDFNOBJ
| Object . . . . . . . . . . . . . . . . . : *NONE
| Library . . . . . . . . . . . . . . . . :
| Object type . . . . . . . . . . . . . . . :
| Record Format List
| Record Format Level
| Format Fields Length Identifier
| QSYSPRT 0 0 0000000000000
| Text . . . . . . . . . . . . . . . . . . . :
| Total number of formats . . . . . . . . . . : 1

Chapter 1. Understanding printing elements of the AS/400 system 21


| Total number of fields . . . . . . . . . . . : 0
| Total record length . . . . . . . . . . . . : 0
|

| Understanding system values


System values are objects supplied by IBM and shipped with the system. System
values control such things as system date, system time, system console (display
station), system printer, and so on. The system value most important to printing is
the system printer.

The name of the system value that specifies the name of the default system printer
is QPRTDEV. The value supplied by IBM for the system value QPRTDEV is
PRT01.

Displaying the QPRTDEV system value: As a user of the system, you can
display any of the IBM-supplied system values.

To display the QPRTDEV system value, type DSPSYSVAL QPRTDEV and press the
Enter key.

If the value supplied by IBM has not been changed, the name of the system printer
is PRT01.

Where did the output go?


Since the printer file in the example specified SPOOL = *YES, the application
program sent a spooled file to an output queue. The system looked at the printing
elements in the order shown in “Understanding the hierarchy of the printing
elements” on page 15. In the example, the spooled file was sent to the output
queue with the same name as the system printer, PRT01.

How the printing elements control print activity


This chapter has discussed the many elements that control where your requests for
printed output go.

If you are a programmer or system operator, the flexibility of creating additional


output queues can help you manage and balance your printing work load.

If you are the person responsible for adding new users to the system, you can
avoid confusion by specifying the necessary print device values you want in the
user’s user profile.

Go to “Examples: where your printing would go” on page 23 for some examples
that show how the printing elements work with each other.

Other elements that control print activity


Prior to V4R4, storing the spooled file under a QPRTJOB could influence where a
spooled file would be logically stored. If a printer file had *JOB specified in the
output queue parameter, the output queue parameter in the QPRTJOB would be
used. The value in the output queue parameter in current job would be ignored.
Beginning with V4R4, the output queue of the current job controls where the
spooled files are stored.

You can do one or more of the following to affect your print activity:
v You can use the spooled file owner parameter to store the printed output under
a different job and user.

22 OS/400 Printer Device Programming V5R1


v You can use the QWTSETP API, and switch to a different user profile. See
“Working with a QPRTJOB” on page 157, for more information.
v You can create a data area to use the output queue value from the QPRTJOB job
by doing the following: Create a data area that is called QPRTJOB. The data area
must exist in either QUSRSYS or the first product library in the library list of the
current job. The data area must be of type logical and have a value of false (0).
The user profile QSPL must own the data area. If the QPRTJOB data area is not
found, or there are any problems with it, the output queue value of the current
job will be used instead. Problems with the data area can include: damage to the
data area, not the correct type, not owned by user QSPL, or has a logical value
of true (’1’).
| v You can use the CL command, ADDENVVAR, to trigger the OS to add an entry
| in the DATQ for each spool file created. For more information about creating
| data queues, see “Environment variable QIBM_NOTIFY_CRTSPLF data queue
| support” on page 132

Examples: where your printing would go


| The following examples show where your printed output would go based on
| certain values that are assigned to the various printing elements. The graphics
| indicate the values assigned to the job before the job begins or before the spool file
| gets created.

Example 1: Determine your output queue


| In the printer file, assume that:
| v The spooled file owner is *CURUSRPRF.
| v Output queue value is *JOB
| v Printer device value is *JOB
| v SPOOL = *YES
| Because SPOOL = *YES, the output must go to an output queue.

| Also assume that there has not been a switch to an alternate user profile.

| In example 1, at job initiation, the following takes place:

Chapter 1. Understanding printing elements of the AS/400 system 23


| The system looks at the OUTQ parameter in the job description, that value is
| *USRPRF. This tells the system to look at the OUTQ parameter in the user profile.
| In this example, that value is *WRKSTN. This tells the system to look at the OUQ
| parameter in the workstation description. In the workstation description, the
| OUTQ parameter value is *DEV. *DEV is stored in the job attribute OUTQ.

| The system looks a the PRTDEV parameter in the job description, that value is
| *USRPRF. This tells the system to look at the PRTDEV parameter in the user
| profile. In this example, that value is *WRKSTN. This tells the system to look at
| the PRTDEV parameter in the workstation description. This tells the system to look
| at hte system value QPRTDEV and to use the output queue on the system that has
| the same name as the system printer named in the system value QPRTDEV. In this
| example, that is PRT01. PRT01 is stored in the job attribute PRTDEV.

| At job run time, the following takes place:

| When a spooled file is to be created, the system looks at the OUTQ parameter in
| the printer file for the output queue name. In this example, that value is *JOB. This
| tells the system to look at the OUTQ attribute for the job. The OUTQ job attribute
| was set to *DEV during the job initiation stage. The OUTQ job attribute, *DEV, tells
| the system to look at the DEV parameter in the printer file. The value in the DEV
| parameter of the printer file is *JOB. That value tells the system to look at the
| PRTDEV attribute of the job. If the IBM-supplied value for QPRTDEV has not been
| changed, the printer device name is PRT01 and the output queue name is PRT01.

| If the IBM-supplied value for QPRTDEV has not been modified, the printer device
| name is PRT01 and the output queue name is PRT01.

Example 2: Determine your output queue


In the printer file, assume that:
v Spooled file owner is *CURUSRPRF.
v Output queue value is PRT04
v Printer device value is PRT08
v SPOOL = *YES

| In example 2, the output queue would be PRT04. The system found the output
| queue parameter value of PRT04 in the printer file rather than a value that would
| point it to your OUTQ job attribute.

24 OS/400 Printer Device Programming V5R1


| Example 3: Determine your output queue
| In the printer file, assume the following:
| v Output queue value is *JOB
| v Printer device value is *JOB
| v SPOOL = *YES
| v Spooled file owner is *CURGRPPRF

| Also assume:
| v The job did not switch to an alternate user profile.
| v The current user has a group profile GRP.

|
|

|
| Note: Because the SPLFOWN parameter of the printer file is *CURGRPPRF, the
| spooled file will be created under job xxxxxx/GRP/QPRTJOB (where xxxxxx
| is 000000–999999). For more information on the SPLFOWN parameter see
| the CL Reference topic in the AS/400 Information Center.

| In example 3, at job initiation, the following takes place:

| The system looks at the OUTQ value in the current job description. The value
| *USRPRF, in the job description, tells the system to look at the OUTQ parameter in
| the user profile. The value in the OUTQ parameter of the user profile is
| *WRKSTN. This tells the system to look at the OUTQ parameter in the workstation
| description. In the workstation description, the OUTQ parameter is *DEV. In the
| job attributes, the OUTQ job attribute gets set to *DEV.

| The system looks PRTDEV parameter in the job description. The value *USRPRF, in
| the job description, tells the system to look at the PRTDEV parameter in the user
| profile. The value *WRKSTN, in the user profile, tells the system to look at the
| PRTDEV parameter in the workstation description. The value *SYSVAL, in the
| workstation description, tells the system to look at the system value and use the
| value set for QPRTDEV. The value in QPRTDEV is PRT01. PRT01 becomes the
| value for the PRTDEV job attribute.

| At job runtime the following takes place:

Chapter 1. Understanding printing elements of the AS/400 system 25


+ The sytem looks at the OUTQ value in the printer file. That value *JOB tells the
+ system to use the OUTQ job attribute for job xxxxxx/GRP/QPRTJOB which is
+ *DEV. This tells the system to look at the DEV attribute in the printer file, which is
+ *JOB. The value, *JOB tells the system to look at the PRTDEV value in the job
+ attributes. The value for the PRTDEV job attribute is PRT01.

| Example 4: Determine your output queue


| In the printer file, assume the following:
| v Output queue value is *JOB
| v Printer device value is *JOB
| v SPOOL = *YES
| v Spooled file owner is *CURUSRPRF

| Also assume that there has been a switch to an alternate user profile USR.

|
|

|
| Note: The SPLFOWN parameter of the printer file is *JOB, and the job has
| switched to user profile USR. The current job will create the spooled file. For
| more information on the SPLFOWN parameter see the CL Reference topic in
| the AS/400 Information Center.

+ The system looks at the OUTQ parameter in the printer file for the output queue
+ name. The value, in this example, *JOB, tells the system to look at the OUTQ job
+ attribute. Because the SPFLOWN parameter is set to *JOB, the job attribute OUTQ
+ of the current job is used. The value is PRT03. In this example, the spooled file
+ goes to output queue PRT03.

| Example 5: Determine your output queue


| In the printer file, assume the following:
| v Output queue value is *JOB
| v Printer device value is *JOB
| v SPOOL = *YES
| v Spooled file owner is *CURUSRPRF

26 OS/400 Printer Device Programming V5R1


| Also assume:
| v There has been a switch to an alternate user profile USR.
| v The data area QPRTJOB, of type *LGL, with a value of false (0), exists in library
| QUSRSYS and is owned by QSPL user profile.

| Note: The SPLFOWN parameter of the printer file is *CURUSRPRF, and the job
| has switched to user profile USR. The spooled file will be created under job
| xxxxxx/USR/QPRTJOB (where xxxxxx is 000000–999999). For more
| information on the SPLFOWN parameter see the CL Reference topic in the
| AS/400 Information Center.

| In example 5, at job initiation, the following takes place:

| The system looks at the OUTQ parameter in the job description. That value, PRT04
| tells the system that it does not need to look any further and sets the OUTQ job
| attribute to PRT04.

| The value *USRPRF in the PRTDEV parameter of the job description, tells the
| system to look at the PRTDEV attribute of the user profile. In the user profile, the
| value *WRKSTN tells the system to look at the PRTDEV parameter in the
| workstation description. That value, *SYSVAL tells the system to look at the system
| value QPRTDEV and to use the output queue that is named in that value. In this
| example, the value is PRT01 and it is stored in the job attribute PRTDEV.

| At job run time, the following takes place:

| The system looks at the OUTQ parameter in the printer file for the output queue
| name. That value *JOB, tells the system to look at the OUTQ attribute of the job.
| There is a data area, QPRTJOB in QUSRSYS, that is owned by the user profile
| QSPL that has a logical value of false. Because of this data area, the system will
| look at the OUTQ attribute for job xxxxxx/USR/QPRTJOB. In the
| xxxxxx/USR/QPRTJOB, the OUTQ attribute value *DEV tells the system to look at
| the DEV parameter in the printer file. The value *JOB in the DEV parameter of the
| printer file, tells the system to look at the PRTDEV attribute of the current job.
| That value is PRT01.

Chapter 1. Understanding printing elements of the AS/400 system 27


Example 6: Determine your output queue
In the printer file, assume the following:
v Output queue value is *JOB
v Printer device value is *JOB
v SPOOL = *YES
v Spooled file owner is *JOB

Also assume that there has been a switch to an alternate user profile USR.

|
+ Note: The SPLFOWN parameter of the printer file is *CURUSRPRF, and the job
+ has made a switch to user profile USR. The spooled file will be created
+ under job xxxxxx/USR/QPRTJOB (where xxxxxx is 000000–999999). For
+ more information on the SPLFOWN parameter see the CL Reference topic in
+ the AS/400 Information Center.

+ The system looks at the OUTQ parameter in the printer file for the output queue
+ name. That value, *JOB, tells the system to look at the OUTQ job attribute. The
+ system will look at the OUTQ job attribute of the current job, which is PRT03.

Example 7: Determine your output queue


| In the printer file, assume the following:
| v Output queue value is *JOB
| v Printer device value is *JOB
| v SPOOL = *YES
| v Spooled file owner is *CURUSRPRF

| Also assume:
| v There has been a switch to alternate user profile USR.
| v The current user has a group profile X.
| v The data area QPRTJOB, of type *LGL, with a value of false (0), exists in library
| QUSRSYS and is owned by QSPL user profile.

28 OS/400 Printer Device Programming V5R1


| v Another data area QPRTJOB, of type *LGL, with a value of true (1), exists in the
| first product library of the current job’s library list. The QSPL user profile owns
| the data area.

|
Note: The SPLFOWN parameter of the printer file is *CURUSRPRF, and the job
has switched to alternate user profile USR. The spooled file will be created
under job xxxxxx/USR/QPRTJOB (where xxxxxx is 000000–999999).

+ The system looks at the OUTQ parameter in the printer file for the output queue
+ name. That value, *JOB, tells the system to look at the OUTQ job attribute. Because
+ data area QPRTJOB with a logical value of true exists, the system will look at the
+ OUTQ job attribute of in the current job, which is PRT04.

| Example 8: Determine Your Printer Name


+ In the printer file, assume that:
+ v SPOOL = *NO
+ v The spooled file owner is *CURUSRPRF.
+ v Output queue value is *JOB
+ v Printer device value is *JOB

+ Also assume that there has not been a switch to an alternate user profile.

Chapter 1. Understanding printing elements of the AS/400 system 29


|

|
| In example 8, at job initiation, the following takes place:

| The system looks at the OUTQ parameter in the job description. That value
| *USRPRF tells the system to look at the OUTQ parameter in the user profile. The
| value of the OUTQ parameter in the user profile is OUTQ1. Because this is the
| name of a specific output queue, this value is stored as the OUTQ value in the job
| attributes.

| The system looks at the PRTDEV parameter in the job description. That value
| *USRPRF tells the system to look at the PRTDEV parameter in the user profile. The
| PRTDEV value in the user profile is PRT02. Because this is the name of a specific
| printer device, the system stops looking and stores this value as the PRTDEV value
| in the job attributes.

| At job run time the following takes place:

+ In this example, your printer device would be PRT02. This is because the system
+ looked first into the printer file and found the PRTDEV parameter value to be
+ *JOB, which sent it to the job attribute PRTDEV.

+ The job attribute PRTDEV value is PRT02.

| In this example, the printer file specified SPOOL = *NO. Your output would go
| directly to PRT02 for printing and no output queue would be used.

| Example 9: Determine Your Printer Name


+ In the printer file, assume that:
+ v SPOOL = *NO.
+ v The spooled file owner is *CURUSRPRF.
+ v Output queue value is *JOB
+ v Printer device value is *JOB

+ Also assume that there has not been a switch to an alternate user profile.

30 OS/400 Printer Device Programming V5R1


| In this example, at job initiation, the following takes place:

| The system looks at the OUTQ parameter in the job description. That value,
| *USRPRF tells the system to look at the OUTQ parameter in the user profile. In the
| user profile, the OUTQ parameter value is *WRKSTN. This value tells the system
| to look at the OUTQ parameter in the workstation description. The OUTQ value in
| the workstation description is PRT02. This value is stored as the OUTQ value in
| the job attributes.

| The system looks at the PRTDEV value in the job description. That PRTDEV value
| in the job description is *USRPRF. That value tells the system to look at the
| PRTDEV value in the user profile. The PRTDEV value in the user profile is
| *WRKSTN. That value tells the system to look at the PRTDEV value in the
| workstation description. The PRTDEV value in the workstation description is
| PRT03. This value is stored as the PRTDEV value in ithe job attributes.

+ At job run time, the following takes place:

| The system looked at the printer file and found the PRTDEV parameter value to be
| *JOB, which tells the system to look next in the job printer attribute PRTDEV.

+ In this example, that value is PRT03.

| In this example, the printer file specified SPOOL = *NO. Your output would go
| directly to PRT03 for printing and no output queue would be used.

| REMEMBER:

| You must know the value (*YES or *NO) of the SPOOL parameter in
| the printer file to determine if your output goes to an output queue
| or to a printer. If SPOOL = *YES, a spooled file goes to an output
| queue. If SPOOL = *NO, the output goes directly to a printer.

| Printing in a batch environment


When a user signs on to the AS/400 system, an output queue (OUTQ) and a
printer device (PRTDEV) are established for that job.

The names for the output queue and printer device are resolved when the system
searches through the user profile, job description, workstation description, and
system values.

Chapter 1. Understanding printing elements of the AS/400 system 31


How output is routed in a batch job
A similar process occurs when batch jobs are started on the system, with two
differences:
v The output queue and printer device values are passed to the batch job from the
job that started it. This means that no resolution of the output queue and printer
device needs to be done.
v The value *WRKSTN has no real meaning because batch jobs do not have an
associated workstation. If *WRKSTN is encountered in the resolution of output
queue and printer device, *WRKSTN is replaced with *DEV if output queue is
being resolved and *SYSVAL if printer device is being resolved.

Following are examples that illustrate where output goes from a job that runs in
batch.

Example 1
Assume:
v There has not been a switch to an alternate user profile.
v The spooled file owner is *CURUSRPRF.
v The user’s output queue (OUTQ) is OUTQ1 and the printer device (PRTDEV) is
PRT1.
v The Submit Job (SBMJOB) command is used to submit the job to batch.
v The output queue parameter on the SBMJOB command is specified as
*CURRENT.
v The printer device parameter on the SBMJOB command is specified as
*CURRENT.

When the job runs in batch, the resulting spooled file is sent to OUTQ1 and that
spooled file prints on the printer assigned to OUTQ1.

If no spooling was used when printing, the output would go to printer device
PRT1.

The reason OUTQ1 and PRT1 are used is that *CURRENT is the value passed to
the batch job by the user.

Example 2
Assume:
v There has not been a switch to an alternate user profile.
v The spooled file owner *CURUSRPRF value on the printer file has not been
overridden.
v The user’s output queue (OUTQ) is OUTQ1 and the printer device (PRTDEV) is
PRT1.
v The Submit Job (SBMJOB) command is used to submit the job to batch.
v The output queue parameter on the SBMJOB command is specified as *USRPRF.
v The user profile has *WRKSTN as the value for the output queue parameter.
v The printer device parameter on the SBMJOB command is specified as PRT99.

When the job runs in batch, the resulting spooled file is sent to the output queue
named PRT99 and the spooled file prints on PRT99. The *WRKSTN value for
output queue is interpreted as *DEV and an output queue having the same name
as the printer device is selected.

32 OS/400 Printer Device Programming V5R1


If no spooling was used when printing, the output would go to printer device
PRT99.

Example 3
Assume:
v There has not been a switch to an alternate user profile.
v The spooled file owner *CURUSRPRF value on the printer file has not been
overridden..
v The user’s output queue (OUTQ) is OUTQ1 and the printer device (PRTDEV) is
PRT1.
v The Submit Job (SBMJOB) command is used to submit the job to batch.
v The output queue parameter on the SBMJOB command is specified as *USRPRF.
v The user profile has *WRKSTN as the value for the output queue parameter.
v The printer device parameter on the SBMJOB command is specified as
*WRKSTN.

When the job runs in batch, the resulting spooled file is sent to the system printer.
This is because the *WRKSTN value for output queue is interpreted as *DEV and
the printer device value of *WRKSTN is interpreted as *SYSVAL.

If no spooling was used when printing, the output would go to the printer defined
as the system printer. This is the printer name assigned to the system value
QPRTDEV.

Self-test: Determining output queue and printer device


Below are diagrams similar to the ones in the examples on the preceding pages.
Read the information in the diagrams. Using the information you have acquired
about the hierarchy of printing elements, determine what the output queue and
printer device names would be.

Record the names of the output queue and the printer device in the empty blocks
to the right of the diagram. The completed diagrams with the correct names for the
output queues and printer devices are available on the next page.

Note: Keep in mind the SPOOL parameter value when deciding on your answer.

You should also assume the following for both self-tests:


v There has not been a switch to an alternate user profile.
v The spooled file owner attribute is *CURUSRPRF.

Chapter 1. Understanding printing elements of the AS/400 system 33


Self-test answers
Below are the diagrams from the preceding page, with the correct output queue
and printer device parameter values filled in.

For the first diagram, the output queue name is PRT06.

34 OS/400 Printer Device Programming V5R1


+ The system looked first at the printer file and found SPOOL = *YES. Next it looked
+ at the output queue value in the printer file, which is *JOB. It then looked at the
+ output queue value in the job attribute OUTQ which is PRT06.

For the second diagram, the printer device value is PRT04.

+ Again, the system looked first at the printer file, but this time it found SPOOL =
+ *NO. Next, it looked at the device value in the printer file, which is *JOB. It then
+ looked at the device value in the job attribute PRTDEV.

+ The job attribute PRTDEV is PRT04.

If you had difficulty identifying the correct output queue and printer device you
should go to “Controlling print activity” on page 13 and read the information again
on controlling printing activity.

Chapter 1. Understanding printing elements of the AS/400 system 35


Where to find more examples
If you would like to experiment with some printing element examples, you can
find them in Appendix A. Examples of Working with Printing Elements.
v Creating output queues
v Displaying and changing your user profile
v Displaying system values (QPRTDEV)
v Changing a printer file
v Displaying a printer file
v Using the printer writer program
– Starting a printer
– Assigning a printer to a particular output queue
– Stopping a printer
v Working with spooled files
– Moving spooled files from one output queue to a different output queue
– Holding spooled files

36 OS/400 Printer Device Programming V5R1


Part 2. Printer file and spooling support
Chapter 2. Printer file support . . . . . . . 41 Restrictions for MULTIUP with
What is a printer file? . . . . . . . . . . . 41 REDUCE(*TEXT) . . . . . . . . . . 85
Different types of printer files . . . . . . . 41 Using the MULTIUP(1, 2, 3, or 4) and
What parameters make up a printer file? . . . 41 REDUCE(*NONE) parameters . . . . . . . 86
Creating a printer file . . . . . . . . . . . 46 Using the fidelity (FIDELITY) parameter . . . 88
IBM-supplied printer files . . . . . . . . 46 Fidelity and other printer file parameters . . 89
User-created printer files . . . . . . . . . 46 Using the overlay (FRONTOVL and BACKOVL)
Using a program-described printer file with an parameters . . . . . . . . . . . . . 89
application program . . . . . . . . . . . 47 Using overlays and rotation . . . . . . . 90
Open processing. . . . . . . . . . . . 49 Using the margin (FRONTMGN and
Printer file parameters . . . . . . . . . 49 BACKMGN) parameters . . . . . . . . . 93
Output processing . . . . . . . . . . . 56 Using *DEVD and 0 as margin parameter
Close processing. . . . . . . . . . . . 58 values . . . . . . . . . . . . . . 94
Using an externally-described printer file with an Restrictions with the margin parameters . . . 94
application program . . . . . . . . . . . 59 Using margin parameters and overlays . . . 94
Open processing. . . . . . . . . . . . 60 Using the corner staple (CORNERSTPL)
Output processing . . . . . . . . . . . 61 parameter . . . . . . . . . . . . . . 96
Data description specifications . . . . . . 61 Using the edge stitch (EDGESTITCH) parameter 96
Close processing. . . . . . . . . . . . 67 Using the saddle stitch (SADLSTITCH)
Output from the example application programs . . 68 parameter . . . . . . . . . . . . . . 98
Using a program-described printer file . . . . 68 Using the DBCS coded font (IGCCDEFNT)
Using an externally described printer file (using parameter . . . . . . . . . . . . . . 99
DDS) . . . . . . . . . . . . . . . 68 Transforming SCS DBCS data to AFPDS data 99
Overriding printer files . . . . . . . . . . 69 Generating AFPDS data to spool . . . . . 99
Applying overrides . . . . . . . . . . . 70 Using the font character set (FNTCHRSET)
Overriding file attributes . . . . . . . . 70 parameter . . . . . . . . . . . . . . 99
Overriding file names or types . . . . . . 71 Using the coded font (CDEFNT) parameter . . 100
Overriding file names or types and file Special printer file considerations. . . . . . . 100
attributes of the new file . . . . . . . . 72 Direct print considerations . . . . . . . . 100
CL program overrides . . . . . . . . . 72 Open considerations . . . . . . . . . . 100
Securing printer files . . . . . . . . . 73 Output considerations . . . . . . . . . 101
Using a generic override for printer files . . 73 Force-end-of-data considerations . . . . . 101
Deleting overrides . . . . . . . . . . . 73 Close considerations . . . . . . . . . . 101
Displaying overrides . . . . . . . . . . 74 First-character forms-control data. . . . . . 101
Changing printer files . . . . . . . . . . . 74 Printer font support . . . . . . . . . . 103
Using printer file parameters . . . . . . . . 75 Characters per inch versus font . . . . . 103
Using the device type (DEVTYPE) parameter . . 75 Proportionally spaced and typographic fonts 104
Using the SCHEDULE parameter . . . . . . 76 Font substitution . . . . . . . . . . 105
*JOBEND considerations . . . . . . . . 76 IPDS printer FONT parameter considerations 105
*IMMED considerations . . . . . . . . 76 Using graphic symbol sets . . . . . . . . 106
Using the OUTPTY parameter . . . . . . . 77 Replacing on unprintable characters . . . . . 106
Using the align (ALIGN) parameter . . . . . 77 Considerations for the 4245, 5262, 6252, and
Using the page rotation (PAGRTT) parameter . . 78 6262 printers . . . . . . . . . . . 107
If PAGRTT = *AUTO . . . . . . . . . 78 Using alternative character sets and code pages
If PAGRTT = *DEVD . . . . . . . . . 78 for printer output . . . . . . . . . . . 107
If PAGRTT = 0, 90, 180, or 270 degrees . . . 79 Print text . . . . . . . . . . . . . . 109
If PAGRTT = *COR . . . . . . . . . . 79 Editing output fields . . . . . . . . . . 110
Page rotation on the 3831, 3835, 3900, User-defined edit codes . . . . . . . . 110
InfoPrint 3000, and InfoPrint 4000 printers . . 79 Effect of changing fields in a file description . . 111
Page rotation and duplex printing . . . . . 80 Redirecting output. . . . . . . . . . . 112
Using the MULTIUP(1, 2, 3, or 4) and Nonspooled output . . . . . . . . . 112
REDUCE(*TEXT) parameters . . . . . . . 81 Spooled files. . . . . . . . . . . . 112
MULTIUP support for the 4224, 4230, 4234, Spooled file redirected to SCS printers . . . 112
4247 printers . . . . . . . . . . . . 82 Spooled files redirected to IPDS printers . . 114
MULTIUP support . . . . . . . . . . 82 3812 and 3816 SCS printer considerations . . . 116
3835 printer considerations . . . . . . . . 116

© Copyright IBM Corp. 1997, 2001 37


3912, 3916, and 4028 printer considerations . . 116 Using the work with printing status option 147
Printing a graphic along with other output . . 117 Restarting and controlling printing . . . . . 148
Special printer file considerations for AFPDS . . . 118 Spooled file security . . . . . . . . . . 148
Considerations for printer file parameters . . . 118 Controlling the number of spooled files in your
Considerations for sending an AFPDS spooled system . . . . . . . . . . . . . . 150
file to another system. . . . . . . . . . 118 Reclaiming empty spooled file members . . 150
Special DDS considerations for AFPDS . . . . . 119 Example 1: Adjusting the QRCLSPLSTG
Performance considerations. . . . . . . . . 120 system value . . . . . . . . . . . 151
Example 2: Using the reclaim spool storage
Chapter 3. Spool support . . . . . . . . . 123 (RCLSPLSTG) command. . . . . . . . 151
Overview: Why spooling is important . . . . . 123 Reducing system ASP storage . . . . . . 151
Spooling elements . . . . . . . . . . . . 124 Spooled file names . . . . . . . . . . 151
Application program . . . . . . . . . . 124 Redirecting spooled files. . . . . . . . . 152
Printer file . . . . . . . . . . . . . 125 Copying spooled files . . . . . . . . . 152
Printer device descriptions . . . . . . . . 125 Selecting the control character (CTLCHAR)
Output queues . . . . . . . . . . . . 125 parameter . . . . . . . . . . . . 153
Output queue security . . . . . . . . 125 Selecting the channel value (CHLVAL)
Output queue parameters . . . . . . . 126 parameter . . . . . . . . . . . . 156
Summary of output queue commands . . . 128 Example of using control codes . . . . . 156
Default output queues for printers . . . . 128 | Sample commands for additional spooling
Default output queues for system printer . . 129 | support . . . . . . . . . . . . . . 156
Creating your own output queues . . . . 129 | Save spooled file (ZSAVSPLF) sample
Order of spooled files on an output queue 129 | command . . . . . . . . . . . . 156
Status of spooled files on an output queue 130 | Restore spooled file (ZRSTSPLF) sample
Controlling printing from an output queue | command . . . . . . . . . . . . 156
by spooled file size . . . . . . . . . 131 Working with job and file separators . . . . 156
Data queue support on output queues . . . 131 Using application program interfaces (APIs) . . 157
| Environment variable Working with a QPRTJOB . . . . . . . . 157
| QIBM_NOTIFY_CRTSPLF data queue Cleanup of QPRTJOB jobs . . . . . . . 158
| support . . . . . . . . . . . . . 132
Creating data queues . . . . . . . . . 132 Chapter 4. Remote System Printing . . . . . 159
Specifying data queues on the CRTOUTQ Benefits of Using Remote System Printing . . . . 159
and CHGOUTQ commands . . . . . . 132 How remote system printing works . . . . . . 160
Working with data queues when errors occur 132 The Role of the Create Output Queue
Managing data queue entries . . . . . . 133 (CRTOUTQ) Command in Remote System
Record type 01 data queue entry format . . 133 Printing . . . . . . . . . . . . . . 161
Record type 02 data queue entry format . . 134 Role of the Start Remote Writer (STRRMTWTR)
Using multiple output queues . . . . . . 136 Command When Using Remote System Printing 169
Controlling multiple output queues . . . . 136 Working With User Print Information . . . . . 173
Output queue recovery . . . . . . . . 137 Using the CHGUSRPRTI Command . . . . . 173
Spooled file cleanup after an abnormal IPL 138 Using the DSPUSRPRTI Command . . . . . 173
Printer writer program . . . . . . . . . 138 Using the RTVUSRPRTI Command . . . . . 173
Remote writer program . . . . . . . . . 139 Send and Defer Status of Spooled Output Files . . 174
Using multiple printer writer support . . . . 140 Spooled Output File Attributes . . . . . . 175
Locating your printed output . . . . . . 140 Preparing AS/400 V3R1 or later to AS/400 V3R1 or
Summary of writer commands for printing 140 later for Remote System Printing . . . . . . . 176
Using a printer for both spooled files and direct Source System Activity - Creating the Remote
print jobs . . . . . . . . . . . . . . . 141 Output Queue . . . . . . . . . . . . 178
Enabling the allow direct print function . . . 141 Target System Activity - Printing Spooled
Modifying the start printer writer Output Files from the Source System . . . . 179
(STRPRTWTR) command . . . . . . . 142 Preparing AS/400 V3R1 or later to AS/400 V2R3
Restrictions when using the allow direct for Remote System Printing . . . . . . . . 181
print function . . . . . . . . . . . 142 Source System Activity - Creating the Remote
Managing spooled files . . . . . . . . . . 142 Output Queue . . . . . . . . . . . . 183
Using the work with spooled files (WRKSPLF) Target System Activity - Printing Spooled
command . . . . . . . . . . . . . 142 Output Files from the Source System . . . . 185
Using the send option . . . . . . . . 143 Preparing AS/400 V3R1 or later to VM/MVS for
Using the messages option . . . . . . . 143 Remote System Printing . . . . . . . . . . 186
Using the change option. . . . . . . . 144 Source System Activity - Creating the Remote
Using the attributes option . . . . . . . 145 Output Queue . . . . . . . . . . . . 188
Device requirements . . . . . . . . . 145

38 OS/400 Printer Device Programming V5R1


Target System Activity - Printing Spooled
Output Files from the Source System . . . . 189
Preparing AS/400 V3R1 or later to PS/2 with PSF
for OS/2 for Remote System Printing . . . . . 189
Source System Activity - Creating the Remote
Output Queue . . . . . . . . . . . . 190
Target System Activity - Printing Spooled
Output Files from the Source System . . . . 192
Preparing AS/400 V3R7 or later to NetWare for
Remote System Printing . . . . . . . . . . 192
Source System Activity - Creating the Remote
Output Queue . . . . . . . . . . . . 193
Target System Activity - Printing Spooled
Output Files from the Source System . . . . 194

Chapter 5. Working with the OS/400 Network


Print Server . . . . . . . . . . . . . 195
How is the network print server accessed? . . . 195
Prestart Jobs and the Network Print Server . . 196
Monitoring Prestart Jobs for the Network
Print Server . . . . . . . . . . . . 196
Changing Prestart Job Entries . . . . . . 196
Exit Points and the Network Print Server . . . . 197
AS/400 Registration Facility and the Network
Print Server . . . . . . . . . . . . . 198
Verifying Exit Point and Exit Program
Registration . . . . . . . . . . . . 198
Using the OS/400 Network Print Server Exit Points 198
Exit Point QIBM_QNPS_ENTRY . . . . . . 199
Required Parameter Group . . . . . . . 199
Exit Point QIBM_QNPS_SPLF . . . . . . . 200
Required Parameter Group . . . . . . . 200
Parameter Field Descriptions . . . . . . . 202

Part 2. Printer file and spooling support 39


40 OS/400 Printer Device Programming V5R1
Chapter 2. Printer file support
This chapter contains general-use programming interface and associated guidance
information.

After reading this chapter you will:


v Understand what a printer file is.
v Understand how to create a printer file.
v Understand how to work with printer file overrides.
v Understand how to change printer files.
v Understand how a printer file interacts with an application program.
An application program is used to perform a particular data processing task,
such as inventory control, mailing labels, or payroll.

What is a printer file?


Printer files describe how the system is to operate on data as it passes between
your application program and a printer. The printer file to be used is specified in
your application program.

Different types of printer files


There are two different types of printer files:
v Program-described printer files
Program-described printer files rely on the high-level language program to
define records and fields to be printed.
v Externally-described printer files
Externally-described printer files use data description specifications (DDS) rather
than the high-level language to define records and fields to be printed. If you
use DDS, you specify the name of your DDS source file in the SRCFILE
parameter of the Create Printer File (CRTPRTF) command. DDS gives the
application programmer much more format and print control over the printed
output. For more information about DDS keywords, see DDS Reference in the
online AS/400 Information Center, under the Database topic.

What parameters make up a printer file?


Like other CL commands, the Create Printer File (CRTPRTF) command is made up
of a group of parameters. These parameters, and the different values you can
assign to each parameter, are designed to give you great flexibility in choosing
how you want your printed output to look.

The following table provides a list of all the parameters of the CRTPRTF command.
It also indicates if those parameters can be changed or temporarily overridden
through the Override Printer File (OVRPRTF) command or through a program
written in a high-level language (HLL) such as RPG, COBOL, PL/I, C, or BASIC.

© Copyright IBM Corp. 1997, 2001 41


Table 1. Printer Support Parameters
Specified on
CRTPRTF and Specified on Specified in HLL
CL Parameter Name Description CHGPRTF Command OVRPRTF Command Program
FILE Printer file name Qualified file name *PRTF or file name RPG/400,
COBOL/400, PL/I,
C/400*, and BASIC
TOFILE Overriding file *FILE or qualified
name
SRCFILE Source file *NONE or qualified
name
SRCMBR Source member *FILE or name
GENLVL Generation severity 0, 10, 20, or 30
level
OPTION Type of output list *SRC, *SOURCE,
*NOSRC,
*NOSOURCE, *LIST
or *NOLIST, *SECLVL
or *NOSECLVL
DEV Device name *JOB, *SYSVAL, or *JOB, *SYSVAL, or
device name device name
DEVTYPE Device type *SCS, *IPDS, *SCS, *IPDS,
*USERASCII, *USERASCII,
*AFPDS, *LINE, or *AFPDS, *LINE, or
*AFPDSLINE *AFPDSLINE
| CVTLINDTA Convert line data and *NO, or *YES *NO, or *YES
| page definition to
| AFPDS
PAGESIZE Page length, width, Page length, width, Page length, width, RPG/400 and BASIC
and measurement and measurement and measurement
method method method
LPI Lines per inch 3, 4, 6, 7.5, 8, 9, or 12 3, 4, 6, 7.5, 8, 9, or 12
CPI Characters per inch 5, 10, 12, 13.3, 15, 5, 10, 12, 13.3, 15,
16.7, 18 or 20 16.7, 18 or 20
FRONTMGN Front margin 0 or any positive 0 or any positive
number number
BACKMGN Back margin *FRONTMGN, 0, or *FRONTMGN, 0, or
any positive number any positive number
OVRFLW Overflow line Line number Line number RPG/400 and BASIC
number
FOLD Fold records *NO, or *YES *NO, or *YES
RPLUNPRT Replace unprintable *YES and replacement *YES and replacement
characters character, or *NO character, or *NO
ALIGN Align forms *NO, or *YES *NO, or *YES RPG/400
CTLCHAR Control character *NONE, *FCFC, or *NONE, *FCFC, or PL/I and C/400
*MACHINE *MACHINE
CHLVAL Channel value *NORMAL or *NORMAL or
channel value and channel value and
line number line number

42 OS/400 Printer Device Programming V5R1


Table 1. Printer Support Parameters (continued)
Specified on
CRTPRTF and Specified on Specified in HLL
CL Parameter Name Description CHGPRTF Command OVRPRTF Command Program
FIDELITY Fidelity *CONTENT or *CONTENT or
*ABSOLUTE *ABSOLUTE
PRTQLTY Print quality *STD, *DRAFT, *STD, *DRAFT,
*NLQ, *DEVD, or *NLQ, *DEVD, or
*FASTDRAFT *FASTDRAFT
FORMFEED Form feed mode *DEVD, *CONT, *DEVD, *CONT, COBOL/400
*CONT2, *CUT, or *CONT2, *CUT, or
*AUTOCUT *AUTOCUT
DRAWER Source drawer 1 through 255, *E1, or 1 through 255, *E1, or
*FORMDF *FORMDF
OUTBIN Output bin 1 through 65,535 1 through 65,535
FONT Font identifier and *CPI, *DEVD, font *CPI, *DEVD, font
point size identifier name and identifier name and
point size of font if a point size of font if a
point size is valid point size is valid
CHRID Character set code *DEVD, *CHRIDCTL, *DEVD, *CHRIDCTL,
page *SYSVAL, *SYSVAL,
*JOBCCSID, or *JOBCCSID, or
graphic character set graphic character set
and code page and code page
DECFMT Decimal Format *JOB, *FILE *JOB, *FILE
FNTCHRSET Font character set and *FONT, font character *FONT, font character
point size set and code page, set and code page,
and point size of font and point size of font
if a point size is valid if a point size is
valid.
CDEFNT Coded font and point *FNTCHRSET, coded *FNTCHRSET, coded
size font name, and point font name, and point
size size of font if a point
size is valid.
PAGDFN Page definition *NONE or page *NONE or page
definition definition
FORMDF Form definition *NONE, *DEVD, or *NONE, *DEVD, or
form definition form definition
AFPCHARS AFP characters *NONE or AFP *NONE or AFP
characters characters
TBLREFCHR AFP characters *NO or *YES *NO or *YES
PAGRTT Page rotate *AUTO, *DEVD, *AUTO, *DEVD,
*COR, 0, 90, 180, or *COR, 0, 90, 180, or
270 270
MULTIUP Pages per side 1 through 4 1 through 4
REDUCE Reduce *TEXT or *NONE *TEXT or *NONE
PRTTXT Print text *JOB, *SYSVAL, *JOB, *SYSVAL,
*BLANK, or print text *BLANK, or print text
JUSTIFY Justify 0, 50, or 100 0, 50, or 100

Chapter 2. Printer file support 43


Table 1. Printer Support Parameters (continued)
Specified on
CRTPRTF and Specified on Specified in HLL
CL Parameter Name Description CHGPRTF Command OVRPRTF Command Program
DUPLEX Output printed on *NO, *YES, *NO, *YES,
one or both sides of *TUMBLE, or *TUMBLE, or
the paper *FORMDF *FORMDF
UOM Unit of measure *INCH or *CM *INCH or *CM
FRONTOVL Front side overlay *NONE, qualified *NONE, qualified
overlay name and overlay name and
library, offsets library, offsets
BACKOVL Back side overlay *FRONTOVL, *FRONTOVL,
*NONE, qualified *NONE, qualified
overlay name and overlay name and
library, offsets, library, offsets,
constant back constant back
IPDSPASTHR IPDS pass-through *DEVD, *NO, or *YES *DEVD, *NO, or *YES
done for spooled file
USRRSCLIBL User resource *DEVD, *NONE, *DEVD, *NONE,
libraries *JOBLIBL, or *JOBLIBL, or
*CURLIB *CURLIB
CORNERSTPL Reference corner for *NONE, *DEVD, *NONE, *DEVD,
corner staple *BOTRIGHT, *BOTRIGHT,
*TOPRIGHT, *TOPRIGHT,
*TOPLEFT, or *TOPLEFT, or
*BOTLEFT *BOTLEFT
EDGESTITCH Specifies where Reference Edge, Reference Edge,
staples will be placed Reference Edge Reference Edge
Offset, Number of Offset, Number of
Staples, Staple Offsets Staples, Staple Offsets
SADLSTITCH Specifies where Reference Edge, Reference Edge,
staples will be placed Number of Staples, Number of Staples,
Staple Offsets Staple Offsets
FNTRSL Font resolution *DEVD, *SEARCH, *DEVD, *SEARCH,
240, or 300 240, or 300
DFRWRT Defer write *YES or *NO *YES or *NO
SPOOL Spool data *YES, or *NO *YES, or *NO
OUTQ Output queue *JOB, *DEV, or *JOB, *DEV, or
qualified name qualified name
FORMTYPE Form type *STD or form type *STD or form type RPG/400
COPIES Number of copies Number of copies Number of copies
PAGERANGE Starting and ending Starting and ending Starting and ending
pages pages pages
MAXRCDS Maximum records *NOMAX, or *NOMAX, or
maximum records maximum records
FILESEP Separator pages Number of file Number of file
separators separators
SCHEDULE Schedule *FILEEND, *JOBEND, *FILEEND, *JOBEND,
or *IMMED or *IMMED
HOLD Hold *NO or *YES *NO or *YES

44 OS/400 Printer Device Programming V5R1


Table 1. Printer Support Parameters (continued)
Specified on
CRTPRTF and Specified on Specified in HLL
CL Parameter Name Description CHGPRTF Command OVRPRTF Command Program
SAVE Save *NO or *YES *NO or *YES
OUTPTY Output priority *JOB or output *JOB or output
priority priority
USRDTA User data *SOURCE or user *SOURCE or user
data data
SPLFOWN Spooled file owner *CURUSRPRF, *JOB, *CURUSRPRF, *JOB,
*CURGRPPRF, or *CURGRPPRF, or
*JOBGRPPRF *JOBGRPPRF
USRDFNOPT User defined option *NONE or user *NONE or user
defined option defined option
USRDFNDTA User defined data *NONE or user *NONE or user
defined data defined data
USRDFNOBJ User defined *NONE or user *NONE or user
object/type defined object/ defined object/
*DTAARA, *DTAQ, *DTAARA, *DTAQ,
*FILE, *PSFCFG, *FILE, *PSFCFG,
*USRQ, *USRIDX or *USRQ, *USRIDX or
*USRSPC *USRSPC
SPLFNAME Spool file name *FILE
IGCDTA Double-byte data *NO or *YES *NO or *YES
IGCEXNCHR Double-byte *YES, or *NO *YES, or *NO
extension characters
IGCCHRRTT Rotate double-byte *NO, or *YES *NO, or *YES
characters
IGCCPI Double-byte *CPI, 5, 6, 10, or *CPI, 5, 6, 10, or
characters per inch *CONDENSED *CONDENSED
IGCSOSI Shift control *YES, *NO, or *YES, *NO, or
characters *RIGHT *RIGHT
IGCCDEFNT Double-byte coded *SYSVAL, coded font *SYSVAL, coded font
font and point size name, and point size name, and point size
WAITFILE File wait time *IMMED, *CLS or *IMMED, *CLS or RPG/400 and PL/I
number of seconds number of seconds
SECURE Secure from other *YES or *NO
overrides
SHARE Shared file *NO or *YES *NO or *YES PL/I
LVLCHK Level check *YES or *NO *YES or *NO RPG/400,
COBOL/400, PL/I,
C/400, and BASIC
AUT Authority *CHANGE, *ALL,
*USE, *EXCLUDE or
authorization list
name
REPLACE Replace *YES or *NO
TEXT Text *SRCMBRTXT,
*BLANK, or text
description

Chapter 2. Printer file support 45


Table 1. Printer Support Parameters (continued)
Specified on
CRTPRTF and Specified on Specified in HLL
CL Parameter Name Description CHGPRTF Command OVRPRTF Command Program
Record length RPG/400,
COBOL/400, PL/I,
C/400, and BASIC
End-of-page indicator RPG/400, PL/I and
BASIC
Skip before Line number RPG/400
Skip after Line number RPG/400
Space before Number of lines RPG/400,
COBOL/400
Space after Number of lines RPG/400,
COBOL/400

Creating a printer file


Printer files can be created by the user or the user could choose to use the printer
files supplied by IBM.

IBM-supplied printer files


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 copy output.
v QPSPLPRT: Default spooled output printer file for the spooling subsystem.

User-created printer files


You use the Create Printer File (CRTPRTF) command to begin the process of
creating a printer file tailored specifically to your needs.

If, at this time, you want to become familiar with this command, type CRTPRTF
and press F4 (Prompt). Or you can go to “What parameters make up a printer
file?” on page 41 and view a chart that lists all the printer file parameters.

The next section of this chapter contains examples where an application program
calls (uses) a user-created printer file. The examples focus on a program-described
printer file and an externally described printer file.

Why is the concept of externally described or program-described printer files


important?

The reason the terms externally described or program-described are important is that
by specifying *NONE on the SRCFILE parameter of the CRTPRTF command, the
user is telling the system that the high-level language the application program is
written in will control how the printed output appears on a printed page.

46 OS/400 Printer Device Programming V5R1


If the user specifies a source file name and member (made up of data description
specifications) on the SRCFILE parameter, then the application program will use
information that is specified in the member to control how the printed output
appears on a printed page.

To show you how printer files interact with application programs there is an
example of a printer file using program-described files and one using externally
described files (DDS).

Do you want to read through the example of the program described printer file or
through the example of the externally described printer file?
Program Described
Externally Described
↓ Go to “Using an externally-described printer file with an application
program” on page 59.

Go to “Using a program-described printer file with an application program”.

Using a program-described printer file with an application program


This example shows how an application program calls and uses a
program-described printer file to control how your printed output will look.

This example consists of:


v An RPG-coded application program that produces mailing labels.
v A printer file that is opened by the application program when the application
program runs.
v A detailed listing of which parameters from the printer file are used by the
application program and at what point during the processing of the application
program they are used.
This is the RPG-coded application program. The reverse-image numbers within the
program correspond to the list on the following pages. That list explains how this
program works and specifically how the program opens and uses the printer file.
v Part 1 opens the printer file
v Part 2 sends the output to the designated output queue
v Part 3 closes the opened files
v Part 4 processes the data
v Part 5 provides the code to control how the printed output will look
*********************************************************************
FADDRESS IF E K DISK
1 FLABELPRTO F 132 OF PRINTER
*********************************************************************
CTAR 20 1
CSAR 30 1
STAR 2 1
ZPAR 8 1

READ ADDRESS 10

*IN10 DOWEQ'0'
ADD2 IFEQ *BLANKS
MOVE '1' *IN55
ELSE
MOVE '0' *IN55
END

Chapter 2. Printer file support 47


EXSR CKCITY

*********************************************************************
2 EXCPTPRINT
*********************************************************************
READ ADDRESS 10

END

*********************************************************************
3 MOVE '1' *INLR
*********************************************************************

CKCITY BEGSR
MOVEA*BLANKS CTAR
MOVEA*BLANKS STAR
MOVEA*BLANKS ZPAR
MOVEA*BLANKS CSAR

MOVEACITY CTAR
MOVEAST STAR
MOVEAZIP ZPAR

Z-ADD1 X 20
Z-ADD1 Y 20
EXSR LOOKBL 1ST WORD.
ADD 1 X
CTAR,X IFGT *BLANKS 2ND WORD
MOVE ' ' CSAR,Y
ADD 1 Y
EXSR LOOKBL

4 ADD 1 X
CTAR,X IFGT *BLANKS 3RD WORD
MOVE ' ' CSAR,Y
ADD 1 Y EXSR LOOKBL
END
END
MOVE ',' CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
MOVE STAR,1 CSAR,Y
ADD 1 Y

MOVE STAR,2 CSAR,Y


ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
Z-ADD1 X
X DOWLT9
MOVE ZPAR,X CSAR,Y
ADD 1 Y
ADD 1 X
END
MOVEACSAR CTSTZP 30
ENDSR

LOOKBL BEGSR
CTAR,X DOWGT*BLANKS
MOVE CTAR,X CSAR,Y
ADD 1 X
ADD 1 Y
END
ENDSR
*********************************************************************
RTE 1 2 PRINT

48 OS/400 Printer Device Programming V5R1


NAME 25
E 1 PRINT
ADD1 25
5 E 1 N55 PRINT
ADD2 25
E 1 PRINT
CTSTZP 30
E 1 55 PRINT
*********************************************************************

Open processing
Part 1 of the application program opens files that are called by the application
program.

When a program opens files, an object of type *FILE is connected to the program
for processing. Among the files opened in this example, and of particular interest
at this point, is the printer file whose name is LABELPRT. You can find the printer
file name LABELPRT next to the 1 in the program listing.

A printer file is opened to prepare the system so that the application can put data
into a spooled file or print it out directly to a printer. Information from the
high-level language application program, the printer file, and any printer file
overrides is combined.

The printer file open operation is controlled by parameters specified in the printer
file, the high-level language program, and in printer file overrides (through the
OVRPRTF command). See “Overriding printer files” on page 69 for more
information on overrides.

As an example, if the printer file specified lines per inch (LPI) of 8, and an
OVRPRTF command specified an LPI of 6, the LPI of 6 would be used since the
override value specified by the OVRPRTF command takes precedence over the LPI
value specified in the printer file.

Printer file parameters


The following list contains parameters from the printer file LABELPRT. These are
the parameters that the application program accesses or looks at when it opens the
printer file. They are the majority of the parameters in the printer file, but not all
of them. When the application looks at each parameter, it finds a value specified
for each parameter. Unless otherwise noted, the parameters also apply to
externally-described printer files.

Some of the values are discussed in more detail than others, because some of the
parameters have many more possible values than others.
FILE
Specifies the qualified name by which the printer file being called is known.
DEV
Specifies the name of a printer device description. The device description is an
object that contains information describing a particular device (printer in this
case) or logical unit that is attached to the system. For nonspooled output, this
identifies the printer device used with the printer file to produce the printed
output. For spooled output, if OUTQ(*DEV) is also specified, the default
output queue for the specified printer is used for the spooled file.
DEVTYPE
Specifies the type of data stream created for a printer file. This parameter
indicates whether the resulting data stream should be:

Chapter 2. Printer file support 49


v Intelligent printer data stream (*IPDS)
v SNA character stream (*SCS),
v ASCII data stream (*USERASCII)
v Advanced Function Printing data stream (*AFPDS)
v Line data (*LINE)
v Mixed data (*AFPDSLINE)
For more information on the DEVTYPE parameter, go to “Using the device
type (DEVTYPE) parameter” on page 75.
| CVTLINDTA
| Specifies whether line data and a page definition should be converted to
| AFPDS as the data is written to spool. This parameter is intended for use by
| those applications (RPG, COBOL, etc.) that are currently producing line data. It
| can also be used with new Java applications that use the new Java line data
| print classes.
PAGESIZE
Specifies the length and width of the printer forms used by this printer file.
Go to “Appendix D. Working with Fonts, Font Character Sets, Code Pages,
CHRIDs, and Coded Fonts” on page 387 to view tables that show:
v Range of values for lines per page for each printer type and for each value
of lines per inch (LPI) valid for the printer.
v Range of values for characters per line for each printer type and for each
value of characters per inch (CPI) for the printer.
Notes:
1. For IPDS printers configured with AFP(*NO) on the Create Device
Description (Printer) (CRTDEVPRT) or Change Device Description (Printer)
(CHGDEVPRT) CL commands, the printer file parameters are used to
override the forms size set on the printer. For printers configured with
AFP(*YES), the forms size set on the printer is used to determine the actual
size of the forms loaded in the printer.
2. If *ROWCOL is specified as the method of measure on the PAGESIZE
parameter, and either a coded font or font character set is specified on the
printer file, the page width is calculated using 10 characters per inch.
3. If the PAGESIZE parameter value is *UOM, the page size length and width
is converted to *ROWCOL (number of rows and columns per page) when
spooled files are created.
If the DEVTYPE is *IPDS, the pitch of the font specified by the FONT
parameter is used to calculate the number of columns allowed per page.
For example, assume:
Form size is 8.5 x 11 inches
The UOM parameter value is *INCH
The CPI parameter value is 10 (the default)
The FONT parameter value is 86
The number of columns available for printing is 102 (8.5 inches x 12
characters per inch), because FONT 86 is a 12-pitch font. The CPI parameter
is ignored.

If the DEVTYPE is *SCS, the CPI parameter is used for the conversion. The
CPI value should match the pitch of the specified FONT, or the FONT
parameter should be *CPI. Let’s use the same values as in the previous

50 OS/400 Printer Device Programming V5R1


example but have the DEVTYPE be *SCS and the FONT value be *CPI.
Now, because the CPI parameter is 10, the printed output will be truncated
at 85 columns (8.5 inches x 10 characters per inch).
LPI
Specifies the line spacing setting on the printer, in lines per inch, used by this
printer file.
UOM
Specifies the unit of measure to be used for various measurements used in
printing. Possible values are:
v *INCH (Use inches as the unit of measure.)
v *CM (Use centimeters as the unit of measure.)
CPI
Specifies the printer character density, in characters per inch (CPI), used by this
printer file.
For more information on CPI, go to “Printer font support” on page 103.
OVRFLW
Specifies the line number where an overflow message is issued.
RPLUNPRT
Specifies (1) whether unprintable characters are replaced and (2) which
substitution character (if any) is used. An unprintable character is a character
the printer is unable to print. For more information on replacing unprintable
characters, go to “Replacing on unprintable characters” on page 106.
FIDELITY
Specifies whether the spooled file should continue printing if errors are
encountered.
*CONTENT
If errors are encountered, the spooled file continues to print.
*ABSOLUTE
If errors are encountered, the spooled file does not print.

For more information on FIDELITY, go to “Using the fidelity (FIDELITY)


parameter” on page 88.
CTLCHAR
Specifies whether the printer file supports input with print control characters.
Incorrect control characters encountered are ignored, and single spacing is
assumed. Control characters (such as carriage return, font change, or end of
transmission) are contained in the data stream that is being prepared for
printing.
PRTQLTY
Specifies, for the 4214, 4224, 4230, 4234, 4247 and 5219 Printers, the quality of
print produced.
FORMFEED
Specifies, for the 3912, 3916, 4028, 4214, 4224, 4230, 4247 5219, and 5553
Printers, the form feed attachment used by this printer file.
DRAWER
Specifies the source drawer used when automatic cut sheet feed mode is used
(specified by FORMFEED(*AUTOCUT)). When you specify a form definition,
the value specified for the Drawer parameter will override the drawer value

Chapter 2. Printer file support 51


specified in the form definition. If you want to use the drawer value specified
for the Form definition parameter, you must specify *FORMDF for the Drawer
parameter.
OUTBIN
Specifies the destination bin of the output on printers that support multiple
output bins. Possible values are:
*DEVD
The destination of the output is the default output bin for the printer
device.
Output bin
For printed output, specifies the output bin to be used on the printer
device.
Valid values range from 1 through 65535.
FONT
Specifies the font identifier and the point size (if the font supports multiple
point sizes) of the font that is used for the following printers:
v 3130, 3812, 3816, 3820, 3825, 3827, 3829, 3831, 3835, 3900, 3912, 3916, 3930,
3935, 4028, 4224, 4230, 4234, 4247, 4312, 4317, 4324, 5219
v InfoPrint 20, InfoPrint 32, InfoPrint 3000, and InfoPrint 4000 printers. This
includes ASCII printers that emulate the 3812 or 5219 Printer.
Notes:
1. For a list of fonts that are supported, see “Appendix D. Working with
Fonts, Font Character Sets, Code Pages, CHRIDs, and Coded Fonts” on
page 387.
2. For more information about fonts and how various printers use them, see
“Printer font support” on page 103
CHRID
Specifies the character identifier (graphic character set and code page) for fields
identified with the CHRID DDS keyword.
Notes:
1. If the CHRID parameter value is *JOBCCSID, the character set and code
page are determined by the CCSID value of that job.
*JOBCCSID indicates that all data being printed should be printed using
the CCSID value for the current job. With externally-described printer files,
constants specified in DDS are translated from the CCSID of the DDS
source file to the CCSID of the current job. In addition, the CHRID DDS
keyword is ignored.
2. When you specify *CHRIDCTL, the printer checks the CHRIDCTL job
definition attribute to determine whether to use *JOBCCSID or *DEVD on
the current job.
3. For a list of the character IDs that are supported, see “Appendix D.
Working with Fonts, Font Character Sets, Code Pages, CHRIDs, and Coded
Fonts” on page 387.
4. For more information on multinational environments and alternative
character sets and code pages, go to “Using alternative character sets and
code pages for printer output” on page 107.
DECFMT
Specifies which decimal format value is used when editing numeric fields in
the printer file. Possible values are:

52 OS/400 Printer Device Programming V5R1


*JOB Use the decimal format from the DECFMT job attribute at the time the
file is opened.
*FILE Use the decimal format that is stored with the file when the file was
created.
FNTCHRSET
Specifies the font character set, code page, and point size to be used at printing
time.
For raster fonts, the font character set identifier provides the size and style of
the character set. For outline fonts, the font character set identifier provides the
style of the character set. A point size is required to specify the size of the
outline font.
| The code page identifies which characters in a font are available for printing.
| For more information about font character sets and code pages, go to “Using
| the font character set (FNTCHRSET) parameter” on page 99.

Note: Do not specify an AFP Unicode migration font character set and code
page for this printer file parameter. Specify a Unicode font using the
FNTCHRSET DDS keyword in the DDS Print Reference in the online
AS/400 Information Center.
CDEFNT
Specifies the coded font and point size to be used at printing time.
A coded font is an AFP resource that is made up of a font character set name
and a code page name. A point size is required for outline fonts.
For more information about coded fonts and their relationship to font character
sets, code pages, and font global identifiers (FGIDs), go to “Using the coded
font (CDEFNT) parameter” on page 100.
PAGDFN
Specifies the page definition to be used to format line data.
Print Services Facility/400 (PSF/400) requires a page definition when *LINE or
*AFPDSLINE is specified for the device type. An inline page definition gets
built from the printer file parameters if you specify either *LINE or
*AFPDSLINE, and you specify *NONE for the page definition.
FORMDF
Specifies the form definition to use when printing a file. A form definition is a
resource object that defines the characteristics of the form. Characteristics
include duplexing, overlays, position of page data on the form, number of
copies, modification of pages, and input drawer. When printing to a printer
that is configured as AFP(*YES), a form definition is required. If you do not
provide a form definition, an inline form definition will be built from the
printer file parameters.
AFPCHARS
Specifies one or more AFP characters (coded fonts) to use with line data and a
page definition.
TBLREFCHR
Specifies whether or not table reference characters are present in the line data.
When you use forms control characters with the data, the table reference
character follows the forms control characters, but precedes the data bytes. If
you do not specify forms control characters, the table reference character is the

Chapter 2. Printer file support 53


first byte of the data record. As with forms control characters, if you use table
reference characters, every data record must contain a table reference character
byte.
PAGRTT
Specifies the degree of text rotation for the following printers: 3160, 3130, 3812,
3816, 3820, 3825, 3827, 3828, 3829, 3831, 3835, 3900, 3916, 3930, 3935, 4028, 4312,
4317, 4324. It also specifies the degree of text rotation for the InfoPrint 20,
InfoPrint 32, InfoPrint 3000, and the InfoPrint 4000. This parameter allows the
user to specify the degree of text rotation on the page with respect to how you
load the form into the printer.

Note: Overlays and page segments do not rotate with the rest of the page.

For more information and examples on overlays and rotation, go to “Using


overlays and rotation” on page 90.
PRTTXT
Specifies the printing of a line of text at the bottom of each page. For more
information about printing information on the bottom of your printed page, go
to “Print text” on page 109.
JUSTIFY
For the 5219 and 3812 SCS only, specifies the printing positions of the
characters on a page so the right-hand margin of printing is regular.
DUPLEX
Specifies whether the output is printed on only one or on two sides of the
paper. When you specify a Form definition, the value specified on the Duplex
parameter will override the duplex value specified in the form definition. If
you want to use the duplex value specified in the form definition, you must
specify *FORMDF for the duplex parameter.
IPDSPASTHR
Specifies whether IPDS pass-through occurs for the spooled file. Not all SCS or
IPDS spooled files are eligible for IPDS pass-through. They may contain special
functions that require transformation to AFPDS to print correctly. The PSF
configuration object’s IPDSPASTHR parameter will be used when you specify
*DEVD. The PSF configuration object value will be ignored for any other
specified value.
USRRSCLIBL
Specifies the list of user resource libraries to use for searching for AFP
resources for a spooled file. You can specify either a maximum of four library
names, which will replace the spooling job’s library list, or you can specify one
of the following values:
v *CURLIB
v *DEVD
v *JOBLIBL
v *NONE
CORNERSTPL
Specifies the reference corner that is used for a corner staple. Refer to your
printer’s documentation to find out which values your printer supports.
EDGESTITCH
Specifies the placement of the staples along the finishing margin. Refer to your
printer’s documentation to find supported values for this parameter. For more
information, see “Using the edge stitch (EDGESTITCH) parameter” on page 96.

54 OS/400 Printer Device Programming V5R1


SADLSTITCH
Specifies where to place staples along the finishing margin. The position of the
finishing margin for this parameter is along the center of the media and
parallel to the reference edge. Refer to your printer’s documentation to find
supported values for this parameter. For more information, see “Using the
saddle stitch (SADLSTITCH) parameter” on page 98.
FNTRSL
If the resolution is absent from the data stream, this parameter specifies the
resolution that PSF/400 uses when printing to a multiple resolution printer. If
*DEVD is specified, the value from the PSF configuration object’s FNTRSL
parameter is used. Any other value causes the PSF configuration object value
to be ignored. For more information about searching a library list for a font
resource, see “User and device resource library lists” on page 258
SPOOL
Specifies whether the output data for the printer file is spooled. If
SPOOL(*NO) is specified, the following parameters in the printer file
command are ignored: OUTQ, COPIES, MAXRCDS, FILESEP, SCHEDULE,
HOLD, SAVE, OUTPTY, and USRDTA.
SCHEDULE
Specifies, for spooled files only, when the spooled file is made available to the
printer writer program.
For more information on how the SCHEDULE parameter is used to control
when the spooled file is made available to a printer writer to produce a
printed document, go to “Using the SCHEDULE parameter” on page 76.
USRDTA
Specifies, only if the file is spooled, some user-specified data that identifies the
file on the output queue.
SPLFOWN
Specifies the owner of the spooled file. You use this parameter only for spooled
output.
USRDFNOPT
Specifies one or more user-defined options to be used by user applications or
user-specified programs that process spooled files.
USRDFNDTA
Specifies user-defined data to be used by user applications or user specified
programs that process spooled files.
USRDFNOBJ
Specifies a user-defined object and type to be used by user applications or user
specified programs that process spooled files. The object type can be a data
area, data queue, file, user index, PSF configuration object, user queue, or user
space.
IGCDTA
Specifies, for program-described printer files, whether the printer file processes
double-byte character set data. For externally described printer files, specifies
double-byte character set or UCS-2 attributes of the printer file.
IGCEXNCR
Specifies whether the system processes double-byte character extension
characters.

Chapter 2. Printer file support 55


IGCCHRTT
Specifies whether the printer should rotate double-byte characters 90 degrees
counterclockwise when printing.
IGCCPI
Specifies the printer character density of double-byte characters, in characters
per inch.
IGCSOSI
Specifies how the system prints shift control characters.
IGCCDEFNT
Specifies the font and point size that the system uses to print DBCS data to an
IPDS printer. The point size is for outline fonts only. The printer must be
configured AFP(*YES). For more information on DBCS coded fonts, go to
“Using the DBCS coded font (IGCCDEFNT) parameter” on page 99.
WAITFILE
Specifies the number of seconds the program waits for allocation of the file
resources when the file is opened.
SHARE
Specifies whether the open data path (ODP) for the printer file can be shared
with other programs in the same routing step.
LVLCHK
Specifies whether the level identifiers of the record formats in this printer file
are checked when the file is opened by the program. For more information on
how this parameter works to redirect files, go to “Effect of changing fields in a
file description” on page 111.
AUT
Specifies the authority granted to users who do not have specific authority to
the file, who are not on the authorization list, and whose users’ group has no
specific authority to the file.
TEXT
Specifies text that briefly describes the printer file.

Output processing
Part 2 of the application program performs the operations of reading, compiling,
and sending the output to the output queue specified in the OUTQ parameter of
the CRTPRTF command or to the printer specified in the DEV parameter of the
CRTPRTF command. In this example, the SPOOL parameter has a value of (*YES).
This means the output will become a spooled file in the designated output queue.

The following printer file parameters are the CRTPRTF parameters looked at by
the system program and application program during the output processing portion
of the application program. Unless otherwise noted, these parameters also apply to
externally-described printer files.
SRCFILE
Specifies the qualified name of the source file and member, if one exists, that
contains the data description specifications (DDS).
This example does not use a DDS source file. Thus, when the application
program calls the printer file LABELPRT and looks at the SRCFILE parameter,
the value will be *NONE.

56 OS/400 Printer Device Programming V5R1


Since no DDS will be used, the high-level language must provide the
programming to control how the printed output will look. This example
contains the high-level language code in part 5 of the example program
listing.
SRCMBR
Specifies the name of the member in the source file that contains the DDS for
this printer file.
FOLD
Specifies whether all positions in a record are printed when the record length
exceeds the page width (specified by the PAGESIZE parameter).
ALIGN
Specifies whether the page alignment must be verified by the operator before
printing is started. For more information about the align parameter and its
relationship to the Start Printer Writer (STRPRTWTR) command, go to “Using
the align (ALIGN) parameter” on page 77.
CHLVAL
Specifies a list of channel numbers with their assigned line numbers. Use this
parameter only if CTLCHAR(*FCFC) has been specified. For more information
on first-character forms-control data, go to “First-character forms-control data”
on page 101.
PRTTXT
Specifies the printing of a line of text at the bottom of each page. For more
information about printing information on the bottom of your printed page, go
to “Print text” on page 109.
REDUCE
Specifies whether or not to reduce the output when doing multiple up
printing. Multiple up printing refers to the Pages Per Side parameter of the
printer file. Possible values are:
*TEXT
Reduce the text output when doing multiple up printing.
*NONE
Do not reduce the output when doing multiple up printing.

Note: If a printer has a hardware feature that supports multiple up


printing, *NONE allows the use of that hardware feature.
MULTIUP
Specifies how many logical pages of output can be printed on one physical
page of paper. The values are 1 through 4. 1 is the default value.
For example: if you select 4 as the parameter value and you are printing on
both sides of the paper, you actually print 8 pages of output on 1 piece of
paper.
For more information on the MULTIUP parameter, go to “Using the
MULTIUP(1, 2, 3, or 4) and REDUCE(*TEXT) parameters” on page 81.
FRONTMGN
Specifies the margin to be used on the front side of a piece of paper.
For more information on front margins, go to “Using the margin (FRONTMGN
and BACKMGN) parameters” on page 93.
BACKMGN
Specifies the margin to be used on the back side of a piece of paper.

Chapter 2. Printer file support 57


For more information on back margins, go to “Using the margin (FRONTMGN
and BACKMGN) parameters” on page 93.
FRONTOVL
Specifies the overlay to be used on the front side of a piece of paper. Possible
values are:
v *NONE (No overlay is used.)
v qualified overlay-name (The name of the overlay to be used and the library
the overlay is in.)

Front side overlays are valid only for printers configured for Advanced
Function Printing*. For more information on overlays, go to “Using the overlay
(FRONTOVL and BACKOVL) parameters” on page 89.
BACKOVL
Specifies the overlay to be used on the back side of a piece of paper. Possible
values are:
v *NONE (No overlay is used.)
v Qualified overlay-name (The name of the overlay to be used, the library the
overlay is in, and whether to use the constant back function.)
v *FRONTOVL (Use the overlay specified for the FRONTOVL parameter.)

Back side overlays are valid only for printers configured for advanced function
printing. For more information on overlays, go to “Using the overlay
(FRONTOVL and BACKOVL) parameters” on page 89.
MAXRCDS
Specifies, for spooled output only, the maximum number of records in the
spooled file for spooled jobs using this printer file.
DFRWRT
DFRWRT(*YES) means the system controls the amount of output held in the
buffer before being sent to the printer.
For spooled files, DFRWRT(*NO) means spooled data is sent to the printer
when a page of output is available or when the system buffer is full. (Buffers
are usually 512 bytes.) DFRWRT(*NO) has effect on spooled files only if
SCHEDULE(*IMMED) is specified.
For direct output, DFRWRT(*NO) means data is sent to the printer each time
the application program performs a write operation.

Close processing
Part 3 of the application program performs the close operations of the
application program.

When the application program has finished the output processing part of the
application program, it performs a close operation on all the files it opened during
the open processing portion of the application program.

The following printer file parameters from the CRTPRTF command are the
parameters looked at by the system program and the application program during
the close portion of the application program.
SCHEDULE
Specifies, for spooled files only, when the spooled file is made available to the
printer writer program.

58 OS/400 Printer Device Programming V5R1


For more information on how the SCHEDULE parameter is used to control
when the spooled file is made available to a printer writer to produce a
printed document, go to “Using the SCHEDULE parameter” on page 76.

Using an externally-described printer file with an application program


This example shows how an application program calls and uses an externally
described printer file to control how your printed output will look.

This example will consist of:


v An RPG-coded application program that produces mailing labels.
v A printer file that is opened by the application program when the application
program runs.
v A detailed listing of which parameters from the printer file are used by the
application program and at what point during the processing of the application
program they are used.
v A detailed listing of the DDS keywords and an explanation of which DDS
keywords are used by the mailing label application program.

This is the RPG-coded application program. The reverse-image numbers within the
program correspond to the list on the following pages. That list explains how this
program works and specifically how the program opens and uses the printer file.
v Part 1 opens the printer file
v Part 2 sends the output to the designated output queue
v Part 3 closes the opened files
v Part 4 processes the data
************************************************************************
FADDRESS IF E K DISK
1 FLABELPR3O E PRINTER
************************************************************************
CTAR 20 1
CSAR 30 1
STAR 2 1
ZPAR 8 1

READ ADDRESS 10
************************************************************************
WRITEHEADNG
*IN10 DOWEQ'0'

EXSR CKCITY
2 WRITEDETAIL1
ADD2 IFNE *BLANKS
WRITEDETAIL3
END

WRITEDETAIL4
READ ADDRESS 10

END
************************************************************************

************************************************************************
3 MOVE '1' *INLR
************************************************************************
CKCITY BEGSR
MOVEA*BLANKS CTAR
MOVEA*BLANKS STAR
MOVEA*BLANKS ZPAR
MOVEA*BLANKS CSAR

Chapter 2. Printer file support 59


MOVEACITY CTAR
MOVEAST STAR
MOVEAZIP ZPAR
Z-ADD1 X 20
Z-ADD1 Y 20

EXSR LOOKBL 1ST WORD


ADD 1 X
CTAR,X IFGT *BLANKS 2ND WORD
MOVE ' ' CSAR,Y
ADD 1 Y
EXSR LOOKBL
ADD 1 X
CTAR,X IFGT *BLANKS 3RD WORD
MOVE ' ' CSAR,Y
ADD 1 Y
4 EXSR LOOKBL
END
END
MOVE ',' CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
MOVE STAR,1 CSAR,Y
ADD 1 Y
MOVE STAR,2 CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
MOVE ' ' CSAR,Y
ADD 1 Y
Z-ADD1 X
X DOWLT9
MOVE ZPAR,X CSAR,Y
ADD 1 Y
ADD 1 X
END
MOVEACSAR CTSTZP 30
MOVEACSAR CTSTZ2 30
ENDSR

LOOKBL BEGSR
CTAR,X DOWGT*BLANKS
MOVE CTAR,X CSAR,Y
ADD 1 X
ADD 1 Y
END
ENDSR
******************************************************************

Open processing
Part 1 of the application program opens files that are called by the application
program. Among those, and of particular interest at this point, is the printer file
whose name is LABELPR3. You can locate LABELPR3 next to 1 in the program
listing.

A printer file is opened to prepare the system so that the application can put data
into a spooled file or print it out directly to a printer. Information from the
high-level language application program, the printer file, and any printer file
overrides is combined.

The printer file open operation is controlled by parameters specified in the printer
file, the high-level language program, and in printer file overrides (through the
OVRPRTF command). See “Overriding printer files” on page 69 for more
information on overrides.

60 OS/400 Printer Device Programming V5R1


As an example, if the printer file specified lines per inch (LPI) of 8, and an
OVRPRTF command specified an LPI of 6, the LPI of 6 would be used since the
override value specified by the OVRPRTF command takes precedence over the LPI
value specified in the printer file.

Output processing
Part 2 of the application program performs the operations of reading, compiling,
and sending the output to the output queue specified in the OUTQ parameter of
the CRTPRTF command, or to the printer specified in the DEV parameter of the
CRTPRTF command. In this example, the SPOOL parameter has a value of (*YES)
which means the output will become a spooled file in the designated output
queue.

Unless otherwise noted, the printer file parameters listed in “Output processing”
on page 56 are also valid for externally-described printer files.The following
printer file parameters from the CRTPRTF command are additional parameters that
are looked at by the application program during the output processing.
SRCFILE
Specifies the qualified name of the source file and member, if one exists, that
contains the data description specifications (DDS).
Since this example uses DDS, look at 1 in the program listing and see that
the name of the printer file is LABELPR3. LABELPR3 was compiled using the
source from the member and file that are listed here. See “DDS keywords” for
an example of the compiled DDS and a list of DDS keywords.

Note: The DDS will be compiled before the application program runs. The
application program never looks at the DDS file and member, only at
the compiled results.
Option
Specifies the type of printout that will be produced when the printer file is
created.
GENLVL
Specifies the severity level of DDS messages that cause file creation to fail.

Data description specifications


Below is the example of the compiled DDS used by the RPG program. You can
update the DDS; however, you must then re-compile it.
000100900115 R HEADNG
000200900115 3 2'MAILING LABELS'
000300900115
000400900115 R DETAIL1
000500900115 NAME 25 2 2UNDERLINE
000600900115 ADD1 25 3 2
000700900115 R DETAIL3
000800900115 ADD2 25 2SPACEB(1)
000900900115 R DETAIL4
001000900115 CTSTZP 30 2HIGHLIGHT SPACEB(1)

This example uses three DDS keywords: SPACEB, UNDERLINE, and HIGHLIGHT.

DDS keywords: Below is a listing of all available DDS keywords associated with
printer files.

Chapter 2. Printer file support 61


Remember: DDS and its associated keywords can only be used if the SRCFILE
parameter contains the name of the file and the SRCMBR parameter
contains the name of the member that the DDS source resides in.

The following list contains all the DDS keywords that you can use to help you
control how your printed output will look. Remember, some DDS keywords can
only be used if the target printer supports them. For example: COLOR can only be
specified if the target printer is a 4224.

For more detailed information on how to create and code DDS source files and to
find out which printers support which DDS keywords, see the DDS Reference
topic in the online AS/400 Information Center.
ALIAS
Alternative Name. Use this field-level keyword to specify an alternative name
for a field. When the program is compiled, the alternative name is brought into
the program instead of the DDS field name. The high-level language compiler
in use determines if the alternative name is used. Refer to the appropriate
high-level language reference manual for information about ALIAS support for
that language.
ALIAS
Bar Code. Use this field-level keyword to print a field as a user-specified bar
code. BARCODE is valid for IPDS printers. (A bar code is a pattern of bars of
various widths containing data to be interpreted by a scanning device.)
BLKFOLD
Blank Fold. Use this field-level keyword for named fields that overflow onto
subsequent print lines, to cause folding to occur at a blank rather than at the
end of a line. If the blank fold keyword is not specified, the line folds at the
end of the physical print line.
| BOX
| Box. Use this record-level keyword to specify the position on a page where a
| box should be drawn. You can specify the corners and the weight (thickness)
| of the lines in the box. Additionally, you can specify the color of the lines of a
| box and whether to have box shading. If you select box shading, you can also
| specify the color of the box shading. For more information on the DDS box
| keyword, DDS Reference topic in the AS/400 Information Center.
| CCSID
| Coded Character Set Identifier. Use this file-, record-, or field-level keyword to
| specify that a ’G’ type field supports UCS-2 data instead of DBCS graphical
| data.
CDEFNT
Coded Font. Use this record- or field-level keyword to specify the coded font
and point size for printing a named or constant field or fields within a record.
For more information on the DDS coded font keyword, go to DDS Reference
topic in the AS/400 Information Center.
CHRID
Character identifier. Use this field-level keyword to specify that a graphic
character set and code page other than the device default can be used for this
field. This can be important when extended alphabetics (characters such as u
with an umlaut or c with a cedilla) are to be printed.
CHRSIZ
Character Size. Use this record- or field-level keyword to expand the width

62 OS/400 Printer Device Programming V5R1


and height of a record or field. This applies to SCS double-byte characters, and
IPDS and AFPDS single-byte characters.
| COLOR
| Color. If the printer device supports it, use this field-level keyword, to specify
| the color for a field. If you do not specify COLOR, or if the keyword is not
| valid for a printer device, black (the default value) is used.
CPI
Characters per Inch. This record- or field-level keyword specifies the horizontal
printing density for the record format or field you are defining. Use CPI to:
v Darken logos and other printed graphics that you create using the DFNCHR
keyword.
v Place more data in less space on printed forms.
v Fit the appearance of a form to your needs.
CVTDTA
Convert Data. This field-level keyword converts character data to hexadecimal
data when the field is passed to the printer. You can use the CVTDTA keyword
to define:
v Logos or emblems for a letterhead on your forms
v Alternative character sets or symbols (such as a copyright symbol)
v The appearance of a physical form (by adding vertical and horizontal lines
that act as boundaries on the form or between positions on an invoice)
v IPDS bar code commands
DATE
Date. Use this field-level keyword to display the current job date.
DATFMT
Date Format. Use this field-level keyword to specify the format of a date field.
DATSEP
Date Separator. Use this field-level keyword to specify the separator character
for a date field.
DFNCHR
Define Character. The DFNCHR keyword allows you to define characters of
your own design at the file or record level for the 5224 Printer and 5225
Printer. With this keyword you can specify DFNCHR more than once at the file
or record level, or as many as 50 characters each time you specify DFNCHR.
DFT
Default. Use the DFT keyword to specify a constant value for constant
(unnamed) fields.
DLTEDT
Delete Edit. Use this field-level keyword to specify that the OS/400 program is
to ignore any edit code or edit word keywords specified for the referenced
field. If a field description is referred to from a database file, DLTEDT prevents
certain information from being referenced.
DOCIDXTAG
Document Index Tag. Use this record-level keyword to create an indexing tag
in the document for use by presentation systems or postprocessor applications.
DRAWER
Drawer. Use this record-level keyword to specify the drawer from which
noncontinuous forms will be selected.

Chapter 2. Printer file support 63


DTASTMCMD
Data Stream Command. Use record-level or field-level keyword to store a data
stream command in a MODCA NOP structured field in the data stream of a
spooled file. This information can be used to determine how to process a
record or field on a particular page of a spooled file. DTASTMCMD keyword
is only valid for printer files that have the device type specified as *AFPDS.
DUPLEX
Duplex. Use this keyword to specify whether printing will be on one or both
sides of the paper.
EDTCDE
Edit Code. Use this keyword to edit output-capable numeric fields.
An edit code is a letter or number indicating that editing should be done
according to a defined pattern before a field is displayed or printed.
EDTWRD
Edit Word. If you cannot accomplish the desired editing by using the EDTCDE
keyword, specify an edit word instead.
An edit word is a user-defined word that specifies the form in which the field
values are to print and clarifies the data by inserting characters, such as
decimal points, commas, floating- and fixed-currency symbols, and credit
balance indicators. Also use it to suppress leading zeros and to provide asterisk
fill protection.
ENDPAGE
End Page. Use this record-level keyword to specify that the page should eject.
Page ejection occurs after the record format is processed.
ENDPAGGRP
End Page Group. Use this record-level keyword to end a logical grouping of
pages previously started with the STRPAGGRP keyword.
FLTFIXDEC
Floating-Point to Fixed Decimal. Use this field-level keyword to print a number
in a floating point field in fixed decimal notation.
FLTPCN
Floating-Point Precision. Use this keyword to specify the precision of a
floating-point field.
FNTCHRSET
Font Character Set. Use this record-level or field-level keyword to specify the
font and point size for printing a named or constant field or fields within a
record. For more information on the DDS font character set keyword, go to the
DDS Reference topic in the AS/400 Information Center.
FONT
| Font. Use the FONT keyword to specify the font ID and point size for printing
| a named or constant field or fields within a record. The valid values for the
| point size parameter are 0.1 through 999.9..
FORCE
Force. Use the FORCE keyword for duplex printing to force printing to a new
sheet of paper for the next record.
GDF
Graphics Data Format File. Use this record-level keyword to specify the
inclusion of a graphic data file at a specific location on a page. For more

64 OS/400 Printer Device Programming V5R1


information on the DDS graphics data format file keyword, go to the DDS
Reference topic in the AS/400 Information Center.
HIGHLIGHT
Highlight. Use this record- or field-level keyword to indicate that a field
should be printed in bold letters.
IGCCDEFNT
DBCS Coded Font. Use this record- or field-level keyword to print DBCS data
contained in the AFPDS.
INDARA
Indicator Area. Use this keyword to remove option indicators from the buffer
(also called the record area) and place them in a 99-byte separate indicator
area.
INDTXT
Indicator Text. Use this file-, record-, or field-level keyword to associate
descriptive text (indicating intent or use) with a specific indicator. You can
specify INDTXT once for each indicator.
INVDTAMAP
Use this record-level keyword to start a new data map. The Invoke data map
keyword specifies the name of the data map in a page definition that is used
to map the line data.
INVMMAP
Invoke Medium Map. Use this keyword to invoke a new medium map. The
medium map is in a form definition and allows you to select or change print
parameters (input drawer, page rotation, and overlays).
You can specify the medium map name as a constant or program-to-system
field. To use this keyword, you must specify a form definition on the printer
file. Do not specify *NONE on the form definition parameter.
LINE
| Line. Use this record-level keyword to position where a line will be drawn on
| a page. You can specify the weight (thickness) and color of lines. Only
| horizontal and vertical lines can be drawn. For more information on the DDS
| line keyword, go to the DDS Reference topic in the AS/400 Information Center.
LPI
Lines Per Inch. Use this keyword to change lines per inch within a file. If you
do not specify LPI for a record, the LPI value is set from the LPI value on the
CRTPRTF, CHGPRTF, or OVRPRTF command.
MSGCON
Message Constant. Use this field-level keyword to indicate that the text for a
constant field is contained in a message description. If the message description
does not exist at DDS compile time, the file is not created. If you change the
message description, you must create the file again.
OUTPUT BIN
Output bin. On printers capable of multiple output bins, this keyword specifies
the destination of the output.
OVERLAY
Overlay. Use this record-level keyword to specify the inclusion of an overlay to
be printed at a specific location on a page. For more information on the DDS
overlay keyword, go to the DDS Reference topic in the AS/400 Information
Center.

Chapter 2. Printer file support 65


PAGNBR
Page Number. Use this field-level keyword to specify the location of an
unnamed, four-digit, zoned decimal field to contain the page number.
PAGRTT
Page Rotation. Use this record-level keyword to specify the degree of text
rotation, with respect to the way the printer loads the page. The PAGRTT
keyword is valid for the following printers: 3130, 3812, 3816, 3820, 3825, 3827,
3828, 3829, 3831, 3835, 3900, 3912, 3916, 3935, 4028, 4312, 4317, 4324. It is also
valid for the InfoPrint 20, InfoPrint 32, InfoPrint 3000, and InfoPrint 4000. If
you do not specify a PAGRTT keyword for a record, the page rotation value is
taken from the value that is specified for either: the Create Printer File
(CRTPRTF), Change Printer File (CHGPRTF), or Override with Printer File
(OVRPRTF) commands.

Note: Overlays and page segments do not rotate with the rest of the page.
PAGSEG
Page Segment. Use this record-level keyword to specify the inclusion of a page
segment to be printed at a specific location on a page. For more information on
the DDS page segment keyword, go to the DDS Reference topic in the AS/400
Information Center.
POSITION
Position. Use this field-level keyword to specify the position of a field using
the units specified on the unit of measure (UOM) printer file parameter. For
more information on the DDS position keyword, go to the DDS Reference topic
in the AS/400 Information Center..
PRTQLTY
Print Quality. Use this record- or field-level keyword to vary the print quality
within the file.
The PRTQLTY keyword is allowed only on records or fields for which a
CHRSIZ or BARCODE keyword applies.
REF
Reference. Use this file-level keyword to specify the name of a file from which
field descriptions are to be retrieved.
REFFLD
Referenced Field. Use this field-level keyword when referring to a field under
one of these three conditions:
v The name of the referenced field is different from the name in positions 19
through 28.
v The name of the referenced field is the same as the name in positions 19
through 28, but the record format, file, or library of the referenced field is
different from that specified with the REF keyword.
v The referenced field occurs in the same DDS source file as the referencing
field.
SKIPA
Skip After. Use this file-, record-, or field-level keyword to specify that the
printer device is to skip to a specific line number after it prints one or more
lines.
SKIPB
Skip Before. Use this file-, record-, or field-level keyword to specify that the
printer device is to skip to a specific line number before it prints the next
line(s).

66 OS/400 Printer Device Programming V5R1


SPACEA
Use this record- or field-level keyword to specify that the printer device is to
space some number of lines after it prints one or more lines.
SPACEB
Space Before. Use this record- or field-level keyword to specify that the printer
device is to space some number of lines before it prints the next line or lines.
STRPAGGRP
Start Page Group. Use this record-level keyword to begin a logical grouping of
pages. Online viewing products can use page groups for indexing and
retrieving information in the document.
TEXT
Text. Use this record- or field-level keyword to supply a text description (or
comment) for the record format or field.
TIME
Time. This field-level keyword prints the current system time.
TIMFMT
Time Format. Use this field-level keyword to specify the format of a time field.
TIMSEP
Time Separator. Use this field-level keyword to specify the separator character
used for a time field.
TRNSPY
Transparency. This field-level keyword prevents code points you have
redefined (using the DFNCHR keyword) from being interpreted as SCS printer
control commands when your program sends an output operation that prints
the field you are defining.
TXTRTT
Text Rotation. Use this field-level keyword to specify the rotation of the text on
a page. For more information on the DDS text rotation keyword, go to the DDS
Reference topic in the AS/400 Information Center.
UNDERLINE
Underline. Use this field-level keyword to specify that the OS/400 program is
to underline the field when it is printed.
ZFOLD
| Z fold. Use this record-level keyword to specify a z-fold operation, for the
| current sheet, after the printer has completed printing.

Close processing
Part 3 of the application program performs the close operations of the
application program.

When the application program has finished the output processing part of the
application program, it performs a close operation on all the files it opened during
the open processing of the application program.

The application program looks at the SCHEDULE parameter from the CRTPRTF
command during the close portion of the application program. For more
information on how the SCHEDULE parameter is used to control when the
spooled file is made available to a printer writer, go to “Using the SCHEDULE
parameter” on page 76.

Chapter 2. Printer file support 67


Output from the example application programs
Following are examples of the output from the mailing label application program.
Notice that the first example has no underlining or boldface text. Example 1 is
produced using a program-described printer file and example 2 (with the
underlining and highlighting) is produced using an externally-described printer file
(DDS).

Using a program-described printer file

Bonnie Fohrman
Box 123
RR 1
Chatfield, IA 55924

Cindy Olson
502 9th Ave.
RR2
St. George Cove, IN 46043

Lynn Smith
808 5th St.
Peru, IN 46234

Michael Jones
Box 215
Preston, MN 55923

Pat Edwards
123 River Road
St. Charles, MN 55945

Using an externally described printer file (using DDS)


Bonnie Fohrman
Box 123
RR 1
Chatfield, IA 55924

Cindy Olson
502 9th Ave.
RR2
St. George Cove, IN 46043

Lynn Smith
808 5th St.
Peru, IN 46234

68 OS/400 Printer Device Programming V5R1


Michael Jones
Box 215
Preston, MN 55923

Pat Edwards
123 River Road
St. Charles, MN 55945

Overriding printer files


Note to Readers:

Overriding files (printer files, display files, diskette files,


database files, and tape files) can be done by commands, from
CL programs, or from HLL programs. Overrides can be called
from different levels (programs calling another program).

This guide discusses overriding printer files.

To read about overriding one file type with another, programs


calling overrides from other programs (multiple call levels), and
file redirection, see the Distributed Data Management topic in
the AS/400 Information Center.
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 may be entered interactively from a display station or as part


of a batch job. They may be included in a control language (CL) program, or they
may be issued from other programs via 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 may 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 may 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 output 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 in the AS/400
Information Center.

Chapter 2. Printer file support 69


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:
OVRPRTF
Override with Printer File: Overrides (replaces) the printer file named in
the program, overrides certain parameters of a printer file that is used by
the program, or overrides the file and certain parameters of the file to be
processed.
DLTOVR
Delete Override: Deletes one or more file overrides that were previously
specified in a call level.
DSPOVR
Display Override: Displays file overrides at any active call level for a job.

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 available in the online help 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.

Applying overrides
There are three different types of file overrides. These are:
v Overriding file attributes
For example, you could temporarily change the number of copies you want
printed from one to three by overriding the value specified on the COPIES
parameter.
v Overriding file names or types
For example, you could temporarily change which printer file the program uses.
v Overriding file names and file attributes of the new file
For example, you could temporarily change the printer file used and also
temporarily change some of the values specified in the new printer file.

Overriding file attributes


The simplest form of overriding a file is to override some attributes of the file.

For example, assume that you create a printer file named OUTPUT with these
attributes:
v Page size: 66 by 132
v Lines per inch: 6
v Copies of printed output: 2
v Pages for file separators: 2
v Overflow line number: 55

70 OS/400 Printer Device Programming V5R1


The Create Printer File (CRTPRTF) command used to create this file looks like this:
CRTPRTF FILE(QGPL/OUTPUT) SPOOL(*YES)
PAGESIZE(66 132) LPI(6)
COPIES(2) FILESEP(2) OVRFLW(55)

The printer file named OUTPUT is specified in your application program with an
overflow line number of 58. However, before you run the application program, you
want to change the number of copies of printed output to 3 and the overflow line
to 60. The override command looks like this:
OVRPRTF FILE(OUTPUT) COPIES(3) OVRFLW(60)

When you call the application program, three copies of the output are printed.

When the application program opens the file, the file overrides, program-specified
attributes, and file attributes are merged to form the open data path (ODP) which
is used to manage the file during the running of the program. File overrides have
precedence over program-specified attributes. Program-specified attributes have
precedence over file-specified attributes. In this example, when the file is opened
and output operations are performed, spooled output will be produced with a
page size of 66 by 132, six lines per inch, three copies, two file separator pages,
and overflow at 60 lines.

The following chart explains this example:

Program A File OUTPUT


.
. SPOOL(*YES)
. PAGESIZE(66 132)
Open OUTPUT LPI(6)
. COPIES(2)
. FILESEP(2)
. OVRFLW(55)

Program-Specified
Attributes Open Data Path

SPOOL(*YES)
PAGESIZE(66 132)
OVRFLW(58) LPI(6)
COPIES(3)
FILESEP(2)
OVRFLW(60)

Override Command

COPIES(3)
OVERFLW(60)

RV2H328-0

Overriding file names or types


Another simple form of overriding a file is to change which file is used by the
program. This may be useful for files that have been moved or renamed after the
program has been compiled. For example, you want the output from your
application program to be printed using the printer file named REPORTS instead

Chapter 2. Printer file support 71


of the printer file named OUTPUT (OUTPUT is specified in the application
program). Before you run the program, enter the following:
OVRPRTF FILE(OUTPUT) TOFILE(REPORTS)

The file REPORTS must have been created (CRTPRTF command) before it can be
used.

If you want to override to a different type of file, you use the override command
for the new type of file. For example, if you are overriding a diskette file with a
printer file, use the Override with Printer File (OVRPRTF) command.

Overriding file names or types and file attributes of the new file
This form of overriding files is simply a combination of overriding file attributes
and overriding file names or types. With this form of override, you can override
the file that is to be used in a program and you can also override the attributes of
the overriding file. For example, you want the output from your application
program to be printed using printer file REPORTS instead of printer file OUTPUT
(OUTPUT is specified in the application program). In addition to having the
application program use printer file REPORTS, you want to override the number
of printed copies to three. Assume printer file REPORTS was created with the
following command:
CRTPRTF FILE(REPORTS) SPOOL(*YES)
PAGESIZE (68 132) LPI(8)
OVRFLW(60) COPIES(2) FILESEP(1)

Before you run the program, type the following command:


OVRPRTF FILE(OUTPUT) TOFILE(REPORTS) COPIES(3)

Then call the application program, and three copies of the output are printed using
the REPORTS printer file.

Note that this is not equal to the following two override commands:
Override 1
OVRPRTF FILE(OUTPUT) TOFILE(REPORTS)
Override 2
OVRPRTF FILE(REPORTS) COPIES(3)

Only one override is applied for each call level for an open of a particular file, so if
you want to override the file that is used by the program and also override the
attributes of the overriding file from one call level, you must use a single
command. If two overrides are used, the first override will cause the output to be
printed using the REPORTS printer file, but the second override will be ignored.

CL program overrides
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)
.

72 OS/400 Printer Device Programming V5R1


.
.
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 may 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.

Using a generic override for printer files


The OVRPRTF command allows you to have one override for all the printer files
in your job with the same set of values. Without the generic override, you would
have to do a separate override for each of the printer files.

By specifying *PRTF as the file name on the OVRPRTF command, you can apply
one override to all printer files

The override specified on the OVRPRTF command with *PRTF is applied if there is
no other override for the printer file name at the same call level. The following
example shows how *PRTF works:
Override 1
OVRPRTF FILE(OUTPUT) COPIES(6) LPI(6)

Override 2
OVRPRTF FILE(*PRTF) COPIES(1) LPI(8)
CALL PGM(X)

When program X opens the file named OUTPUT, the opened file has the following
attributes:
COPIES(6)
From Override 1
LPI(6) From Override 1

When program X opens the file named PRTOUT, the opened file has the following
attributes:
COPIES(1)
From Override 2
LPI(8) From Override 2

Deleting overrides
If you want to delete an override before the program has completed running, you
can use the Delete Override (DLTOVR) command. This command deletes only

Chapter 2. Printer file support 73


overrides that are active in the call level in which the command is entered. To
identify an override, use the printer file name specified on the FILE parameter of
the override command.

Following is an example that shows an override of a printer file (PRTF1) with a


different printer file (PRTF2). On the second line of the example is the Delete
Override (DLTOVR) command that is used to delete the override. The printer file
named PRTF1 will be used to process the output from the application program.
OVRPRTF FILE(PRTF1) TOFILE(PRTF2)
DLTOVR FILE(PRTF1)

You can delete all printer file overrides at this call level by specifying *ALL for the
FILE parameter.

Following is an example that shows two printer file overrides, PRTC and PRT3.
The override is changing the COPIES parameter value in both cases. The third line
of the example shows the Delete Override (DLTOVR) command with the FILE
parameter value set to *ALL. This means the overrides to PRTC and PRT3 are
deleted.
OVRPRTF FILE(PRTC) COPIES(2)
OVRPRTF FILE(PRT3) COPIES(4)
DLTOVR FILE(*ALL)

Displaying overrides
You can use the Display Override (DSPOVR) command to display printer file
overrides. You can display all printer file overrides or overrides for a specific
printer file.

To display any overrides to the printer file PRTF1, type:


DSPOVR FILE(PRTF1)

To display all printer file overrides, type:


DSPOVR FILE(*ALL)

However, when the FILE parameter has a value of *ALL, the system presents a
display with all the active overrides to all the file types supported on the system.
Using FILE(*ALL) on the DSPOVR command is an indirect way to learn what
overrides are active for any printer files; a more direct way is to issue a DSPOVR
command for each printer file.

Changing printer files


You can change the parameters of a printer file by using the Change Printer File
(CHGPRTF) command.

Using the CHGPRTF command makes the specified changes permanent for the
current active session and for all future sessions. You can still apply overrides to a
printer file that has been changed. However, the override is only active for the
current session.

Let’s assume that you have a mailing label program that uses a printer file named
LABELPR3. You now want to have two sets of mailing labels every time the
mailing label program is run and you want the spooled file to go to the output
queue named LABELS. The CL command would look like:
CHGPRTF FILE(LABELPR3) COPIES(2) OUTQ(LABELS)

74 OS/400 Printer Device Programming V5R1


When you enter this CHGPRTF command, it becomes effective immediately.

When any application program that uses printer file LABELPR3 is run, the spooled
file will go to output queue LABELS and two copies of the mailing labels will be
printed. For more information on the CHGPRTF command, see the CL Reference
topic in the Information Center.

Using printer file parameters


The following sections discuss individual printer file parameters in more detail to
help you better understand how to use them.

Using the device type (DEVTYPE) parameter


The device type (DEVTYPE) parameter specifies the type of data stream created for
a printer file. This parameter indicates whether the resulting data stream should be
an intelligent printer data stream (*IPDS), an SNA character stream (*SCS), an
ASCII data stream (*USERASCII), an Advanced Function Printing data stream
(*AFPDS), line data (*LINE), or mixed data (*AFPDSLINE).

An AFP data stream can be created from several sources:


v System/390
v PrintManager*
v AFP utilities for OS/400
v Using the virtual print function with the Client Access Express licensed program

However, to use the functions provided by many of the printer file parameters that
are supported for AFPDS, the spooled file must be created with a printer file that
specifies a device type of *AFPDS. These parameters include FRONTMGN,
BACKMGN, FRONTOVL, BACKOVL, FNTCHRSET, CDEFNT, and IGCCDEFNT.
In cases where the AS/400 system does not actually generate the AFP data stream
(the list above) either a printer file is not used or the DEVTYPE parameter for the
printer file is ignored.

Throughout this manual, AFPDS output that is created on the AS/400 system with
a printer file specifying DEVTYPE(*AFPDS) is referred to as *AFPDS created on the
AS/400 system.

If DEVTYPE(*USERASCII) is specified, the user is responsible for the content of the


entire data stream (such as PPDS for the 4019 printer). The AS/400 system will not
send any formatting commands that correspond to the spooled file attributes. For
example, the system sends initial formatting commands to the printer that set up
the page size, lines per inch, characters per inch, and font for spooled files with
DEVTYPE(*SCS) or DEVTYPE(*IPDS). These commands are not sent for spooled
files with DEVTYPE(*USERASCII). Instead, the system sends the contents of the
spooled file without adding any formatting commands.

This spooled file can then be sent to an ASCII printer attached to an AS/400
system. It is recommended that you not use file or job separators when you specify
DEVTYPE(*USERASCII).

Note: Do not put hex 03 transparency commands in the data stream. Instead, put
only ASCII commands the target printer can understand. The AS/400
system inserts the hex 03 commands with the correct lengths; thus, no
EBCDIC to ASCII translation occurs.

Chapter 2. Printer file support 75


Using the SCHEDULE parameter
The SCHEDULE parameter can be specified with one of three values to control
when the spooled file is available for a writer to produce the file.
*FILEEND
Specifies that the spooled file is made available to the writer when the file
is closed
*JOBEND
Specifies that the spooled file is made available to the writer when the job
that created the spooled file is ended
*IMMED
Specifies that the spooled file is made available to the writer when the file
is opened

*JOBEND considerations
The SCHEDULE(*JOBEND) spooled files of a job are grouped together on their
output queues when the job completes. All SCHEDULE(*JOBEND) spooled files of
the same job that are grouped together on a queue are produced together by the
writer. Another spooled file can be added to the top of the queue while the writer
is producing a SCHEDULE(*JOBEND) spooled file. After a writer produces one file
of a job that is SCHEDULE(*JOBEND), it checks the following file on the queue. If
this file is from the same job and is also SCHEDULE(*JOBEND), the writer
produces it next. However, if the file is from a different job or is not
SCHEDULE(*JOBEND), the first file on the queue is produced next.

If you want your SCHEDULE(*JOBEND) spooled files grouped together on a


SEQ(*FIFO) output queue, you must be careful not to separate the spooled files.
File operations such as HLDSPLF, CHGSPLFA, and RLSSPLF are performed one at
a time (even from a Work with Output Queue (WRKOUTQ) display). If operations
to other files on the queue are done at the same time, your spooled files can be
separated on a SEQ(*FIFO) queue. If your SCHEDULE(*JOBEND) spooled files
separate, you can regroup them by changing their output priority with the Change
Job (CHGJOB) command.

*IMMED considerations
When a writer is producing a SCHEDULE(*IMMED) spooled file, it may catch up
to the program producing the output. When this happens, the writer must wait for
the program to produce more output. Because of this, you should be careful using
*IMMED for the schedule option. When this happens, the writer cannot process
other spooled files. Moreover, the device cannot be used for any other work.

Normally, spooled files that are created with SCHEDULE(*IMMED) specified are
assigned a smaller internal buffer than spooled files that are created with
SCHEDULE(*JOBEND) or SCHEDULE(*FILEEND) specified. Using
SCHEDULE(*IMMED) to assign a smaller internal buffer may allow the spooled
data to be produced sooner, but can also adversely affect performance because
more disk operations are needed for the same amount of spooled data.

+ A large internal buffer is always used for spooled print files that use certain special
+ device requirements. Special device requirements include:
+ v Defined characters
+ v Graphics 4214
+ v Graphics 4234
+ v Graphics 522x

76 OS/400 Printer Device Programming V5R1


Changing the SCHEDULE parameter of a spooled file with the CHGSPLFA
command does not affect the internal buffers used for that file.

Using the OUTPTY parameter


Once a spooled file is available to a writer, the OUTPTY parameter determines the
order in which the files are produced. The OUTPTY parameter supports the value
*JOB (use the default output priority for the job) and a range of values from 1 to 9.
All available files that have an output priority of 1 are positioned at the top of the
output queue and are the first files to be printed. Next are the priority 2 files and
so on. By selecting the appropriate output priority for spooled files, you may
ensure that the spooled files needed right away will be printed first.

The priority of a spooled file when it is created is set from the printer file. Use the
Create Printer File, Change Printer File, or Override with Printer File commands to
set the OUTPTY parameter to the desired value before the file is opened. After the
file is opened, the output priority of the spooled file can be changed by using the
CHGSPLFA command.

Using the align (ALIGN) parameter


The align parameter on the Start Printer Writer (STRPRTWTR) and Create Printer
File (CRTPRTF) commands influences how the AS/400 system issues messages to
check forms alignment in printers before they start to print.

If the value on the STRPRTWTR align parameter is *WTR, the printer writer keeps
track of spooled files that are to be printed and issues a forms alignment message
whenever it determines that forms alignment is needed.

If this value is *FIRST, the forms alignment message is issued only for the first
spooled file printed.

The following cause the printer writer to issue a forms alignment message:
v Delete or hold spooled file command (option *IMMED) issued against a spooled
file with a status of WTR
v Printer writer or spooled file restarted
v Previous spooled file was created with ASCII data (virtual print) and current
spooled file was not
v Forms length of previous spooled file is different than current spooled file
v File being printed is the first file to print after a printer writer has been started
v Forms type is changed (after a G reply to a CPA3394 or CPA3395 message)

Note: A B reply to these messages allows you to skip or not receive the
alignment message.
v Incorrect control characters have been detected on a work station printer in the
previous file
v The Cancel key on a work station printer has been pressed while the previous
file is being printed
v A C (Cancel) reply has been given to the inquiry message for unprintable
characters detected on a work station printer in a previous file
v An H (Hold) reply has been given to some inquiry messages on a work station
printer
v A printer writer has recovered from a communications failure on a remote work
station printer

Chapter 2. Printer file support 77


If you do not want the printer writer to control the issuing of forms alignment
messages, you can specify *FILE as the value for the align parameter of the
STRPRTWTR command and *YES on the align parameter of the printer file used
with the application that produces the spooled file.

If the value on the STRPRTWTR align parameter is *FILE, the printer writer looks
at the attributes of the spooled file created by the application program. Specifically,
the printer writer looks at the align parameter value of the spooled file attributes
to determine if it should send a forms alignment check.

If the align parameter value of the spooled file attributes is *YES, the printer writer
sends a message to check forms alignment on the target printer.

If the align parameter value of the spooled file attributes is *NO, the printer writer
does not send any messages to check forms alignment on the target printer.

If you want to avoid any forms alignment messages, you can specify *FILE for the
align parameter on the Start Printer Writer (STRPRTWTR) command and *NO as
the align parameter value of the printer file. With this combination of values, the
AS/400 system does not send any messages to check alignment.

Using the page rotation (PAGRTT) parameter


The PAGRTT parameter controls the rotation of text on the page. When *AUTO or
*DEVD is specified for the PAGRTT parameter, the system determines the
orientation of the printed page. For example, if the output is too wide, the page is
rotated 90 degrees.

The system automatically senses when the output is too large to fit on the paper
that is loaded in the printer for the following: 3831, 3835, 3900, InfoPrint 3000, and
InfoPrint 4000 printers. It also senses whether the paper is larger than 8 1/2 inches
by 14 inches. In the information below, the expression “too large to fit on the
form” refers to a page size that is defined in the printer file parameters. If both the
length and width exceed 8.5 inches, or if the length or width is greater than 14
inches, the information is too large for the form. For example, a page defined to be
13.2 inches-wide and 11 inches long is too large for a form that is 8.5 inches-wide
and 14 inches-long. This would be a candidate for computer output reduction
(COR). This applies for printers other than the 3831, 3835, 3900, InfoPrint 3000, and
InfoPrint 4000.

If PAGRTT = *AUTO
v If the output is too large to fit on the form, computer output reduction is
performed automatically.
v If the page is wider than it is long, the page is rotated 90 degrees. If it is not
wider than it is long, the page is not rotated.
v *AUTO is only supported for spooled files with a device type (DEVTYPE) of
*SCS, *IPDS, or *AFPDS that is created on an AS/400 system. It is not supported
for files with a device type of *USERASCII, *LINE, *AFPDSLINE, or *AFPDS
that is not created on an AS/400 system.

If PAGRTT = *DEVD
v If the output is too large to fit on the form, computer output reduction is
performed automatically.
v If the page is wider than it is long, the page is rotated 90 degrees. If it is not
wider than it is long, the page is not rotated.

78 OS/400 Printer Device Programming V5R1


v For computer output reduction printing, the PRTQLTY (print quality) parameter
value must be either *DRAFT or *DEVD. If the PRTQLTY parameter value is
*STD or *NLQ, spooled files are printed without computer output reduction
(COR) and without page rotation.
v When using the PAGRTT parameter, do not specify *DEVD for the FONT
parameter value. When FONT(*DEVD) is used, the system cannot determine the
exact page width; therefore, page positioning may not be as intended.

Note: When the PAGRTT parameter value is *AUTO or *DEVD, computer output
reduction (COR) is not provided if the spooled file has any of the Device
Requirements fields set to Y. Use the Work with Spooled Files (WRKSPLF)
command and select option 8=Attributes to view the device requirements
for any spooled file.

If PAGRTT = 0, 90, 180, or 270 degrees


When these values (0, 90, 180, or 270) are specified for the PAGRTT parameter, the
page size (PAGESIZE) parameter values are not automatically changed. You must
specify the PAGESIZE parameter values with reference to the way the data is
printed on the page. For example, using forms that are 8.5 inches wide by 11
inches long and printing at 6 lines per inch with a 10-pitch font:
v Specify PAGESIZE(66 85) with PAGRTT(0) or PAGRTT(180).
The page reads top to bottom with the 8.5-inch side at the top (portrait
orientation).
v Specify PAGESIZE(51 110) with PAGRTT(90) or PAGRTT(270).
The page reads top to bottom with the 11-inch side at the top (landscape
orientation).

If PAGRTT = *COR
v Output is rotated 90 degrees.
v Page size is set to 11 by 8.5 inches.
v Font substitution occurs as follows:
– 12-pitch fonts are replaced with 15-pitch fonts.
– 15-pitch fonts are replaced with 20-pitch fonts.
– All other fonts are replaced with a 13.3-pitch font (with the exception of the
4028 printer, which uses a 15-pitch font).

Note: When the PAGRTT parameter value is *COR, computer output reduction
is not provided if the spooled file is *AFPDS, was created on the AS/400
system, and has any of the Device Requirements fields set to Y.

Use the Work with Spooled Files (WRKSPLF) command and select option
8=Attributes to view the device requirements for any spooled file. In
addition, *COR is not supported for spooled files with a device type of:
– *USERASCII
– *LINE (if the spooled file is sent to a printer configured with
AFP(*YES))
– *AFPDSLINE
– *AFPDS (if the spooled file was not created on the AS/400 system)

Page rotation on the 3831, 3835, 3900, InfoPrint 3000, and


InfoPrint 4000 printers
The 3831, 3835, 3900, InfoPrint 3000, and InfoPrint 4000 printers are
continuous-forms printers that can accept page rotation commands. Paper that is

Chapter 2. Printer file support 79


wider than it is long has output that is printed at 90-degree rotation. The paper
rotation is in a counter-clockwise direction. Normally output rotation is in a
clockwise direction. See the diagram below for an example of how printed output
appears on these printers when rotation occurs.
Notes:
1. The corner with the X is the physical paper origin. It is the left edge of the
narrow side of the page.
2. The circle with the plus (+) sign in it designates the logical paper origin.

X X X X
Page 1, on a 3835 Page 1, on a

paper.
on portrait
degrees rotation,
printer, at 90
Page 1, on a 3835
paper.
landscape
rotation, on
at 0 degrees
3835 printer,
Page 1, on a
printer, at 90 3835 printer,
degrees rotation, at 0 degrees
on landscape rotation, on
paper. portrait
paper.
Page 2

Page 2

Page 2
Page 2
Page 3

Page 3

Page 3

Page 3
Page 4
Page 4

RV3H005-0

Page rotation and duplex printing


The examples below show how printed output will appear when combinations of
duplex and page rotation are used. The dots on each page represent holes punched
in the paper.

80 OS/400 Printer Device Programming V5R1


PAGRTT (0) PAGRTT (0)
DUPLEX (*YES) DUPLEX (*TUMBLE)

Front Back Front


Side Side Side

Side
Back

PAGRTT (90) PAGRTT (90)


DUPLEX (*YES) DUPLEX (*TUMBLE)
Front Side

Back Side

Front Side

Back Side
RV2H310-1

Note: A page segment or overlay included using the DDS PAGSEG or OVL
keyword is not rotated with the rest of the printed output. This is also true
of an overlay (front or back) specified on the printer file.

You must specify the degree of rotation when the page segment or overlay
is created. Advanced Function Printing Utilities/400 can be used to create
overlays and page segments.

Using the MULTIUP(1, 2, 3, or 4) and REDUCE(*TEXT)


parameters
Note: The value 3 is not allowed for MULTIUP when REDUCE(*TEXT) is
specified.

The MULTIUP function can be software or hardware controlled. The software


MULTIUP function is selected by specifying REDUCE(*TEXT) on the printer file.
The hardware MULTIUP function is selected by specifying REDUCE(*NONE) on
the printer file.

The information presented here is dependent on specifying a REDUCE parameter


value of *TEXT.

For information on MULTIUP when the REDUCE parameter value is *NONE, see
“Using the MULTIUP(1, 2, 3, or 4) and REDUCE(*NONE) parameters” on page 86.

The MULTIUP parameter allows you to print more than one logical page of data
on a piece of paper. Depending on the printer that you are using, you can print
from one to eight logically formatted pages on one physical piece of paper.

Using a printer that supports duplex printing, you could have four logical pages
printed on each side of the physical paper, thus reducing the number of physical
pages printed from eight to one.

Chapter 2. Printer file support 81


The rotation value specified in the PAGRTT parameter of the printer file is used to
determine the rotation for MULTIUP printing. When PAGRTT(*AUTO),
PAGRTT(*DEVD), or PAGRTT(*COR) is specified and the MULTIUP parameter has
a value of 2 or 4, the PAGRTT value used is 0.

Note: If overlays (using the front overlay (FRONTOVL) and back overlay
(BACKOVL) parameters) are included in output using MULTIUP support,
the overlay applies to the whole sheet. That is, the front overlay is placed on
the front side of the paper and the back overlay on the back side.

MULTIUP support for the 4224, 4230, 4234, 4247 printers


These are continuous-forms printers, and do not support rotation. MULTIUP(2)
with PAGRTT(0) is the only valid combination. Below is an example of what the
physical output page would look like. If the logical page width is less than or
equal to 6-1/2 inches, the font is not changed. Otherwise font 223, which is 15
pitch, is used.

Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2

MULTIUP support
MULTIUP support is available on the following printers:
v 3130 3812 3816 3820 3825 3827 3828 3829 3831 3835 3900 3912 3916 3930 3935
4028 4312 4317 4324 Infoprint 20 Infoprint 32

These are IPDS printers that support page rotation (PAGRTT) and pages per side
(MULTIUP).

For all the above-described printers, the following diagrams are examples of how
the output will print depending on the PAGRTT and MULTIUP values.

PAGRTT(0) or PAGRTT(180) and MULTIUP(2)

Page 1
Page 1
Page 1
Page 1
Page 1
Page 1
Page 1

Page 2
Page 2
Page 2
Page 2
Page 2

82 OS/400 Printer Device Programming V5R1


Page 2
Page 2

If the logical page width is less than or equal to 8 inches and the logical page
length is less than 5 inches, the font is not changed.

If the logical page width is greater than 8 inches, or the logical page length is
greater than 5 inches, the font is selected based on the following table:

Note: Any references to the 4028 printer in the following tables also apply to the
3912, 3916, 4312, 4317, 4324, InfoPrint 20, and InfoPrint 32 printers. The
following footnotes apply to all of the tables about MULTIUP Font
Substitution that are included here.
Notes:
1. If the target printer does not have font 230 resident, it uses font 223.
2. If the target printer is a 4028 and has font 283 (20 pitch) resident, it uses font
283. Otherwise it uses font 281 (20 pitch).
3. If the target printer is a 3130 or 3935, it will use font 416 with point size of 4
(30 pitch). If the target printer is a 4028 and does not have font 290 resident but
does have font 283 resident, it will use font 283. If the target printer is a 4028
and does not have font 290 or 283 resident, it will use font 281 (20 pitch).
Table 2. MULTIUP font substitution for page rotation 0 or 180 with MULTIUP(2)
Page Width (Characters) Page Length (Inches) Font Used Pitch (CPI)
1
1 through 123 characters Less than or equal to 5 230 15
inches
1 through 123 characters Greater than 5 inches 254 17
124 through 139 characters All 254 17
2
140 through 163 characters All 281 202
Greater than or equal to 164 All 2903 273
characters

PAGRTT(90) or PAGRTT(270) and MULTIUP(2)

Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2
Page 1 Page 2

If the logical page width is less than or equal to 5 inches and the logical page
length is less than 8 inches, the font is not changed.

If the logical page width is greater than 5 inches, or the logical page length is
greater than 8 inches, the font is selected based on the following table:

Chapter 2. Printer file support 83


Table 3. MULTIUP font substitution for page rotation 90 or 270 with MULTIUP(2)
Page Width (Characters) Page Length (Inches) Font Used Pitch (CPI)
1
1 through 73 characters Less than or equal to 8 230 15
inches
1 through 73 characters Greater than 8 inches 254 17
74 through 83 characters All 254 17
2
84 through 97 characters All 281 202
Greater than or equal to 98 All 2903 273
characters

PAGRTT(0) or PAGRTT(180) and MULTIUP(4)

Page 1 Page 3
Page 1 Page 3
Page 1 Page 3
Page 1 Page 3
Page 1 Page 3
Page 1 Page 3
Page 1 Page 3

Page 2 Page 4
Page 2 Page 4
Page 2 Page 4
Page 2 Page 4
Page 2 Page 4
Page 2 Page 4
Page 2 Page 4

If the logical page width is less than or equal to 3.75 inches and the logical page
length is less than 5 inches, the font is not changed.

If the logical page width is greater than 3.75 inches, or the logical page length is
greater than 5 inches, the font is selected based on the following table:
Table 4. MULTIUP font substitution for page rotation 0 or 180 with MULTIUP(4)
Page Width (Characters) Page Length (Inches) Font Used Pitch (CPI)
1 through 54 characters Less than or equal to 5 230* 15
inches
1 through 54 characters Greater than 5 inches 254 17
55 through 61 characters All 254 17
2
Characters 62 through 71 All 281 202
Greater than or equal to 72 All 2903 273
characters

PAGRTT(90) or PAGRTT(270) and MULTIUP(4) PAGRTT(0) or PAGRTT(180) and


MULTIUP(4)

84 OS/400 Printer Device Programming V5R1


Page 1 Page 3
Page 1 Page 3
Page 1 Page 3
Page 1 Page 3

Page 2 Page 4
Page 2 Page 4
Page 2 Page 4
Page 2 Page 4

If the logical page width is less than or equal to 5 inches and the logical page
length is less than 3.75 inches, the font is not changed.

If the logical page width is greater than 5 inches, or the logical page length is
greater than 3.75 inches, the font is selected based on the following table:
Table 5. MULTIUP font substitution for page rotation 90 or 270 with MULTIUP(4)
Page Width (Characters) Page Length (Inches) Font Used Pitch (CPI)
1
1 through 73 characters Less than or equal to 5 230 15
inches
1 through 73 characters Greater than 5 inches 281 20
74 through 83 characters Less than or equal to 3.75 254 17
inches
74 through 83 characters Greater than 3.75 inches 281 20
2
84 through 97 characters All 281 202
Greater than or equal to 98 All 2903 273
characters

Restrictions for MULTIUP with REDUCE(*TEXT)


v MULTIUP requires an IPDS printer. It can be configured AFP(*YES) or
AFP(*NO).
v MULTIUP reduces the size of any lines drawn in the printed output resulting
from the use of the DDS LINE or BOX keywords. Depending on the pel
resolution of the printer being used, the lines may become too narrow to print.
v MULTIUP with REDUCE(*TEXT) is not supported for spooled files created with
device type (DEVTYPE) of *LINE, *AFPDSLINE, or *AFPDS unless the AFPDS
was created
v MULTIUP is ignored if the spooled file contains any of the following advanced
printing functions:
– Final form text
– Variable fonts
– Variable lines per inch
– Variable drawer
– Superscript or subscript
– Variable character ID
– Highlighting
– Extended 3812 fonts
– Graphics

Chapter 2. Printer file support 85


– Bar codes
– Variable page rotation
– PC printer emulation
– Define characters
– Variable characters per inch
– Transparency commands
– Field outlining
– AFP resources (overlays, page segments, host resident fonts)

Using the MULTIUP(1, 2, 3, or 4) and REDUCE(*NONE)


parameters
Note: Hardware MULTIUP (REDUCE(*NONE)) is only supported by some
printers. The 3130 or 3935 is an example of a printer that supports hardware
MULTIUP. If the target printer does not support hardware MULTIUP, the
pages printed are not printed using the MULTIUP function.

To use hardware MULTIUP you can select any MULTIUP value (1 through 4), and
you must specify *NONE as the value on the REDUCE parameter of the printer
file. It is then up to the application to ensure the output fits in the partition
(portion) of the page. The partitioning of the page is determined by the printer.
This combination of MULTIUP and REDUCE parameter values also allows
multiupping of data streams restricted by software multiupping. For example,
*LINE and *AFPDSLINE data streams can be multiupped as can data streams
which contain advanced functions and host resident fonts.

When REDUCE(*NONE)is specified, overlays and page segments apply to each


partition of the multiupped page. Thus, if front overlay (FRONTOVL) and back
overlay (BACKOVL) are used for a MULTIUP(2) REDUCE(*NONE) job, the
FRONTOVL is printed in the first partition and BACKOVL in the second partition.
Notes:
1. The corner with the X is the physical paper origin. It is the left edge of the
narrow side of the page.
2. The circle with the plus (+) sign in it designates the logical paper origin.

The following diagrams are examples of how output prints when


REDUCE(*NONE) and MULTIUP(2, 3, or 4) are specified.

MULTIUP(2), REDUCE(*NONE), and PAGRTT(0)

86 OS/400 Printer Device Programming V5R1


X X

Page 1
Page 1 Page 2

Page 2
Page 3 Page 4
X

Page 3

Page 2
Page 4
Page 5 Page 6

Page 1
Page 5
Page
RV3H000-1

MULTIUP(3), REDUCE(*NONE), and PAGRTT(0)

X X
Page 1 Page 2 Page 3

Page 1 Page 2 Page 3

Page 4 Page 5 Page 6


X
Page 4 Page 5 Page 6

Page 1 Page 2 Page 3

Page 7 Page 8 Page 9


Page 7 Page 8 P

RV3H002-1

MULTIUP(4), REDUCE(*NONE), and PAGRTT(0)

Chapter 2. Printer file support 87


X X

Page 3

Page 1
Page 1 Page 2

Page 4

Page 2
Page 3 Page 4

Page 7

Page 5
X
Page 5 Page 6
Page 1 Page 2

Page 8

Page 6
Page 11 Page 12

Page 9
Page 7 Page 8 Page 3 Page 4

Page 10

Page 9 Page 10

Page 11 Page 12

RV3H003-1

MULTIUP(4), REDUCE(*NONE), and PAGRTT(90)

Note: It is recommended not to use rotation with MULTIUP and


REDUCE(*NONE). Following the reading direction can be difficult due to
the way the data is oriented on the physical page. The example below
shows how the output prints.

X X
Page 1

Page 2

Page 2 Page 4

Page 1 Page 3
Page 3

Page 4

Page 6 Page 8 X
Page 5

Page 6

Page 4

Page 3

Page 5 Page 7
Page 7

Page 8

Page 2

Page 1

Page 10 Page 12
Page 9

Page 10

Page 9 Page 11
Page 11

Page

RV3H047-0

Using the fidelity (FIDELITY) parameter


For AFP functions that are not supported, the FIDELITY parameter allows the user
to determine if a spooled file with advanced printing functions should continue to
print on an IPDS printer configured AFP(*YES) or stop printing when an advanced
printing function is encountered that is not supported. For example, if a spooled
file containing bar code commands is to be printed on a 3820 printer and the
FIDELITY parameter value is:

88 OS/400 Printer Device Programming V5R1


v *ABSOLUTE, the spooled file does not print because the 3820 does not support
bar codes.
v *CONTENT, the spooled file prints without the bar codes.

Note: If the device description of the printer has the value for the print while
converting (PRTCVT) parameter set to *YES, the spooled file can print the
pages up to the point where the bar code was encountered no matter what
the fidelity parameter value is.

Fidelity and other printer file parameters


If FIDELITY(*ABSOLUTE) is specified, the following list of printer file parameters
must have a valid value specified for the selected printer. Otherwise, the spooled
file is held.
v DRAWER
v FONT
v DUPLEX
v MULTIUP
v OUTBIN
v PAGRTT
v FRONTOVL
v BACKOVL

If FIDELITY (*CONTENT) is specified, a default value is used. For example, if


DUPLEX (*YES) is requested, but the printer does not support duplex printing, the
spooled file is printed on one side of the paper.

Using the overlay (FRONTOVL and BACKOVL) parameters


When an overlay is specified in a printer file, you can merge data from a spooled
file onto the same piece of paper that the overlay is printed on. The FRONTOVL
parameter specifies the overlay to be printed on the front side of the paper; the
BACKOVL parameter specifies the overlay for the back side of the paper.

With your application program, you can use overlays that you created yourself
using the Advanced Function Printing Utilities/400 licensed program, or overlays
sent from System/390.

For more information about the Advanced Function Printing Utilities/400 licensed
program, go to “Advanced function printing utilities/400” on page 325.

The following diagram is an example of an overlay you can create using the AFP
utilities. Additionally, the diagram shows how the merged spooled file data
(Variable Page Data in the diagram) can be integrated into one document.

The merged document can be printed on any IPDS printer configured with
AFP(*YES) in the printer’s device description.

The overlays can only be merged with a spooled file that was created using a
device type (DEVTYPE) of *SCS, *IPDS, or *AFPDS. The *AFPDS must have been
created on an AS/400 system.

Chapter 2. Printer file support 89


Electronically Stored Form Overlay Variable Page Data

Merge

Finished Product

RV2H309-0

Using overlays and rotation


Rotation can occur for text and overlays. The AS/400 system treats text and
overlays separately. That is, text is rotated using the page rotation (PAGRTT)
parameter of the printer file. Overlay rotation must be determined at the time the
overlay is created. Overlays are not rotated by the PAGRTT parameter.

To use the contents of the same overlay with different degrees of rotation (0 and 90
degrees), you create the overlay twice, once for 0 degrees and once for 90 degrees.

Assuming that you want the text and the overlay to be read in the same direction,
the overlay offset values (down and across) on the printer file need to change
depending on the degree of rotation of the text (PAGRTT parameter). That is, an
overlay created with 90 degrees rotation is most often used with text that is rotated
90 degrees.

90 OS/400 Printer Device Programming V5R1


Notes:
1. Determining the overlay parameter values is made easier by focusing on a
particular corner of the overlay depending on the degree of rotation specified.
2. Keep in mind that paper does not rotate as it passes through the printer.
3. The page size (PAGESIZE) values (down, across) must be viewed differently
depending on the page rotation value (PAGRTT) specified. The examples show
this concept by having numbers along the edge of the page.

Following are examples of how to determine the overlay parameter values when
page rotation (PAGRTT) is used.

Example 1: Determining Overlay Values with Page Rotation (PAGRTT) of 0


Degrees. The following example assumes:
v Page size (PAGESIZE) parameter values are (11,9)
v Page rotation (PAGRTT) parameter value is (0)

0 1 2 3 4 5 6 7 8 9

1 First line of text


Second line of text
2 .
.
3 X
4

5
Another line of text
6 .
.
7

10

11 RV2H337-1

When PAGRTT is 0, the focus point for determining the overlay parameter values
is the top left of the overlay (indicated by the X in the example).

Use the numbers beside the example page to determine the overlay down (3) and
across (2) values.

Overlay parameter values are (3,2). Example 2: Determining Overlay Values with
Page Rotation (PAGRTT) of 90 Degrees. The following example assumes:
v Page size (PAGESIZE) parameter values are (9,11)
v Page rotation (PAGRTT) parameter value is (90)

Chapter 2. Printer file support 91


0 1 2 3 4 5 6 7 8 9

Second line of text


First line of text
Another line of text
1

2 X

.
.
.
.
3

10

11 RV2H338-1

When PAGRTT is 90, the focus point for determining the overlay parameter values
is the bottom left of the overlay (indicated by the X in the example).

Use the numbers beside the example page to determine the overlay down (2) and
across (4) values.

Overlay parameter values are (2,4). Example 3: Determining Overlay Values with
Page Rotation (PAGRTT) of 180 Degrees. The following example assumes:
v Page size (PAGESIZE) parameter values are (11,9)
v Page rotation (PAGRTT) parameter value is (180)

0 1 2 3 4 5 6 7 8 9

4 .
.
5 Another line of text

6 X
7

9 .
.
10 Second line of text
First line of text
11 RV2H339-1

When PAGRTT is 180, the focus point for determining the overlay parameter
values is the bottom right of the overlay (indicated by the X in the example).

92 OS/400 Printer Device Programming V5R1


Use the numbers beside the example page to determine the overlay down (6) and
across (4) values.

Overlay parameter values are (6,4). Example 4: Determining Overlay Values with
Page Rotation (PAGRTT) of 270 Degrees. The following example assumes:
v Page size (PAGESIZE) parameter values are (9,11)
v Page rotation (PAGRTT) parameter value is (270)

0 1 2 3 4 5 6 7 8 9

6 X
7
Another line of text
Second line of text
First line of text

8
.
.

.
.

10

11 RV2H340-1

When PAGRTT is 270, the focus point for determining the overlay parameter
values is the top right of the overlay (indicated by the X in the example).

Use the numbers beside the example page to determine the overlay down (6) and
across (3) values.

Overlay parameter values are (6,3).

Using the margin (FRONTMGN and BACKMGN) parameters


To use the margin parameters, the device type (DEVTYPE) parameter on the
printer file must be *AFPDS. For device types other than *AFPDS, the AS/400
system calculates the margins.

Margins define the starting point of printed output on a piece of paper. The
FRONTMGN parameter specifies the starting point on the front side of the paper;
the BACKMGN parameter specifies the starting point on the back side of the
paper.

There are two types of margins: front and back. Offset values, down and across,
are used to fix the position of the margin. Across is defined as left to right. Down
is defined as top to bottom.

Margins are measured in either inches or centimeters. The type of measurement is


specified in the unit-of-measure (UOM) parameter on the printer file.

Chapter 2. Printer file support 93


Using *DEVD and 0 as margin parameter values
If you have existing application programs that specify how far across and how far
down to start printing, you should specify 0 (zero) or *DEVD for the margin
parameter offset values.
*DEVD
When *DEVD is specified, the no-print border (no-print border is a small
area around the whole page where data will not print) is used to
determine the starting printing point.
For printers configured as AFP(*NO), 0 is used to determine the starting
point when *DEVD is specified.
0 When 0 is specified, the top left corner of the page is used to determine the
starting printing point.

The following diagram shows a no-print border. The size of the no-print border
can vary from printer to printer.

0 1 2 3 4 5 6 7 8 9

3
Shaded Area Represents
4 the No-Print Border

10

11 RV2H341-1

Restrictions with the margin parameters


The margin parameters (both front and back) are ignored for spooled files that
have *COR specified as the value for the page rotation (PAGRTT) printer file
parameter. This is because *COR assumes a half-inch margin. In addition, the
margin parameters are ignored for spooled files that have a pages per side
(MULTIUP) value of 2, 3, or 4.

Using margin parameters and overlays


There are two ways to position your overlays
v Specify overlays with the front or back margin (FRONTMGN or BACKMGN)
parameters so that the overlays move with the text based on margin parameters.
v Change value in data area QPRTVALS so that the overlays are not affected by
the front or back margin parameters.

Positioning overlays based on margin parameters: Overlays specified with the


back or front overlay printer file parameter are affected by the front or back
margin parameters. The following diagram shows how your output would look if

94 OS/400 Printer Device Programming V5R1


your front margin was defined as 2 units down and 2 units across and the
placement of your overlay was 4 units down and 4 units across:

Note: If you use margins and overlays together, the offsets have the same unit of
measure (UOM) specified: inches (*INCH) or centimeters (*CM), but not
inches and centimeters together.

Positioning overlays independently: If you do not want the overlays moved by


the values specified in the front or back margin parameters, you can specify a Y
(upper case) in position 4 of the data area QPRTVALS. The following diagram
shows you the two ways to position the overlays:

To find out if data area QPRTVALS exists on your system, use the following
command:
DSPDTAARA DTAARA(QUSRSYS/QPRTVALS)

If the data area QPRTVALS exists, but position 4 is not set to ’Y’ (uppercase), use
the following command:
CHGDTAARA DTAARA (QUSRSYS/QPRTVALS (4 1)) VALUE ('Y')

If you do not have data area QPRTVALS on your system, you can create one by
using the following commands:
1. CRTDTAARA DTAARA(QUSRSYS/QPRTVALS) TYPE(*CHAR) LEN(256) VALUE(' Y')

Chapter 2. Printer file support 95


2. CHGOBJOWN OBJ(QUSRSYS/QPRTVALS) OBJTYPE(*DTAARA) NEWOWN(QSYS)
CUROWNAUT(*SAME)
3. GRTOBJAUT OBJ(QUSRSYS/QPRTVALS) OBJTYPE(*DTAARA) USER(*PUBLIC) AUT(*ALL)

Using the corner staple (CORNERSTPL) parameter


This parameter specifies the corner of the media to be used for stapling. The
following diagram indicates the corners that you can specify for a printer. The
corners that you can specify are device dependent. Refer to your printer’s
documentation for this information. Note that page rotation does not affect the
staple placement.

Using the edge stitch (EDGESTITCH) parameter


This parameter specifies where staples are to be placed along the finishing margin
of the media. You need to check your printer documentation to determine which
elements, and values of elements, are supported. Where your printer does not
support any of the values for a specific element, specify a value of *DEVD for the
element.

Note: The finishing margin is an invisible line along which finishing operations,
such as edge stitching, are done. You specify the position of the finishing
margin, relative to the physical edge, in the reference edge offset element of
the parameter.
Element 1: Reference Edge
Specifies which edge to use for finishing. Possible values are:
*DEVD
The default that is used by the device.
*BOTTOM
The reference edge is the bottom edge.
*LEFT The reference edge is the left-hand edge.
*RIGHT
The reference edge is the right-hand edge.
*TOP The reference edge is the top edge.

96 OS/400 Printer Device Programming V5R1


Element 2: Reference Edge Offset
Specifies the offset from the reference edge to place the edge stitching.
Possible values are:
*DEVD
The default that is used by the device.
reference-edge offset
This element that is specified in centimeters (range 0 through
57.79) or inches (range 0 through 22.57).
Element 3: Number of Staples
Specifies the number of staples to use for edge stitching. Possible values
are:
*DEVD
The default value for the device. This is the value that is used if
*DEVD is also specified for the staple offsets value of this
parameter. The system uses the default number of staples for the
device when you specify *DEVD for this and for the staple offset
value.
number of staples
The valid value range is from 1 to 122 staples. The number of
staples is the same as the number of staple offsets specified.
Element 4: Staple Offsets
Specifies the distance between staples that are used in the edge stitching. If
the staple-placement will be on the left or right edge of the paper, the first
staple offset is determined by: measuring from the intersection of the
finishing margin and the bottom edge of the paper to where the center of
the staple will be. Subsequent staple offsets are measured from the same
point (not from the previous staple). If the staple-placement will be at the
top or bottom edge of the paper, the first staple offset is determined by:
measuring from the intersection of the finishing margin and the left edge
of the paper, to where the center of the staple will be. Subsequent staple
offsets are measured from the same point (not from the previous staple).
Possible values are:
*DEVD
The default staple offset for the device. If you specify a value for
the Number of staples, the printer will automatically calculate the
position of each staple.
staple offset
The valid value range is from 1 to 122 staple offsets. If you specify
a staple offset, the Number of staples must be *DEVD. This
measurement is in centimeters (range 0 through 57.79) or inches
(range 0 through 22.57)

The diagram below shows the reference edge offset from the left edge with 2
staples. It uses the following values:
v Element 1: Reference edge—*LEFT
v Element 2: Reference edge offset—*DEVD
v Element 3: Number of staples—*DEVD
v Element 4: Staple offsets—*DEVD

Chapter 2. Printer file support 97


Using the saddle stitch (SADLSTITCH) parameter
This parameter specifies where to place the staples along the finishing margin of
the media. In saddle stitching, the finishing margin is at the center of the media,
and parallel to the reference edge. Page rotation does not affect the placement of a
saddle stitch.

You need to check your printer documentation to determine which elements, and
values of elements, are supported. Where your printer does not support any of the
values for a specific element, specify a value of *DEVD for the element.
Element 1: Reference Edge
Specifies which edge to use for the saddle stitch. Possible values are:
*DEVD
The default that is used by the device.
*TOP The reference edge is the top edge.
*LEFT The reference edge is the left-hand edge.
Element 2: Number of Staples
Specifies the number of staples to use for saddle stitching. Possible values
are:
*DEVD
The default value for the device. This is the value that is used if
*DEVD is also specified for the staple offsets value of this
parameter. When specifying *DEVD for this and for the staple
offset value, the number of staples will be the default that is used
by the device. If you specify one or more offsets, the number of
staples is the same as the number of staple offsets specified.
number of staples
The valid value range is from 1 to 122 staples.
Element 3: Staple Offsets
Specifies the distance between staples that are used in the edge stitching. If
the staple-placement will be on the left or right edge of the paper, the first
staple offset is determined by: measuring from the intersection of the
finishing margin and the bottom edge of the paper to where the center of
the staple will be. Subsequent staple offsets are measured from the same
point (not from the previous staple). If the staple-placement will be at the
top or bottom edge of the paper, the first staple offset is determined by:
measuring from the intersection of the finishing margin and the left edge
of the paper, to where the center of the staple will be. Subsequent staple
offsets are measured from the same point (not from the previous staple).
Possible values are:

98 OS/400 Printer Device Programming V5R1


*DEVD
The default staple offset that is used by the device. If you specify a
value for the Number of staples, the printer will automatically
calculate the position of each staple.
staple offset
The valid value range is from 1 to 122 staple offsets. If a staple
offset is other than *DEVD, the Number of staples must be *DEVD.
This measurement is in centimeters (range 0 through 57.79) or
inches (range 0 through 22.57)

Using the DBCS coded font (IGCCDEFNT) parameter


The DBCS coded font is the font that the system uses for DBCS printing on IPDS
printers. This parameter is specified only for printer files with DEVTYPE (*SCS) or
(*AFPDS) when printing on IPDS-capable printers configured with AFP(*YES). A
point size may be specified for outline fonts. It will be ignored for raster fonts.

Transforming SCS DBCS data to AFPDS data


When transforming the SCS data stream to AFPDS, the IGCCDEFNT parameter is
used to print the DBCS data. When the spooled file is created as SCS, it contains
SO/SI (shift out / shift in) characters to identify the double-byte data. When the
printer writer is printing a spooled file, a font change to the DBCS coded font
replaces the SO in the AFPDS data stream. When the SI is encountered in the data
stream, a font change is placed in the data stream to change the font back to the
previous SBCS font.

Generating AFPDS data to spool


The IGCCDEFNT parameter is used when generating AFPDS. If the data stream
contains double-byte data (IGCDTA(*YES)), a font substitution to the DBCS coded
font takes place.

In an externally-described file (DDS), the user can use the IGCCDEFNT DDS
keyword to specify a DBCS font. This font will be used to print any DBCS data
encountered in that field or record. If the user has a DBCS-graphic field specified,
the printer file IGCCDEFNT parameter is used unless the IGCCDEFNT DDS
keyword has been specified at the record or field level.

Using the font character set (FNTCHRSET) parameter


This parameter is specified only for printer files with DEVTYPE (*AFPDS) when
printing on IPDS-capable printers configured with AFP(*YES).

When using a font character set, a character set and a code page must be specified
on the font character set (FNTCHRSET) parameter of the printer file being used. A
point size may be specified for outline fonts. It will be ignored for raster fonts.

You cannot specify a coded font if you use the FNTCHRSET parameter on the
printer file.

You can find out which font character sets and code pages come with the AS/400
system by using the Work with Font Resources (WRKFNTRSC) command and
specifying QFNTCPL for the library and *FNTCHRSET or *CDEPAG as the object
attribute.

Font character sets and code pages are downloaded from the AS/400 system to an
IPDS printer when the spooled file is printed. They are supported on all IPDS

Chapter 2. Printer file support 99


printers except the 4224, 4230, 4234, 4247, and 64xx. The use of font character sets
provides greater consistency in the printed appearance of output from different
printers.

Note: When a printer file is created and a character set and code page are
specified for the font character set (FNTCHRSET) parameter, column spacing
is done using this printer file level parameter. Any fonts or code pages
specified in the DDS FNTCHRSET keyword are ignored and the font and
code page specified in the printer file parameter FNTCHRSET are used.

Using the coded font (CDEFNT) parameter


This parameter is specified only for printer files with DEVTYPE (*AFPDS) when
printing on IPDS-capable printers configured with AFP(*YES).

A coded font is the combination of a font character set and a code page. This
combination is assigned a name and called a coded font.

Note: The coded font contains only the names of the font character set and code
page. It does not contain the font and code page data.

A point size may be specified for outline fonts. It will be ignored for raster fonts.

You can find out which coded fonts come with the AS/400 system by using the
Work with Font Resources (WRKFNTRSC) command and specifying QFNTCPL for
the library and *CDEFNT as the object attribute.

Note: If you have obtained coded fonts from other sources but have them in a
different library, the WRKFNTRSC command can display the coded fonts
located in that library.

You can specify a library for the coded font specified on the printer file. However,
if the font character set and code page that make up the coded font are not in a
library that is defined to your library list, the coded font is not found.

Special printer file considerations

Direct print considerations


When output data is written directly to the printer instead of output queue, the job
is called a direct print job. When printing direct print job on an SCS printer, the file
device type is changed to *SCS by your AS/400. When printing on an IPDS printer
that is configured with AFP(*NO), the file device type is changed to *IPDS by your
AS/400. If the print job has file device type *AFPDS, *USERASCII, *LINE, or
*AFPDSLINE, the direct print job is not supported. See “Using a printer for both
spooled files and direct print jobs” on page 141 for more information about direct
printing.

Open considerations
The following considerations apply to opening printer files for spooled output:
v The output queue should be created for the type of output your program
produces so that system operator intervention can be kept to a minimum while
a printer writer is producing output. You should consider the following when
creating an output queue:
– What form of output is being produced (printer or diskette).

100 OS/400 Printer Device Programming V5R1


– What kind of forms the output is printed on.
– What kind of protection you want to place on your data. (Do you want
someone else to be able to display your data?)
– How many job separators you want.
v The SCHEDULE parameter specifies when output is to be made available to a
printer writer. When a printer writer processes a specific file, it is dependent on
things such as:
– When the writer is started
– Other output files on the queue
– If the writer or the output queue is being held
v The parameters specified to produce output are saved until they are used by the
writer.

Output considerations
The following considerations apply to output operations performed on spooled
files:

Force-end-of-data considerations
The force-end-of-data (FEOD) operation can make part of the spooled file available
to the writer unless SCHEDULE(*JOBEND) or HOLD(*YES) are specified for the
file. This operation lets you write parts of a spooled file; for example, you can
write one order at a time. You should not use the force-end-of-data operation for
normal output. A new spooled file is started after each FEOD operation.

Close considerations
When the schedule value is *FILEEND, the output file is made available to the
printer writer. The file resources used by the program are deallocated.

If an application program is writing data when the system ends abnormally, the
spooled output is shown containing 0 pages on spool displays such as the
WRKOUTQ, WRKSPLFA, and WRKJOB displays. Records that were stored in
internal system buffers are lost.

Spooled files that contain no records (open and close, but no output) are
automatically deleted by the system when the application closes the device file.
Writers will not select these files for printing unless SCHEDULE(*IMMED) is
specified and the writer selects the file before it is closed.

First-character forms-control data


For program-described printer files, you can also specify the print control
information in the data itself. You can do this by including an American National
Standard first-character forms-control code in position 1 of each data record in the
printer file. (You cannot use first-character forms control and DDS on the same
file.)

For information about the machine data, see “Chapter 8. Working with line data”
on page 223.

To include the print control information in the data, you specify one of the
following American National Standard first-character forms-control codes in the
first position of each data record:

Chapter 2. Printer file support 101


Control Code
Action before Printing a Line
' ' Space one line (blank code)
0 Space two lines
- Space three lines
+ Suppress space
1 Skip to channel 1
2 Skip to channel 2
3 Skip to channel 3
4 Skip to channel 4
5 Skip to channel 5
6 Skip to channel 6
7 Skip to channel 7
8 Skip to channel 8
9 Skip to channel 9
A Skip to channel 10
B Skip to channel 11
C Skip to channel 12

Any other character in position 1 of a record defaults to a blank (the American


National Standard code for spacing one line). If this occurs, the notify message
CPF4916 is sent to the high-level language program once per file.

When you use first character forms control data for a printer file, the print control
information created by the high-level language compiler is ignored. The character
in position 1 of the record is used as the print control character for that record.

To create a program-described printer file that uses first-character forms-control


data, specify the CTLCHAR parameter and, optionally, the CHLVAL parameter on
the Create Printer File (CRTPRTF) command. CTLCHAR(*FCFC) specifies that the
first character in every record is an American National Standard forms-control
code.

The CHLVAL parameter allows you to associate a specific skip-to line number with
an American National Standard channel identifier. For example, if you specify
CHLVAL(2 20), channel identifier 2 is allocated with line number 20; therefore, if
you place the forms-control 2 in the first position of a record, the printer skips to
line 20 before printing the line.

Note: If the printer stops at a particular line number and the next record processed
has a channel value forms-control number that is the same value as the line
number the printer is on, the printer advances to that value (line number)
on the next page. In the example in the paragraph above, if the printer had
been on line 20 already, the printer would then have advanced to line 20 of
the next page.

There is one exception to this method of printer advancement.

102 OS/400 Printer Device Programming V5R1


If the printer is positioned at the top of the page (line 1) and the channel value
forms-control value is line 1, the printer does not advance to a new page.

Each control identifier can be specified only once on the parameter. If no line
number is defined for a channel identifier and that channel identifier is
encountered in the data, the printer takes the default of spacing one line before
printing.

In the following example, a file, PRTFCFC, that uses first-character forms-control


data is created:
CRTPRTF FILE(QGPL/PRTFCFC) OUTQ(PRINT) CTLCHAR(*FCFC) +
CHLVAL((1 1) (2 10) (12 60))

The printer output is spooled to the output queue PRINT. Channel identifier 1 is
associated with line 1, channel identifier 2 is associated with line 10, and channel
identifier 12 is associated with line 60.

Printer font support


Characters per inch versus font
Most SCS printers use the CPI parameter on the CRTPRTF, CHGPRTF, or
OVRPRTF command to determine the pitch (characters per inch) of the printed
output. However, the 3812, 3816, 5219, and all IPDS printers use the FONT
parameter to select both an implied pitch (characters per inch) and a font style. For
these printers, the CPI parameter is ignored except when converting the page size
(PAGESIZE) from *UOM to *ROWCOL. Conversely, the FONT parameter is
ignored on printers where it is not applicable.

To provide flexibility in your print job, the pitch of the font identifier (FONT
parameter) should match, where possible, the value specified on the CPI
parameter. By setting the FONT parameter to FONT(*CPI), the system selects a
font of the same pitch as the CPI parameter value. A print job intended for a
printer that supports fonts can then be printed on another printer without
significant change in the appearance of the printed output. For example, a printer
file which has FONT(222), Gothic font with 15 pitch, and CPI(15) could print on a
3812, 4224, or 5219 Printer (which use the FONT parameter) or also could print on
a 4214, 4230, 4234, 4247, 5224, or 5225 Printer (which support 15 characters per
inch). If this print job were directed to a printer that only supports 10 characters
per inch, then printer file redirection would be used.

For more information about redirecting spooled files to SCS printers, go to


“Spooled file redirected to SCS printers” on page 112.

When using an SCS externally described printer file, normally the value specified
in the CPI parameter is used to position fields on the printed page. For example, if
a printer file has 10 characters per inch specified, and FIELDA is specified to start
in column 51, then there would be 50 blanks to the left of FIELDA (50 blanks at 10
characters per inch is 5 inches).

RSLH114-0

Chapter 2. Printer file support 103


For the IPDS externally described printer files, the pitch implied by the FONT
parameter on the CRTPRTF, CHGPRTF, and OVRPRTF commands is used instead
of the CPI parameter or the value of the FONT DDS keyword to determine the
starting column of fields on a printed page. In the example above, if CPI(10) and
FONT(087) had been specified, and the printer specified was one that supports
fonts, then FIELDA specified to start in column 51 would be 50 blanks at 12
characters per inch (implied CPI value for font 087) or 50/12 inches, which is 4.167
inches in from the left margin of the paper. The default for FONT is (*CPI). When
*CPI is selected, the OS/400 program automatically selects a font of the pitch
specified on the CPI parameter.

Proportionally spaced and typographic fonts


All IPDS printers support proportionally spaced fonts. For proportionally spaced
fonts, characters vary in width depending on the character being printed (for
example, i is a narrow character, and W is a wide character). See “Appendix D.
Working with Fonts, Font Character Sets, Code Pages, CHRIDs, and Coded Fonts”
on page 387 for a list of all supported fonts. The implied characters-per-inch
column in this table lists the value of the width of a blank character for the font
selected.

When using proportionally spaced fonts, fold and truncation (FOLD parameter)
may not work as intended. This is because the system does not keep track of the
width of each individual character.

The following printers also support typographic fonts: the 3812, 3130, 3160, 3816,
3820, 3825, 3827, 3829, 3831, 3835, 3900, 3916, 3930, 3935, 4028, 4312, 4317, 4324,
InfoPrint 3000, and the InfoPrint 4000. You can specify a typographic font by
indicating point size (height of font). A point measures 1/72 of an inch. An 8-point
font would be 1/9 of an inch high, and a 24-point font would be 1/3 of an inch
high. When using fonts that contain tall characters, it may be necessary to double
or triple space, to avoid having lines overlap when printing the page.

Because proportionally spaced and typographic fonts have characters of variable


widths, care should be taken with the use of underlining and overstriking. The
highlighting or underlining method of printing a line with a space after (SPACEA)
value of 0 followed by printing another line may not work correctly.

Proportionally spaced and typographic fonts may be specified on the CRTPRTF,


CHGPRTF, or OVRPRTF command when using an externally described printer file.
The point size may be specified for typographic fonts. The point size is ignored for
fonts that are not typographic. As noted above, the implied characters-per-inch
value of the font identifier specified on the FONT parameter is used to position
fields on a printed page. The same rule for positioning fields on a printed page is
used with proportionally spaced and typographic fonts. The width of a blank
character is used to position fields on a page. Output should be tested to see that
using externally described printer files with proportionally spaced fonts produces
satisfactory results because overprinting and gaps can occur in the output. Because
of slight adjustments made for position checks, it is recommended to not print on
line 1 when specifying 8 or 9 LPI on an IPDS printer.

Note: The amount of printed space for a field varies depending on which
characters are in a field. Enough space should be left between fields to allow
for the widest characters (uppercase characters) expected in that field.

In the previous example, if CPI(10) and FONT(1351) had been specified, and the
printer used was a 3812 Printer, then FIELDA specified to start in column 51

104 OS/400 Printer Device Programming V5R1


would be 50 blanks at 17.14 characters per inch (implied CPI value for font 1351)
or 50/17.14 inches, which is 2.975 inches from the left margin of the paper.

In this example, FIELDA would start 2.975 inches from the left margin of the paper
regardless of how many fields were defined to its left. When using an increment
value (+n) instead of a column number (positions 42 through 44 in DDS
specification), fields are positioned the same for proportionally spaced fonts as
they are for fixed pitch fonts. That is, the field is positioned based on the width of
the blank for the specified font. The following example illustrates that using either
absolute column numbers or relative increment numbers (+n) will supply the same
result.

A
RSLH115-3

Font substitution
If the font identifier specified on the FONT parameter is not supported by the
printer being used, printer data management selects a substitute font that is
supported by the printer (if possible). A substitute font is at the same pitch or a
higher pitch whenever possible to ensure that as much data as possible fits on the
printed page. A complete list of fonts supported and the substitute font selected for
each printer that supports the FONT parameter is shown in “Appendix D. Working
with Fonts, Font Character Sets, Code Pages, CHRIDs, and Coded Fonts” on
page 387.

If a substitute font cannot be used, spool redirection is done. An inquiry message is


sent to the message queue associated with the device or printer writer. The inquiry
message gives you the option of holding or printing the file. If the print option is
used, then the spooled output file is reformatted with the print attributes of file
QPSPLPRT. Output may not look as intended. Refer to the printer’s reference
manual for information on what conditions cause the substitute font to not be
used.

For the SCS 3812, 3816 and 5219 Printers, font substitution can be made only at the
file level. For font changes made in the document, font substitution is not done. In
this case, spool redirection (described previously) is used.

IPDS printer FONT parameter considerations


When a printer has AFP(*YES) specified in the printer device description and the
DEVTYPE specified for the printer file being used is *AFPDS, the FNTCHRSET,
CDEPGE, and CDEFNT printer file parameters may be used to select a font
resource to be downloaded to the printer. This applies to all IPDS printers except
the 4224, 4230, 4234, 4247, and 64xx. If these parameters are not used, then the
value specified in the FONT printer file parameter is used.

Chapter 2. Printer file support 105


When FONT(*DEVD) is specified on the CRTPRTF, CHGPRTF, and OVRPRTF
commands, the following limitations are imposed:
v Bar codes are positioned on the page assuming a 10-pitch font is specified in the
device description.
v When using a combination of bar code (BARCODE), page rotate from a printer
file or DDS (PAGRTT), and character size (CHRSIZ) parameters in an externally
described printer file, unpredictable results may occur. This is because the
printer device FONT parameter value is not known when the spooled file is
created.
v The data stream created may be longer than if a specific font were selected. This
means the spooled file may take more storage in the output queue. Fields are
positioned with spaces (hex 40) between them instead of using commands to
specify the location where a field is to be placed.
v If a proportionally spaced font is used with a field in the file, any following
fields may not be positioned in the column used if a specific font were specified
at the file level. This is caused by the variable width of the characters in the
proportionally spaced font, which are followed by spaces (hex 40) to position the
next field.
v If the value of the FONT parameter on the printer device description is *DEVD
or 0, font 011 is selected.

The maximum number of fonts that can be sent to a printer file is 48. When more
than 48 fonts are requested, an error message is sent.

A slight adjustment is sometimes made to the first or last line of a page when the
lines per inch (LPI) parameter value is greater than 6. This adjustment prevents
IPDS printers from reporting position check errors due to part of a character
printing off the top or bottom of the page. For the first line on a page, a slight
downward adjustment is made. For the last line on a page, a slight upward
adjustment is made. This adjustment is about 1/72 of an inch. No other lines on
the page are adjusted. This adjustment is made only for spooled files with
DEVTYPE of *SCS or *IPDS when printed on IPDS-capable printers. It is
recommended that the first line on a page not be used for printing if the lines per
inch (LPI) parameter on the printer file is 8 or greater.

Note: If an optical character recognition (OCR) font is specified with a non-OCR


code page, the code page is changed to an OCR code page. If a non-OCR
font is specified with an OCR code page, the font is changed to an OCR
font.

Using graphic symbol sets


IPDS printers allow the selection of graphic symbol sets as fonts when using the
DDS font keyword.

To find which graphic symbol sets are available on your system, enter the CL
command:
DSPOBJD OBJTYPE(*GSS) OBJ(QGDDM/*ALL)

Replacing on unprintable characters


You can replace unprintable characters in your data before the data is written to
the printer or to a spooled file by specifying RPLUNPRT(*YES) on the CRTPRTF,
CHGPRTF, or OVRPRTF commands. The replacement of an unprintable character
depends on the printer being used and the hexadecimal value of the unprintable
character.

106 OS/400 Printer Device Programming V5R1


The RPLUNPRT value must be selected before the spooled file is created. Once a
spooled file is in an output queue, changing the RPLUNPRT value has no effect on
that particular spooled file.
v When RPLUNPRT(*YES) is specified, any characters in the range hex 00 through
hex 3F, and hex FF, are replaced. The default replacement character is a blank.
The character which a printer cannot print varies depending on the type of
printer.
v When RPLUNPRT(*NO) is specified, no translation of the data stream is made.
Any characters in the range hex 00 through hex 3F, or hex FF, may cause
undesirable results. These characters are in the range used by printer control
characters.
For most characters in this range, the printer signals an unrecoverable error and
the spooled file either is held in the output queue or is not processed. Some
characters in this range control forms action and character representation on the
printer and, as a result, additional skipping or spacing may occur. If control
characters are placed in the data, system functions such as displaying or copying
spooled output files and restarting or backing up a printer may produce results
that cannot be predicted.
If the hexadecimal value of the unprintable character is hex 40 through hex FE, a
message is sent to the message queue associated with the printer. The message
gives you the option to end the writer, hold the spooled file, ignore the error
and continue printing, or select a page number where printing should be
restarted. If the ignore option is taken, then unprintable characters continue to
be reported. If the option to start again (specify page number) is taken, all
unprintable characters are replaced with blanks and you receive no more
notification for unprintable characters.

Considerations for the 4245, 5262, 6252, and 6262 printers


The printer translates lowercase characters to uppercase characters when using a
print band that does not contain lowercase characters. If your print job contains
other characters that are not on the print band, they can be translated to blanks by
specifying RPLUNPRT(*YES) for the printer file.

CL commands that you can use to do this are: CRTPRTF, CHGPRTF, and
OVRPRTF.

A print band is selected by switches on the 5262 operator’s panel. The operator
must select both a language ID and a band image using these switches.

The 4245, 6252, and 6262 Printers detect the print band the printer is using.

When a print band changes for a print job, no inquiry message is sent to the
message queue associated with the printer writer. You can specify a different form
type for that job, such as blank payroll forms or blank invoices. A message to
change the form type is sent to the printer writer message queue to notify the
operator of the change to the print band.

Using alternative character sets and code pages for printer


output
Character sets are used with code pages to determine how each character will
appear in the printed output. Code pages consist of hexadecimal identifiers (code
points) assigned to character identifiers. For example, in code page 037 (EBCDIC),
the letter e is assigned a code point of hex 85.

Chapter 2. Printer file support 107


In multinational environments, data in one national graphics character set may
need to be printed on devices that support another national character set. This is
particularly true of characters with accents and other characters with diacritical
marks (such as ç, ñ, and ü). In this section, these characters are called extended
alphabetics.

For example, assume that a physical file on the system contains data in the Basic
French character set, and includes the character é. In the code page used with the
Basic French character set, this character is hex C0. The data could have been
entered on a display device that can handle the character or could have been sent
to the system from another system over a communications line. When hex C0 is
sent to a printer that is set up for the United States Basic character set, the hex C0
is printed as {. Depending on the printer and the hexadecimal value sent, the
hexadecimal value could be an unprintable character. The way the printer handles
a specific hex code point (for example, hex C0) depends on the current value of the
CHRID parameter in the printer file. You can specify the following parameter
values for the CHRID parameter:
v With an explicit value specified for the CHRID parameter, the printer interprets
the data as if the data were in the character set and code page specified.
v With CHRID(*SYSVAL) specified, the printer file takes the value specified in the
QCHRID system value when the output is created.
v With CHRID(*DEVD) specified, the printer uses the CHRID that was set with
the device control panel or that was specified when the printer device
description was created.
v If you have specified CHRID(*JOBCCSID) the printer interprets the data as if it
were in the character set and code page that are associated with the CCSID for
the current job . For more information, see theGlobalization topic in the AS/400
Information Center.
v With CHRID(*CHRIDCTL) specified, the printer file checks the CHRIDCTL job
definition attribute to determine whether to use *JOBCCSID or *DEVD on the
CHRID command parameter for the job.

Not all printers can handle all CHRID parameter values. If a CHRID is specified
for a printer on which that CHRID is not supported, a message is sent to the
operator. Go to “Appendix D. Working with Fonts, Font Character Sets, Code
Pages, CHRIDs, and Coded Fonts” on page 387 for a description of which printers
support which extensions.

For program-described printer files, the value of the CHRID parameter determines
the code page and character set used to print the data. However, for externally
described printer files, the CHRID parameter is used only for fields that also have
the CHRID DDS keyword specified. Fields that do not have the CHRID DDS
keyword use the code page and character as if CHRID(*DEVD) had been specified
for the CHRID parameter on the printer file.

For printers with AFP(*YES) in the device description, the printer file CDEPAG
and FNTCHRSET parameters can be used to select a code page when the printer
file DEVTYPE parameter is *AFPDS. This applies to all IPDS printers except 4224,
4230, 4234, 4247, and 64xx.

The following shows how extended alphabetics are handled in printer output:

108 OS/400 Printer Device Programming V5R1


Physical Read Application Write Spooled Printed
File Program File as

Renee Renee Renee Renee

RS3H020-0

Assume that a record in a physical file contains a field with the value Renée. An
application program reads the record from the physical file, and writes a record
containing the data to the spooled file. The output field in the printer file that
describes how Renée is to be printed has the CHRID DDS keyword specified,
indicating that the printer is to interpret extended alphabetics. (The graphic
character set 288 and code page 297 are specified for the interpretation in either the
printer file or the QCHRID system value. Code page 297 is used for French
language.)

When printing the data, the printer interprets hex C0 as specified in character set
288 and code page 297. If character set 101 and code page 037 had been selected,
hex C0 (é) would have been printed as {.

One of the following CHRID values (graphic character set and code page) must be
specified to print fonts OCR-A and OCR-B on the IPDS printers:
580 340
590 340
697 892
697 893

Print text
You can specify on the printer file a line of text that is to be printed at the bottom
of every page. This line of text is called the print text and is set by using the
PRTTXT parameter on the CRTPRTF, CHGPRTF, or OVRPRTF commands. Up to 30
characters are allowed in the line of print text. The 30 characters are centered at the
bottom of the page, 2 lines below the overflow line. If the user already has data to
print on the line that the print text goes on, the print text is bumped down to the
next blank line on the page. If no lines are blank, the print text is printed on the
last line of the page.
Notes:
1. For externally described printer files with DEVTYPE(*AFPDS) using the DDS
POSITION keyword, the print text is positioned by ignoring the location of any
data placed on the page by records using the POSITION keyword. If all the
data on the page is positioned using the DDS POSITION keyword, the print
text is located on the overflow line.
2. If a host resident font is specified on the printer file, 10 characters per inch is
used to calculate the location of the text specified on the PRTTXT parameter.

A system value, QPRTTXT, can be used to specify the print text so that the same
text can appear on all files printed on the system. Also, the print text can be taken
from the job description, so that all files created from a particular job can have the
same print text.

Print text is useful for printing a security classification on each page. It can also be
used to print a company name or slogan on each page.

Chapter 2. Printer file support 109


Editing output fields
The system provides editing support that makes fields more readable when they
are printed. With the system editing support, you can do the following:
v Suppress leading zeros
v Punctuate a field with commas and periods to show decimal column and to
group digits by threes
v Print negative values with a minus sign or CR to the right
v Print zero values as zeros or blanks
v Print asterisks to the left of significant digits to provide asterisk protection
v Print a currency symbol corresponding to the system value QCURSYM

The system provides this editing support with edit codes and edit words. Edit
codes are a defined set of editing patterns. You identify these by name, and the
system edits a field according to the pattern defined by the named edit code. Edit
words are edit patterns that you define to produce the desired results. Edit codes
cover most commonly used editing requirements. You need to use the edit word
support only for those editing needs not covered by edit codes.

There are two methods of using edit codes and edit words. Which one you use
depends on how you define the printer file and how it is used in an application
program. If your application is using program-described data, your high-level
language may allow you to identify edit codes or create your own edit words. If
your application is using externally described data, the edit code (EDTCDE) DDS
keyword allows you to identify an edit code; the edit word (EDTWRD) DDS
keyword allows you to define your own editing pattern.

The system provides several edit codes:


v 1 through 4
v A through D
v J through M
v X through Z

The editing patterns defined by these codes are described in theDDS Reference
topic in the online Information Center.

User-defined edit codes


You can also define five edit codes to provide more editing function than is
available with the OS/400 edit codes, and to handle common editing functions that
would otherwise require the use of an edit word. These are called user-defined edit
codes. For example, you may need to edit numbers that include hyphens (like
some telephone numbers), or more than one decimal point. You can use
user-defined edit codes for these functions. These edit codes are named QEDIT5,
QEDIT6, QEDIT7, QEDIT8, and QEDIT9 and can be referred to in DDS or a
high-level language program by number (5, 6, 7, 8, or 9).

These edit codes are created by using the Create Edit Description (CRTEDTD)
command. Edit descriptions are always placed in library QSYS. They cannot be
moved or renamed; only one occurrence of each is allowed. Edit descriptions have
an object type of *EDTD.

110 OS/400 Printer Device Programming V5R1


IBM supplies a version of each of the QEDIT edit codes. You can use these edit
descriptions as they are, or you can delete them and create your own. See the DDS
Reference topic in the online Information Center for more information about using
these edit descriptions.

Before using any of the user-defined edit codes, you should check its contents on
your system, since it may have been changed from the IBM-supplied version. The
Display Edit Description (DSPEDTD) command can be used to display the contents
of a user-defined edit code.

Changing a user-defined edit code description does not affect any application or
printer file that has already been created using that edit description. If you want
your application to use the changed edit description, you must either create the
high-level language program again (if the edit code is used in the program) or
create the file again (if the application is using an externally described file that
contains EDTCDE keywords).

Effect of changing fields in a file description


When a program using externally described printer files is compiled, the compiler
extracts the file descriptions for the files referred to in the program and makes
these file descriptions part of the compiled program. When you run the program,
you can verify that the record formats with which the program was compiled are
the current record formats. To do this, you use the LVLCHK parameter on the
create file command when the file is created.

The system assigns a unique level identifier for each record format when the file it
is associated with is created. The system uses the information in the record format
description to determine the level identifier. This information includes the name of
the record format, the names, attributes, and order of the fields in the format, the
indicators used, and the names and the order of the indicators in the record
format. If you use the INDARA keyword to remove the indicator from the output
buffer, the indicators used are not included in the level identifier information.

When the file is opened, if level checking is specified (LVLCHK parameter), the
system does a format-by-format comparison of the level-checking values specified
in the program to the level-checking values specified in the printer file. If any of
the formats specified in the program do not exist in the file, or if any of the level
checking values are different, an error occurs. Formats can be added to or removed
from a printer file without affecting existing application programs that do not use
the added or deleted formats.

You should display the file description to determine if the changes affect your
program. You can use the Display File Field Description (DSPFFD) command to
display the file description or, if you have the source entry utility (SEU), you can
display the source file. Not every change in a file necessarily affects your program.
You may not have to recompile your program. If you do not have to recompile
your program, you should specify LVLCHK(*NO) for the file (CHGPRTF or
OVRPRTF command).

You can add a field to the end of a printer file record format without having to
recompile your program as long as you do not want to use the field in your
program. If you delete a field from the end of the record format, you do not have
to recompile your program if you are not using the field. However, if you add a
field to or delete a field from a record format anywhere other than at the end, you

Chapter 2. Printer file support 111


must recompile your program. Otherwise, the field offsets in the record passed to
and from the program are wrong for processing.

In general, anything that changes the length or position of any fields in the record
format used by the program will require that the program be recompiled.

Redirecting output
Spooled or nonspooled output intended for a printer can be redirected to another
printer. However, each file is checked to ensure that the file attributes (device type,
number of lines per inch, number of characters per inch, page length, and page
width) and any advanced functions used by the file (such as variable LPI, variable
font, or defined characters) are valid on the new printer.

Nonspooled output
When a nonspooled file is redirected, and the printer file attributes do not match
the new printer, one of the following occurs:
v If the printer file specifies a characters-per-inch value not supported by the
device being used, a diagnostic message (CPF4057) is sent to the program
message queue and the data is printed at 10 characters per inch. If the page
width is greater than 132 characters, the records are folded.
Folding is not supported on IPDS printers.:
1. If the printer file specifies a lines-per-inch value not supported by the device
being used, a diagnostic message (CPF4056) is sent to the program message
queue, and the data is printed at 8 lines per inch.
2. If the page length is greater than the maximum length allowed for the
printer being used, the printing ends with an escape message (CPF4138).
3. If the printer file specifies special device requirements (such as use of certain
DDS keywords) that are not supported by the device being used, then a
diagnostic message is sent to the program message queue and the special
function is ignored.

Spooled files
When a spooled file is redirected to another printer, the spooled file cannot be
printed without change if any of the spooled output file attributes are not
supported by the printer device. For example, some printer device attributes that
might not be supported are:
v Page size
v Output drawers
v Print quality
v Lines per inch
v Characters per inch

Spooled file redirected to SCS printers


The following section describes the actions taken when a spooled file is redirected
to an SCS printer and cannot be printed without change (SCS printers include the
3812, 3816, 4214, 4234, 4245, 4247, 5219, 5224, 5225, 5256, 5262, 6252, and 6262
Printers):
v An inquiry message is sent to the message queue of the writer if any of the
following is true:
– The spooled file uses the IPDS data stream (DEVTYPE(*IPDS))
– The spooled file attributes are not supported by the printer

112 OS/400 Printer Device Programming V5R1


– The special device requirements used by the spooled file are not supported by
the printer

The inquiry message allows these options:


– End the writer
– Print the spooled file with lines folded when the lines are longer than the
width of IBM-supplied printer file QPSPLPRT
– Print the spooled file with lines truncated when the lines are longer than the
width of IBM-supplied printer file QPSPLPRT
– Hold the spooled file and process the next file on the output queue

If the spooled file is printed, results may be unpredictable because the file is
printed using the printer attributes specified in the IBM-supplied printer file
QPSPLPRT, and all advanced functions used by the spooled file are removed.
Functions removed include:
DDS keywords:
CHRID
Graphic character set and code page
CHRSIZ
Character size (width and height)
CPI Characters per inch
DFNCHR
Define character
DRAWER
Paper drawer selection
FONT Font selection
LPI Lines per inch
PAGRTT
Page rotation
PRTQLTY
Print quality
TRNSPY
Transparency
Other print functions:
Drawer change in document
Font change in document
Lines-per-inch change in document
Page rotation in document
Subscript and superscript
v If the spooled file specifies a characters-per-inch value not supported by the
printer, an inquiry message is sent to the message queue of the writer with the
option to:
– End the writer
– Print the spooled file at 10 characters per inch with lines folded when the
lines are longer than the width of IBM-supplied printer file QPSPLPRT

Chapter 2. Printer file support 113


– Hold the spooled file and process the next file on the output queue
v The 5219 Printer is an exception to the above cases if the only mismatch between
the spooled file and printer is the HIGHLIGHT special device requirement that
the file contains. When this occurs, an inquiry message is sent to the message
queue of the writer with the option to:
– End the writer.
– Print the spooled file without highlighting but keep all other advanced
functions used by the file.
– Attempt to print the spooled file without changing. (If this is not successful,
the file will be held on the output queue.)
– Hold the spooled file and process the next file on the output queue.

If the spooled file is printed, the resulting output closely resembles how the file
was intended to look. This is because the attributes specified by the spooled file
were used and advanced functions were kept.
v Documents created on other systems may contain print controls that are not
supported by the 5219 or 3812 Printers. These controls may include variable
form size, output drawer, print quality, lines per inch, characters per inch,
character identifier, or justification. If this occurs, an inquiry message is sent to
the message queue of the writer with the options to:
– End the writer.
– Print the spooled file with unsupported values changed to values which are
supported by the printer.
– Attempt to print the spooled file without changing. (If this is not successful,
the file will be held on the output queue).
– Hold the spooled file and process the next file on the output queue.

If the spooled file is printed, the file attributes from the spooled file are used and
all advanced functions that are valid for the device are kept. The resulting output
should closely resemble what the file was intended to look like, though it still may
not print exactly as intended because of the unsupported values.

Spooled files redirected to IPDS printers


IPDS printers include: the 3130, 3160, 3812, 3816, 3820, 3825, 3827, 3829, 3831, 3835,
3900, 3912, 3916, 3930, 3935, 4028, 4224, 4230, 4234, 4247, 4312, 4317, and 4324.
InfoPrint 20, InfoPrint 32, InfoPrint 3000, and InfoPrint 4000 are also IPDS printers.
The following describes the actions that are taken when you spool a file to an IPDS
printer:
v The message queue will receive an inquiry if the spooled file uses the SCS data
stream (DEVTYPE(*SCS)) and contains DBCS (double-byte character set) data. It
will also receive an inquiry if it has a page length greater than that supported by
the printer (for both SNA character string (SCS) and IPDS files). You can choose
any of the following options:
– End the writer
– The spooled file will print with lines that are truncated when the lines are
longer than the width of IBM-supplied printer file QPSPLPRT
– Hold the spooled file and process the next file on the output queue

Printing results may be unpredictable, because the printer will use the printer
attributes that are specified in QSPLPR, the IBM-supplied printer file. All
advanced functions that are specified in the spooled file will be removed.
Functions removed include:

114 OS/400 Printer Device Programming V5R1


DDS keywords:
CHRSIZ
Character size (width and height)
CPI Characters per inch
DFNCHR
Define character
DRAWER
Paper drawer selection
PAGRTT
Page rotation
TRNSPY
Transparency
Other print functions:
Drawer change in document
Font change in document
Lines-per-inch change in document
Page rotation in document
Subscript and superscript
v The message queue will receive an inquiry message for the following: if the
spooled file uses the SCS data stream, (DEVTYPE(*SCS)), does not contain DBCS
data, and uses special device requirements. Special device requirements include
graphics, defined characters, transparencies, variable font, and enhanced 3812
fonts. It will also receive an inquiry if it uses a proportionally spaced font for the
FONT parameter of the file. You can select any of the following options:
– End the writer
– Transform the spooled file to IPDS format and print
– Hold the spooled file and process the next file on the output queue

If the file prints, its existing attributes will be used. Advanced functions remain
intact, except graphics, defined characters, justification, and transparencies. The
transformation to IPDS format should substantially keep the integrity of the text
data. However, the file may still not print exactly as intended. Unsupported font
pitches, font spacings, and character identifiers are changed to the closest
approximation valid on the printer.
v The writer automatically transforms the file to an IPDS file and prints it if the
following is true: the spooled file uses DEVTYPE(*SCS), does not contain DBCS
data, does not use defined characters, graphics, transparency, variable fonts, or
enhanced 3812 fonts. The printer file also can not use a proportionally spaced
font for the FONT parameter of the printer file. The spooled file may not print
exactly as intended. For unsupported font pitches, font spacings, and character
identifiers, the printer writer uses the closest approximation available on the
printer.
v The message queue of the writer receives an inquiry message if the spooled file
uses the IPDS data stream (DEVTYPE(*IPDS)), but uses advanced functions not
supported by the printer. Options made available are:
– End the writer
– Print the spooled file, but dropping unsupported advanced functions from the
file

Chapter 2. Printer file support 115


– Hold the spooled file and process the next file on the output queue

advanced functions that are not supported by the printer

3812 and 3816 SCS printer considerations


When automatic configuration is run for 3812 and 3816 printers, the printers report
as a 5219 Printer. The first time the printer is used, the AS/400 system sends some
commands to the printer that allow the system to distinguish between a 5219
Printer and a 3812 or 3816 SCS printer.

However, this happens after the open processing has been done for the first output
to print. The first output to print can be direct output or a spooled file. This
means, for the first output printed, the system treats the printer as a 5219 Printer.
For example, this means there is no page rotation for that first printed output.

In order for the system to recognize a 3812 or 3816 SCS printer, the printer writer
must complete processing. After the first output has been printed, and a new
printer writer is started, the system recognizes the printer as a 3812 or 3816 SCS
printer.

Once the system recognizes a printer as a 3812 or 3816 SCS, it remembers the true
printer type until the printer device description is deleted.

3835 printer considerations


The 3835 Model 1 printer has a no-print border. In this area, about 1/6 inch from
all edges of the page, data will not print.

The AS/400 system adjusts the positioning of the printed text on the page to
compensate for the no-print border. For example, if your application program
prints text in the top 1/6 inch or left 1/6 inch, all the text will print. The AS/400
system adjusts the starting printing position to 1/6 inch from the top and left of
the page causing all printed data on the page to be shifted to the right and down
by 1/6 inch. If your application relies on printing data at a certain point on the
paper, you may have to change your application to compensate for this adjustment
or use the margin values of 0 on the printer file.

Note: The 3835 Model 2 does not have a no-print border. The AS/400 system does
not adjust the position of printed text for this printer. When directing output
from printing on a 3835 Model 1 to a Model 2, the difference in how the
no-print border is used must be considered.

3912, 3916, and 4028 printer considerations


The 3912, 3916, and 4028 printers have a no-print border. In this area, about 1/6
inch from all edges of the page, data will not print.

If the 3912, 3916, or 4028 is configured AFP(*NO), you may have to adjust your
application programs. For example, if your application program prints text in the
top 1/6 inch or left 1/6 inch, that text will not appear on the page.

If the 4028 is configured AFP(*YES), the AS/400 system adjusts the positioning of
the printed text on the page to compensate for the no-print border. For example, if
your application program prints text in the top 1/6 inch or left 1/6 inch, all the
text will print. The AS/400 system adjusts the starting printing position to 1/6 inch
from the top and left of the page causing all printed data on the page to be shifted

116 OS/400 Printer Device Programming V5R1


to the right and down by 1/6 inch. If your application relies on printing data at a
certain point on the paper, you may have to change your application to
compensate for this adjustment.

To print as close to the edge of the page as possible:


v Use PAGRTT (*COR)
v Use MULTIUP(2) or (4)
v Configure the printer with AFP(*YES)

This positions the starting origin of the page to the edge of the printable area.

Printing a graphic along with other output


The command word #$@INCLGRPH allows a user to include a graph anywhere in
the data printed by high-level languages.

To include graphics with other program output, a special control record is used.
The format for this control record is:
#$@INCLGRPH filename,x,y,w,l
Notes:
1. There must be only one space between the command word and the parameters.
2. All five parameters must be specified. A default value (the default values are
included in the list below) for parameters x, y, w, and l can be obtained by
omitting any value. For example, a valid control record with defaults for
parameters x, y, and l would look like:
#$@INCLGRPH filename,,,9.5,
3. The #$@INCLGRPH control record should be in a print record by itself, because
any other data along with it may be considered as parameters.
4. Parameters should immediately follow one another, separated by commas,
using no blanks.
5. The characters INCLGRPH must be all uppercase.
6. The #$@INCLGRPH control record must begin in the first column.
7. The #$@INCLGRPH control word is used with characters from code page 500.
For example, in code page 500, @ is hex ’7B’, $ is hex ’5B’, and @ is hex ’7C’.
Other code pages may use other characters in the#$@INCLGRPH control
record. You will need to change the characters depending on the code page
being used.

The parameters are defined below. Parameters x, y, w, and l define the area on
the page where the graphics file will be printed. Parameters x and y define the
upper left corner of the graphics area, and parameters w and l define the size of
the graphics area.
filename
The name of the graph object file to be included. If the file has more than
one member, the last member is used. The library containing the file must
be in your library list.
x The distance, in inches, from the left edge of the page to the left edge of
the graphics area on the page. The default is 0.
y The distance, in inches, from the top of the page to the top edge of the
graphics area on the page. The default is 0.

Chapter 2. Printer file support 117


w The width of the graphics area, in inches. The default is the width of the
current page you are using.
l The length of the graphics area, in inches. The default is the length of the
current page you are using.

Parameters x, y, w, and l can be specified in decimal form in any combination of


xx.xx, where x is any number from 0 through 9. The specified value cannot be
more than 45.50 and, if a 0 value is specified, the result is the default value for that
parameter.

If there are any errors found in the control record or an error occurs while
processing the graphics file, the control record is printed as normal text data. The
graphics file to be used must be in a format acceptable to the printer. For IPDS
devices, this format is level DR/2 of the Graphic Object Content Architecture
(GOCA). See the manual Graphic Object Content Architecture , SC31-6804, for more
information about GOCA.

Special printer file considerations for AFPDS


If the device type (DEVTYPE) parameter for the printer file is *AFPDS, certain
considerations apply to some printer file parameters and to the sending of spooled
files to other systems.

Considerations for printer file parameters


v Overflow (OVRFLW) parameter
Overflow is not signalled for externally described printer files (DDS) for record
formats that use absolute positioning. In addition, overflow is determined by
using the margin offset down value. For example, if the margin offset down
value is .5 inches, the overflow line is line 60, and the lines per inch value is 6,
overflow is signalled when line 60 is printed on the page. This is 10.5 inches
down the page.
| v Character Identifier (CHRID) parameter
| The CHRID parameter of the printer file is ignored if a font character set
| (FNTCHRSET) or coded font (CDEFNT) parameter is specified. One exception to
| this is if a file contains UCS-2 data that will be converted to EBCDIC data. In
| this case, the CHRID parameter determines the target conversion CCSID.
v Page Rotation (PAGRTT) parameter
Overlays and page segments are not automatically rotated based on the PAGRTT
parameter of the printer file.
v Page Size (PAGESIZE) parameter
If the unit of measure is *ROWCOL, and either a coded font or font character set
is specified on the printer file, the page width is calculated using 10
characters-per-inch.

Considerations for sending an AFPDS spooled file to another


system
Because the actual printer device is not known when a spooled file is created,
some parameters specified on the printer file cause a default setting to be used in
the created spooled file. This is done to provide values in the data stream of the
spooled file in the event it is sent to another system.

118 OS/400 Printer Device Programming V5R1


On the system the spooled file was created on, the correct values (as determined
for the printer you want the spooled file printed on) are substituted before the
spooled file is printed.

The following parameters cause a default setting to be used:


v If CHRID(*DEVD) or an externally described printer file is used, the CHRID
system value (QCHRID) is substituted.
v If FONT(*DEVD) is used, font 11 is substituted.
v If FORMFEED(*DEVD) is used, drawer 1 is substituted.
v If PAGRTT(*DEVD), PAGRTT(*AUTO), or PAGRTT(*COR) is used, page rotation
of 0 is substituted.

Note:
v On the AS/400 system, offset stacking of printed output is used. As the
job finishes, the paper tray moves, offsetting the stack of paper to make it
easier to distinguish between finished jobs. Because of this, the data
stream that is created on the AS/400 system contains the control to
indicate that offset stacking should be used. If the spooled file is sent to a
system that does not support offset stacking, an error message may be
issued.
v Use of the DDS DRAWER and PAGRTT keywords cause the AS/400 to
generate an AFPDS datastream that is not completely supported by the
AFP viewer and some of the PSF products available on other IBM
platforms. If the spooled file needs to be viewed by the AFP viewer or
printed on other IBM platforms, do not use the DRAWER and PAGRTT
keywords in DDS. Use the INVMMAP keyword instead to change the
drawer or page rotation within the spooled file.

Special DDS considerations for AFPDS


AFP and Print Services Facility for OS/400 (PSF/400): To use advanced function
printing (AFP) support on the AS/400 server to print on IPDS printers, you must
install PSF/400.

Please see “Using Print Services Facility for OS/400 (PSF/400)” on page x for
information on when PSF/400 is required. If you have additional questions about
PSF/400, contact your IBM representative.

Following is a list of DDS keywords that are valid for printer files that have the
printer device type (DEVTYPE) parameter value specified as *AFPDS. Restrictions
on DDS keywords are contained in this list as well. For more detailed information
about DDS keywords, see the DDS Reference: Printer Files, part of the Database
and file systems topic in the iSeries 400 Information Center.

ALIAS HIGHLIGHT (Only applies to output printed


using a printer resident font. If a coded font
(CDEFNT) or a font character set and code
page combination (FNTCHRSET) is specified,
the HIGHLIGHT keyword is ignored and a
message issued.)
BARCODE IGCCDEFNT
BOX INDARA
| CCSID INDTXT

Chapter 2. Printer file support 119


CDEFNT INVMMAP
CHRID (Only applies to output printed LINE
using a printer resident font. If a coded
font (CDEFNT) or a font character set and
code page combination (FNTCHRSET) is
specified, the CHRID keyword is ignored
and a message issued.)
CHRSIZ MSGCON
COLOR (Color is ignored if your printer OVERLAY
does not support color printing.)
CVTDTA OUTBIN
DATE PAGNBR
DATFMT PAGRTT
DATSEP PAGSEG
DFT POSITION
DLTEDT PRTQLTY
DOCIDXTAG REF
DRAWER REFFLD
DTASTMCMD SKIPA (Not allowed at the file level in a
spooled file with printer device type *AFPDS.)
DUPLEX SKIPB (Not allowed at the file level in a
spooled file with printer device type *AFPDS.)
EDTCDE STRPAGGRP
EDTWORD TEXT
ENDPAGE TIME
ENDPAGGRP TIMFMT
FLTFIXDEC TIMSEP
FLTPCN TXTRTT
FONT UNDERLINE
FORCE ZFOLD
FNTCHRSET
GDF

Performance considerations
v For externally described printer files, the fewer the number of fields in a record,
the faster the processing of that record. Also, by putting several lines of text
within a record instead of each line as a separate record, system overhead
involved with the processing of each record is reduced.
v When coding the DDS for externally described printer files, define the fields in
sequential order. The output is not changed if fields are not defined in sequential
order, but the extra travel time of the printer head may be noticeable.
v For externally described printer files, specify a specific font or FONT(*CPI) on
the CRTPRTF, CHGPRTF, or OVRPRTF command instead of FONT(*DEVD). This
helps keep the data stream as small as possible.

120 OS/400 Printer Device Programming V5R1


v If a spooled file is intended to be printed on an IPDS printer configured
AFP(*NO), specify DEVTYPE(*IPDS) on the CRTPRTF, CHGPRTF, or OVRPRTF
command to avoid the extra system processing required to transform the data
stream from SCS to IPDS.
v If a spooled file is intended to be printed on an IPDS printer configured
AFP(*YES), specify DEVTYPE(*AFPDS) on the CRTPRTF, CHGPRTF, or
OVRPRTF command.
v When printing on an IPDS printer configured AFP(*YES), large spooled files
begin to print sooner if the print while convert (PRTCVT) parameter on the
printer device description is set to *YES. However, some printing may occur
before the syntax of the entire spooled file is checked. A data stream error may
be found after printing has started. This causes printing to end. If you want all
data stream syntax checking to complete before the spooled file starts printing,
set the print while convert (PRTCVT) parameter of the printer device description
to *NO.

Chapter 2. Printer file support 121


122 OS/400 Printer Device Programming V5R1
Chapter 3. Spool support
Spooling functions help system users to manage their printing operations more
efficiently. This chapter discusses:
v Overview: Spooling
v The elements you need to make spooling work
v Managing spooled files
– Using the Work with Spooled Files (WRKSPLF) command
– Restarting and controlling printing
– Spooled file security
– Controlling the number of spooled files in your system
– Redirecting spooled files
– Copying spooled files
– Sample commands for additional spooling support

Overview: Why spooling is important


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, by looking at the
printer file SPOOL parameter, determines whether the output is to be spooled.

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.

© Copyright IBM Corp. 1997, 2001 123


Spooling elements
Following is a list of spooling elements and a diagram showing their working
relationship. All of these elements must work together to produce, route, and print
spooled files. Following the list is information about each of these elements.
Application program
A high-level language program that creates a spooled file using a printer
file with the SPOOL parameter value set to *YES
Printer file
A description of the format of the output, and a list of attributes that
describe how the system should process the spooled file
Device description
A description of the printer
Output queue
An object that contains an ordered list of spooled files to be printed
Printer writer
A program that takes spooled files from an output queue and sends them
to a printer
Remote writer
A program that takes spooled files from a remote output queue and sends
them to a remote system.
Spooled file
A file containing spooled output records that are to be printed

Figure 1 shows the relationship of these spooling elements.

Application
Remote Program Printer
Writer Writer
Program Program

Printer
AS/400 File
MVS/VM Device
Printer
PS/2 Description
Other

Output Queue

Spooled Spooled Spooled Printed


File File File Output

RV3H046-0

Figure 1. Relationship of Spooling Elements

Application program
Application programs are the primary objects that produce spooled files on the
AS/400 system. All HLL (high-level languages) that can be used on the AS/400

124 OS/400 Printer Device Programming V5R1


system can make use of the spooling support by specifying SPOOL(*YES) in
whichever printer file the application uses.

Pressing the Print key runs a program that uses the QSYSPRT printer file to create
a spooled file that captures the image that was on the screen when the Print key
was pressed.

Printer file
Many attributes of the printer file used by the application program apply to the
spooled file and how the spooled file is processed by the system when the
application program ends. These attributes can be specified on the following
commands:
CHGPRTF
Change Printer File
CRTPRTF
Create Printer File
OVRPRTF
Override with Printer File

After a spooled file is created, its attributes can be displayed using the WRKSPLFA
command. Some attributes can be changed using the CHGSPLFA command

Printer device descriptions


Printer descriptions must be created for each printer that is or will be attached to
the system. Printer device descriptions are created using the Create Device
Description (Printer) (CRTDEVPRT) command or they can also be created
automatically by the system if automatic configuration is being used.

Note: Automatic configuration cannot be used for ASCII devices attached to the
ASCII workstation controller.

The printer file that an application program uses will require some of the
information that is contained in the printer device description. For example: the
printer file PRINTER parameter requires the same value as assigned to the printer
device description DEVD parameter.

Output queues
Batch and interactive job processing may result in spooled files that are to be sent
to a printer. These spooled files contain output records waiting to be printed. There
may be many spooled files for a single job.

When a spooled file is created, the file is placed on an output queue. Each output
queue contains an ordered list of spooled files. A job can have spooled files on one
or more output queues. All spooled files on a particular output queue should have
a common set of output attributes, such as printer device, form type, and lines per
inch. Using common attributes on an output queue reduces the amount of
intervention required and increases the printer throughput.

Output queue security


| Output queues are created with a level of security determined by the value of the
| AUT parameter on the Create Output Queue (CRTOUTQ) command. To work with
| the spooled files on that output queue, you must have the appropriate authority
| for that output queue (as specified in the AUT parameter). For example, holding or

Chapter 3. Spool support 125


| releasing a spooled file might require one level of authority while reading the
| contents of that spooled file might require a higher level of authority.

| For more information on spooled file and output queue security, see the Security
| topic in the AS/400 Information Center.

For more information on , see theSecurity topic in the AS/400 Information Center.

Output queue parameters


The following lists the parameters on the Create Output Queue (CRTOUTQ)
command and what they specify:
DSPDTA
Whether users without any special authority, but with *USE authority to
the output queue, can display, copy, or send the contents of spooled files
other than their own.
JOBSEP
How many, if any, job separator pages are to be placed between the output
of each job and the output of the next job when the output is printed.
OPRCTL
Whether a user having job control authority can control the output queue
(for example, if the user can hold the output queue).
DTAQ The name and library of the data queue associated with an output queue.
See “Data queue support on output queues” on page 131 for more
information.
MAXPAGES
The maximum spooled file size, in pages, that is allowed to print between
a starting and ending time of day.
LIB The name of the library in which the data queue resides.
SEQ Controls the order in which files are sorted on the output queue. See
“Order of spooled files on an output queue” on page 129 for more
information.
AUTCHK
Specifies what type of authority to the output queue is required for a user
to control the output queue (for example, to hold the output queue).
AUT Public authority.
RMTSYS
The name of the remote system to send spooled files to when a remote
writer (STRRMTWTR) is started to an output queue.
RMTPRTQ
The name of the printer queue on the remote system (RMTSYS parameter)
that the remote writer sends spooled files to.
AUTOSTRWTR
The number of remote writers that are automatically started by the system.
MSGQ
The qualified name of the message queue to which messages are sent
when created by a remote writer started to an output queue.
CNNTYPE
The type of connection used to communicate with the remote system.

126 OS/400 Printer Device Programming V5R1


DESTTYPE
The type of the remote system specified (for example, an AS/400 or a
PS/2).
TRANSFORM
Whether or not to use the host print transform function for SCS, or AFPDS
spooled files being sent to a remote system and printed on an ASCII
printer.
USRDTATFM
Specifies the name of the data transform program to be used by the driver
program.
SEPPAGE
Specifies whether or not to request a separator page when printing on a
remote system.
MFRTYPMDL
The manufacturer, type and model for a printer using the host print
transform function. This parameter is valid only if TRANSFORM is *YES,
or a user data transform program is specified.
WSCST
Name of the workstation customizing object and library. This parameter is
valid only if TRANSFORM is *YES, or a user data transform program is
specified.
INTNETADR
The name of the Internet address of the remote system.
CLASS
The VM/MVS SYSOUT class for spooled files being sent to a VM/MVS
system (*S390 value for the DESTTYPE parameter).
IMGCFG
The name of the image configuration for the output queue. For more
information about image configurations. See “Chapter 14. Working with the
image print transform function” on page 303.
FCB The name of the forms control buffer for spooled files being sent to a
VM/MVS remote system.
DESTOPT
Specifies the destination-dependent options. These options are specific to a
particular implementation of an LPD Print Server. When this parameter is
not specified, the Send TCP Spooled File (SNDTCPSPLF) command sends
only those options that are common to all LPD Print Servers.
When the destination is a Novell server, the text for a banner page can be
specified as BANNER='xxxxxxxxxxxx' where xxx can be up to 12 characters.
The word Banner must be in upper case, and no blanks should precede or
follow the ’=’ sign.
If you specify *NOWAIT, the remote writer does not wait for the
destination system to completely process the spooled file. This is only valid
when the Connection Type is *IPX or *SNA.
USRDFNOPT
Specifies one or more user-defined options to be used by user applications
or user-specified programs that process spooled files.
USRDFNOBJ
Specifies a user-defined object and type (*DTAARA, *DTAQ, *FILE,

Chapter 3. Spool support 127


*PSFCFG, *USRQ, *USRIDX or *USRSPC) to be used by user applications
or user specified programs that process spooled files.
USRDRVPGM
Specifies a user-specified driver program.
SPLFASP
Specifies the auxiliary storage pool (ASP) where the spooled files are to
reside.
TEXT Text description.

Summary of output queue commands


The following commands may be used to create and control output queues. For
detailed descriptions of the commands, see the CL Reference topic in the AS/400
Information Center.
CHGOUTQ
Change Output Queue: Allows you to change certain attributes of an
output queue, such as the sequence of the spooled files on the output
queue.
CLROUTQ
Clear Output Queue: Removes all spooled files from an output queue.
CRTOUTQ
Create Output Queue: Allows you to create a new output queue.
DLTOUTQ
Delete Output Queue: Deletes an output queue from the system.
HLDOUTQ
Hold Output Queue: Prevents all spooled files from being processed by the
printer writer.
RLSOUTQ
Release Output Queue: Releases a previously held output queue for
processing by the printer writer.
WRKOUTQ
Work with Output Queue: Shows the overall status of all output queues, or
the detailed status of a specific output queue.
WRKOUTQD
Work with Output Queue Description: Shows descriptive information for
an output queue.

Default output queues for printers


When a printer is configured to the system, the system automatically creates the
printer’s default output queue in library QUSRSYS. The output queue is given a
text description of 'Default output queue for printer xxxxxxxxxx', where
xxxxxxxxxx is the name assigned to the printer during configuration. The printer
name is specified in the device description (DEVD) parameter.

The AUT parameter for the output queue is assigned the same value as that
specified by the AUT parameter for the printer device description. All other
parameters are assigned their default values. Use the Change Command Default
(CHGCMDDFT) command to change the default values used when creating output
queues with the CRTOUTQ command.

128 OS/400 Printer Device Programming V5R1


The default output queue for a printer is owned by the user who created the
printer device description. In the case of automatic configuration, both the printer
and the output queue are owned by the system profile QPGMR.

Default output queues for system printer


The system is shipped with the defaults on commands to use the default output
queue for the system printer as the default output queue for all spooled output.
The system printer is defined by the QPRTDEV system value.

When a spooled file is created by opening a printer file and the output queue
specified for the file cannot be found, the system attempts to place the spooled file
on output queue QPRINT in library QGPL. If for any reason the spooled file
cannot be placed on output queue QPRINT, an error message is sent and the
output is not spooled.

The following output queues are supplied with the system:


QPRINT
Default printer output queue
QPRINTS
Printer output queue for special forms
QPRINT2
Printer output queue for 2-part paper

Creating your own output queues


You can create output queues for each user of the system. For example:
CRTOUTQ OUTQ(QGPL/JONES) TEXT('Output queue for Mike Jones')

Order of spooled files on an output queue


The order of spooled files on an output queue is mainly determined by the status
of the spooled file. A spooled file that is being processed by a writer may have a
status of printing (PRT status), writer (WTR status), pending to be printed (PND
status), or being sent (SND status). Spooled files with a status of PRT, WTR, PND,
or SND are placed at the top of the output queue. A spooled file being processed
by the writer may have a held (HLD) status if a user has held the spooled file but
the writer is not yet finished processing the file. All other spooled files with a
status of RDY are listed on the output queue after the file being processed by a
writer, followed by deferred spooled files (DFR status) and spooled files with a
status other than RDY or DFR.

Each group of spooled files (RDY and non-RDY files) is further sorted by:
1. The output priority of the spooled file.
2. A date and time field (time stamp).
3. The SCHEDULE parameter value of the spooled file. Files with
SCHEDULE(*JOBEND) specified are grouped together and placed after other
spooled files of the same job that have SCHEDULE(*IMMED) or
SCHEDULE(*FILEEND) specified.
4. The spool number of the spooled file.

For output queues with SEQ(*JOBNBR) specified, the date and time field is the
date and time that the job that created the spooled file entered the system. (A
sequential job number and time of day value are also assigned to the job when it
enters the system.) That is how the spooled files are sorted on the queue.

Chapter 3. Spool support 129


For first-in-first-out (*FIFO) output queues, the date and time change to the current
system date and time when:
v A spooled file is created by opening a device file.
v The output priority of the job that created the spooled file is changed.
v The status of the spooled file changes from non-RDY to RDY.

Note: The date and time do not change when the reason the status changes
from RDY to WTR or from WTR to RDY is because the writer was
canceled. Also, the date and time don’t change when the status changes
from RDY to DFR, or from DFR to RDY.
v A spooled file is moved to another output queue that has SEQ(*FIFO) specified.

Because of the automatic sorting of spooled files, different results occur when
SEQ(*JOBNBR) is specified for an output queue than when SEQ(*FIFO) is
specified. For example, when a spooled file is held and then immediately released
on an output queue with SEQ(*JOBNBR) specified, the spooled file will end up
where it started; but if the same spooled file were held and then immediately
released on an output queue with SEQ(*FIFO) specified, the spooled file would be
placed at the end of the spooled files that have the same priority and a status of
RDY.

Status of spooled files on an output queue


The status of spooled files, while they are on an output queue, can be determined
by running the Work with Output Queue (WRKOUTQ) command and looking at
the STS column. Following is a list of possible status’ and a description:
Ready (RDY)
The spooled file is available to be written.
Open (OPN)
The spooled file has not been completely processed and is not ready to be
selected by a writer.
Closed (CLO)
The spooled file has been completely processed by a program but
SCHEDULE(*JOBEND) was specified and the job that produced the spooled
file has not yet finished.
Deferred (DFR)
The spooled file has been deferred from printing. This status is based on the
values assigned to the maximum spooled file size (MAXPAGES) parameter on
the CRTOUTQ command. Spooled files will have this status only when a
writer is active to the spooled file’s output queue.
Held (HLD)
The spooled file has been held.
Saved (SAV)
The spooled file has been written and then saved.
Writer (WTR)
This spooled file is currently being written.
Sending (SND)
This spooled file is being or has been sent to a remote system. This status only
occurs if the remote system (RMTSYS) parameter value on the CRTOUTQ
command is something other than *NONE.
Pending (PND)
This spooled file is pending to be printed.

130 OS/400 Printer Device Programming V5R1


Printing (PRT)
This spooled file has been completely sent to the printer. However, print
complete status has not been sent back.
Message waiting (MSGW)
This spooled file has a message which needs a reply or an action to be taken.

Controlling printing from an output queue by spooled file size


The maximum spooled file size (MAXPAGES) parameter on the CRTOUTQ
command can be used to control printing of spooled files. This is accomplished
using three elements of the MAXPAGES parameter:
Spooled file size (pages)
Starting time
Ending time

Note: The starting and ending times must be specified using the 24 hour method
of measuring time. For example, 2:00 PM would be entered as 1400.

Assume you want to restrict spooled files with more than 40 pages from printing
between 0800 and 1600 on output queue MYOUTQ. However, between 1200 and
1300 you want to allow spooled files with 10 pages or less to print. Running the
following command implements these restrictions:
CHGOUTQ OUTQ(MYOUTQ) MAXPAGES((40 0800 1600) (10 1200 1300))

Note: You can specify up to 5 different combinations of pages and start/stop times
on the MAXPAGES parameter.

Data queue support on output queues


Support is available to optionally associate a data queue with an output queue
using the Create Output Queue (CRTOUTQ) or Change Output Queue
(CHGOUTQ) command. Entries are logged in the data queue when spooled files
are in ready (RDY) status on the output queue. A user program can determine
when a spooled file is available on an output queue using the Receive Data Queue
API (QRCVDTAQ) to receive information from a data queue. See the API
Programming Reference PDF in the Information Center for more information about
data queues and the QRCVDTAQ API.

Each time a spooled file on the output queue reaches RDY status an entry is sent
to the data queue. A spooled file can have several changes in status (for example,
ready (RDY) to held (HLD) to release (RLS) to ready (RDY) again) before it is
taken off the output queue. These status changes result in entries in the data queue
for a spooled file each time the spooled file goes to RDY status.

A spooled file can reach RDY status:


v When initially spooled on the output queue.
v When the spooled file is opened and the schedule parameter value is *IMMED.
v When a job completes and the spooled file schedule parameter value is
*JOBEND.
v When the spooled file is released.
v When a spooled file is moved to this output queue from another output queue.
v When a writer is ended immediately while printing a spooled file (the spooled
file status is reset from WTR to RDY).

Chapter 3. Spool support 131


| Environment variable QIBM_NOTIFY_CRTSPLF data queue
| support
| Using the ADDENVVAR or CHGENVVAR command, you can associate a data
| queue with a job or the system. As spooled files are created, the entries are logged
| in the data queue. Using the Receive Data Queue API (QRCVDTAQ) to receive
| information from the data queue, a user program can determine when a spooled
| file has been created by the job or by the system.

| Specifying data queues through the environment variable


| QIBM_NOTIFY_CRTSPLF: Using the CL command ADDENVVAR, and
| specifying a fully-qualified data queue name for the environment variable
| QIBM_NOTIFY_CRTSPLF, you can associate a data queue with a job or the system.

| The command use would be:


| ADDENVVAR ENVVAR(QIBM_NOTIFY_CRTSPLF)
| VALUE('*DTAQ <library name>/<data queue name>')
| LEVEL(*JOB | *sys)

| Once a data queue is associated with a job or the system, any spooled file created
| by the job or system will automatically have an entry placed in the data queue. For
| this action to occur, the user or user profile QSPL must have authorization to the
| data queue. For more information about data queues, see“Creating data queues”.

| Note: An environment variable that is specified at the job level takes precedence
| over the same environment variable specified at the system level.

| Creating data queues


| The Create Data Queue (CRTDTAQ) command is used to create the data queue.
| The maximum message length (MAXLEN) parameter value should be specified as
| at least 128 for a spool data queue entry record type of 01. The sequence (SEQ)
| parameter value should be *FIFO or *LIFO.

| The data queue for the spool data queue entry record type of 02, must be created
| with a record length of at least 144 bytes. It must also have a public authority of
| *USE, or grant QSPL user profile *USE private authorities to the data queue. You
| must ensure that the containing library has a public authority of *EXECUTE, or
| grant QSPL user profile *EXECUTE private authorities to the library. The format of
| the CRTDTAQ command is:
| CRTDTAQ DTAQ (<library name>/<data queue name>) MAXLEN(144) AUT(*USE)

| Specifying data queues on the CRTOUTQ and CHGOUTQ


commands
The CRTOUTQ and CHGOUTQ commands have a data queue (DTAQ) parameter,
which is used to specify the data queue name. An error occurs when using these
commands if the specified data queue does not exist or if the user creating or
changing the output queue does not have use authority to the data queue.

After a data queue is associated with an output queue, any spooled file that is
placed on the output queue in ready status causes an entry to be placed on the
data queue. The data queue entry is added regardless of the authority the user
generating the spooled file has to the data queue.

Working with data queues when errors occur


If the AS/400 system tries to add entries to a data queue that does not exist or has
an invalid length, the system continues with its processing but sends an
informational message to the QSYSOPR message queue. This message indicates

132 OS/400 Printer Device Programming V5R1


that there is a problem with the data queue and specifies the data queue name.
This message is sent the first time a specific problem occurs with the data queue of
an output queue. The message is sent once every 24 hours.

For example, if message X is received at 10:00 AM, it is logged in the QSYSOPR


message queue. If message X is received again at 10:30 AM, 11:00 AM, 1:00 PM, or
1:30 PM, it will not be logged. As you can see, the message will not be logged until
after 10:00 AM the next day, even if it continues to be received all day.

If after message X is logged at 10:00 AM, message Y is received at 2:00 PM,


message Y is logged. If message X is received again at 2:30 PM, message X will be
logged again even though it was logged earlier in the day.

The intent is not to log the same recurring message all day, but to inform the user
of each change of error messages associated with the data queue of a particular
output queue.

Managing data queue entries


| Changing the data queue of an output queue is allowed regardless of whether
| there are spooled files on the output queue. For data queue entries of record type
| 01, only spooled files that reach RDY status after the change will have entries on
| the data queue. Spooled files already having a status of ready on the output queue
| will not have entries on the new data queue.

It is the user’s responsibility to manage the data queues. These responsibilities


include creating, clearing, and deleting data queues.

When clearing all output queues during IPL, any associated data queues are not
cleared. If a damaged system output queue is found, it is re-created without any
associated data queue name. Damaged data queues are not re-created.

Record type 01 data queue entry format


+ Following is the format of a 01 data queue entry when a spooled file changes to
+ ready status on an output queue.
Table 6. Format of data queue entry for a spooled file
Decimal Offset Hex Offset Type Description
0 0 CHAR(10) Function

Identifies the function that created


the data queue entry. The value for a
spooled file is *SPOOL.
10 A CHAR(2) Record type

Identifies the record type within the


function. Valid values are:
01 A spooled file that is in
READY status has been
placed on the output queue.

Chapter 3. Spool support 133


Table 6. Format of data queue entry for a spooled file (continued)
Decimal Offset Hex Offset Type Description
12 C CHAR(26) Qualified job name

Identifies the qualified job name of


the job that created the spooled file
placed on the output queue.
CHAR(10)
Job name
CHAR(10)
User name
CHAR(6)
Job number

38 26 CHAR(10) Spooled file name

Identifies the name of the spooled


file placed on the output queue.
48 30 BINARY(4) Spooled file number

Identifies the unique number of the


spooled file placed on the output
queue.
52 34 CHAR(20) Qualified output queue name

Identifies the qualified name of the


output queue on which the spooled
file was placed.
CHAR(10)
Output queue name
CHAR(10)
Library of the output queue

72 48 CHAR(56) Reserved

Record type 02 data queue entry format


Following is the format of a DTAQ entry for creating a spooled file.
Table 7. Format of a data queue entry for creating a spooled file
Decimal Offset Hex Offset Type Description
0 0 CHAR(10) Function

Identifies the function that created


the data queue entry. The value for
a spooled file is *SPOOL.
10 A CHAR(2) Record type

Identifies the record type within the


function. Valid values are:
| 02 A spooled file has been
| created and placed on the
| output queue.

134 OS/400 Printer Device Programming V5R1


Table 7. Format of a data queue entry for creating a spooled file (continued)
Decimal Offset Hex Offset Type Description
12 C CHAR(26) Qualified job name

Identifies the qualified job name of


the job that created the spooled file
placed on the output queue.
CHAR(10)
Job name
CHAR(10)
User name
CHAR(6)
Job number

38 26 CHAR(10) Spooled file name

Identifies the name of the spooled


file placed on the output queue.
48 30 BINARY(4) Spooled file number

Identifies the unique number of the


spooled file placed on the output
queue.
52 34 CHAR(20) Qualified output queue name

Identifies the qualified name of the


output queue on which the spooled
file was placed.
CHAR(10)
Output queue name
CHAR(10)
Library of the output
queue

72 48 CHAR(26) Creating qualified job name

Identifies the qualified job name of


the job that created the spooled file.
CHAR(10)
Job name
CHAR(10)
User name
CHAR(6)
Job number

| 98 62 CHAR(10) User data

| Identifies the user specified data for


| the spooled file that was created.
| 108 6(C) BINARY(4) Thread ID

| Identifies the thread of the job that


| created the spooled file.

Chapter 3. Spool support 135


Table 7. Format of a data queue entry for creating a spooled file (continued)
Decimal Offset Hex Offset Type Description
| 112 70 CHAR(10) System name

| Identifies the name of the system on


| which the spooled file was
| generated.
| 122 7A CHAR(7) Creation date

| Identifies the date on which the


| spooled file was created in
| CYYMMDD format..
| 129 81 CHAR(6) Creation time

| Identifies the time that the spooled


| file was created in HHMMSS
| format.
| 135 87 CHAR(9) Reserved

Using multiple output queues


You may want to create multiple output queues for:
v Special forms printing
v Output to be printed after normal working hours
v Output that is not printed
An output queue can be created to handle spooled files that need only to be
displayed or copied to a database file. Care should be taken to remove
unneeded spooled files.
v Special uses
For example, each programmer could be given a separate output queue.
v Output of special IBM files
You may want to consider separate queues for the following IBM-supplied files:
– QPJOBLOG: You may want all job logs sent to a separate queue.
– QPPGMDMP: You may want all program dumps sent to a separate queue so
you can review and print them if needed or clear them daily.
– QPSRVDMP: You may want all service dumps sent to a separate queue so the
service representative can review them if needed.

Controlling multiple output queues


Controlling multiple output queues requires both finding where your output is and
determining how to print it if a writer is not started to the queue.

The Work with Spooled Files (WRKSPLF) command can be used to display all the
spooled files that you have created. This is an easy way to find your output if you
do not know the name of the output queue where it has been placed. The spooled
files are listed in the same order as they would be on a SEQ(*FIFO) output queue.
(See “Order of spooled files on an output queue” on page 129 for more
information.)

If you know the name of the output queue that contains the spooled file, the Work
with Output Queue (WRKOUTQ) command can be used to display the queue to
determine the position of the spooled files on that output queue.

136 OS/400 Printer Device Programming V5R1


The WRKOUTQ command also provides the option to display all the output
queues that exist on your system.

If a writer is not started to the output queue that contains the spooled file you
wish to print, you have several options in order to print the file:
v Use the Work with All Spooled Files (WRKSPLF) command and type 9 (Work
with printing status) next to your spooled file to find out Why it is not printing.
v Use the Change Spooled File Attributes (CHGSPLFA) command to move the
spooled file to an output queue that has a writer started to it.
v Select a printer that is not being used and use the Start Printer Writer
(STRPRTWTR) command to start a printer that will print the spooled files from
your output queue.
v Select a printer that is started to a different output queue and use the Change
Writer (CHGWTR) command to change the printer to print the spooled files
from your output queue.

If a writer is started to the output queue that contains the spooled file you want to
print, but the status of the spooled file is deferred (DFR status), you can do the
following:
v Use the Change Spooled File Attributes (CHGSPLFA) command to move the
spooled file to an output queue that has a value of *NONE specified for the
maximum spooled file size (MAXPAGES) parameter.
v Use the Change Writer (CHGWTR) command to change the printer to print the
spooled files from the output queue that has the MAXPAGES parameter value
specified as *NONE.

The Work with Writers (WRKWTR) command can be used to find a list of printers
attached to your system and to determine if the printer is active (started).

Output queue recovery


If a job that has produced spooled files is running when the job or system stops
abnormally, the files remain on the output queue. Some number of records written
by active programs may still be in main storage when the job ends and will be
lost. You should check these spooled files to ensure that they are complete before
you decide to continue using the files.

You can use the SPLFILE parameter on the End Job (ENDJOB) command to specify
if all spooled files (except QPJOBLOG) created by the job are to be kept for normal
processing by the printer writer, or if these files are to be deleted.

If an abnormal end occurs, the spooled file QPJOBLOG will be written at the next
IPL of the system.

If a printer writer fails while a spooled file is being printed, the spooled file
remains on the output queue intact.

Recovery of user-created output queues: If an output queue becomes damaged in


such a way that it cannot be used, you are notified by a message sent to the
system operator message queue. The message comes from a system function when
a printer writer or a job tries to put or take spooled files from the damaged queue.

A damaged output queue can be deleted using the Delete Output Queue
(DLTOUTQ) command, or it will be deleted by the system during the next IPL.

Chapter 3. Spool support 137


After a damaged output queue is deleted, all spooled files on the damaged output
queue are moved to output queue QSPRCLOUTQ in library QRCL. The move is
performed by the QSPLMAINT system job, which issues a completion message to
the QSYSOPR message queue when all spooled files have been moved.

After the damaged output queue is deleted, it can be created again by entering the
Create Output Queue (CRTOUTQ) command. Then, spooled files on output queue
QSPRCLOUTQ can be moved to the newly created output queue using the Change
Spooled File Attributes (CHGSPLFA) command.

Recovery of system-created output queues: If the output queue that was


damaged was the default output queue associated with a printer, the system
automatically re-creates the output queue when it is deleted.

This system-created output queue has the same public authority as specified for
the device and default values for the other parameters. After the system re-creates
the output queue, you should verify its attributes are correct or change them, if
necessary, using the Change Output Queue (CHGOUTQ) command.

When a damaged output queue associated with a printer is deleted and created
again, all spooled files on the damaged queue are moved to the re-created output
queue. This is done by the QSPLMAINT system job, which issues a completion
message to the QSYSOPR message queue when all spooled files have been moved.

Spooled file cleanup after an abnormal IPL


System spool cleanup starts immediately following an abnormal IPL. Spool
cleanup is done under the system job QSPLMAINT.

Spooled files on destroyed user-created output queues are moved to output queue
QSPRCLOUTQ in library QRCL. Spooled files on destroyed system-created output
queues are moved to the re-created output queues.

Cleanup also deletes spooled files that have data in a damaged database file in
library QSPL.

Printer writer program


A printer writer is an OS/400 program that takes spooled files from an output
queue and sends them to a printer. The spooled files on a particular output queue
remain stored in the system until the printer writer program assigns a printer to
the output queue.

More than one printer writer can be started to the same output queue (10 is the
limit). However, each writer name must be unique and of the same type (printer,
remote, or diskette).

The printer writer program takes spooled files, one at a time, from the output
queue, based on their priority. The printer writer program prints a spooled file
only if its entry on the output queue indicates that it has a ready (RDY) status. You
can display the status of a particular spooled file using the Work with Output
Queue (WRKOUTQ) command.

If the spooled output file has a ready status, the printer writer program takes the
entry from the output queue and prints the specified job and/or file separators,
followed by the output data in the spooled file. If the spooled file does not have a
ready status, the printer writer program leaves the entry on the output queue and
goes on to the next entry. In most cases the printer writer program continues to

138 OS/400 Printer Device Programming V5R1


print spooled files (preceded by job and file separators) until all spooled files with
a ready status have been taken from the output queue.
Notes:
1. The printer writer program uses the printer file QPSPLPRT. This printer file is
shipped with the system. It is set up for the printer writer program and should
not be changed or used for other applications.
2. If you run the CHGPRTF command to make all the IBM-supplied printer files
DBCS capable (CHGPRTF FILE(*all/*all) IGCDTA(*YES)), you must change the
IGCDTA parameter value for QPSPLPRT printer file back to *NO.

The AUTOEND parameter on the Start Printer Writer command determines


whether the printer writer program continues to wait for new spooled files to
become available to be printed, ends after printing one file, or ends after all
spooled files with ready status have been taken from the output queue.

The SEPDRAWER parameter on the Start Printer Writer (STRPRTWTR) and


Change Writer (CHGWTR) commands allows the job separators and file separators
to be printed on paper selected from a different drawer. Typically this is used to
print the separators on colored paper.

The INIT parameter on the STRPRTWTR command allows you to specify when to
initialize (send printer open time commands) to the printer..

The FORMTYPE parameter on the STRPRTWTR command allows several values


for the message option:
*INQMSG
This is the default value.
An inquiry message is issued if the spooled file has a form type that is
different from what is in the printer.
*INFOMSG
An informational message is issued when no spooled files of the specified
form type remain on the output queue.
*MSG Both the inquiry and informational messages are issued.
*NOMSG
No messages are issued.

These values are also supported on the Change Writer (CHGWTR) command.

Remote writer program


A remote writer is an OS/400 program that takes spooled output files from a
remote output queue and sends them to the specified remote system. The remote
writer, which is a system job, sends the spooled output files using SNADS or
TCP/IP. This function is known as remote system printing on the AS/400 system.
The Start Remote Writer (STRRMTWTR) command is used to initiate remote
system printing.

After the spooled output file is successfully sent to a remote system, it is deleted or
saved as determined by the SAVE spooled file attribute value.

More than one remote writer can be started to the same remote output queue (10 is
the limit). The actual number is specified in the remote output queue description.

Chapter 3. Spool support 139


However, each writer name must be unique and of the same type (printer, remote,
or diskette). See “Chapter 4. Remote System Printing” on page 159 for more
information on remote writers.

Using multiple printer writer support


Multiple printer writers can be started to one output queue. The limit is 10. This
support allows many printers (up to 10) to begin printing spooled output files
from the same output queue.

The multiple printer writer function supports work load balancing between
printers. It also provides backup for printed jobs running unattended. For example,
if one printer jams or runs out of paper the others continue to print spooled output
files from the associated output queue.

Locating your printed output


The user profile parameter, user options, has a value that allows notification of
when spooled files are sent, held, or printed. This value is *PRTMSG. The
notification is returned in various messages. The message number is different
depending on which writer command (Start Remote Writer (STRRMTWTR) or Start
Printer Writer (STRPRTWTR) command) was used.

When working with the Start Printer Writer (STRPRTWTR) command, message
CPI34B8 indicates that the spooled file printed successfully and on which printer it
printed. Message CPD34B9 indicates that the spooled file is being held. CPD34B9
also indicates which printer it would have printed on.

When working with the Start Remote Writer (STRRMTWTR) command, message
CPI34B7 indicates that the spooled file was sent successfully. Message CPD34B7
indicates the spooled file was not successfully sent.

Summary of writer commands for printing


The following commands may be used to work with the printer writer program.
For detailed descriptions of the commands, see the CL Reference topic in the
AS/400 Information Center.
STRPRTWTR
Start Printer Writer: Starts the printer writer program to assign an active
printer to an output queue. Spooled files on that output queue are printed
on the assigned printer.
This command also allows you to specify the message queue for printer
writer messages, which form types should be printed, number of file
separator pages, and the drawer for separator pages.
STRRMTWTR
Start Remote Writer: Starts a remote writer program to send spooled
output files from a remote output queue to a remote system.
This command also allows you to specify the message queue for remote
writer messages, which form types should be printed, and whether the
writer ends automatically.
CHGWTR
Change Writer: Allows you to change some printer writer program
attributes, such as form type, drawer for separator pages, number of file
separator pages, or output queue.

140 OS/400 Printer Device Programming V5R1


HLDWTR
Hold Writer: Temporarily stops a printer writer program at the end of a
record, at the end of a file, or at the end of a page.
RLSWTR
Release Writer: The printer writer program continues from the point at
which it was previously held.
ENDWTR
End Writer: Ends a printer writer program and makes the associated
printer device available to the system.

Using a printer for both spooled files and direct print jobs
The allow direct print function provides the capability of sharing a printer between
the printer writer and direct print jobs.

A printer writer sends spooled files to the printer from the output queue assigned
to that printer. When the SPOOL parameter value on the printer file is *YES,
output data is written to a spooled file and placed on an output queue.

When the SPOOL parameter value on the printer file is *NO, output data is written
directly to the printer. This is a direct print job.

Enabling the allow direct print function


To allow direct print jobs as well as spooled files for a printer, specify *YES as the
value on the allow direct print (ALWDRTPRT) parameter on the Start Printer
Writer (STRPRTWTR) command.

When *YES is specified, the printer writer releases the printer for direct print jobs
when either of the following conditions is true:
v The printer writer is held (STATUS(*HLD)).
v The output queue associated with the printer contains no spooled files waiting
to print.

The allow direct print function uses the maximum file-wait time specified in the
WAITFILE parameter in the printer file.

The default value for the WAITFILE parameter is *IMMED. However, the allow
direct print function requires some time to obtain access to the printer. Therefore, it
is recommended that 2 or 3 minutes be allowed for access to the printer.

Note: The WAITFILE parameter value must be calculated in seconds. For example,
a parameter value of 120 would allow a wait time of 2 minutes.

When choosing the value for the maximum file-wait time (WAITFILE) parameter
in the printer file, consider how busy is the printer that you want to use for your
direct print jobs?

If the value for the WAITFILE parameter is too small, a message is returned
indicating the specified printer could not be obtained. If you still need the job
printed, the job must be run again.

If the value for the WAITFILE parameter is too large, your sign-on session is
utilized waiting for the job to obtain the printer. You cannot use System Request to

Chapter 3. Spool support 141


end the direct print job. The job must be ended using the End Job (ENDJOB)
command. Using this command ends your sign-on session.

Modifying the start printer writer (STRPRTWTR) command


The STRPRTWTR command can be modified to allow all printers being started to
accept direct print jobs. Use the Change Command Default (CHGCMDDFT)
command and set the value for the allow direct print (ALWDRTPRT) parameter on
the STRPRTWTR command to *YES. Thereafter, when the STRPRTWTR command
is used, the allow direct print function is enabled.

Restrictions when using the allow direct print function


The Change Writer (CHGWTR) command cannot be used to enable the allow
direct print function.

The allow direct print function is not supported on printers configured for
advanced function printing. This means the advanced function printing (AFP)
parameter on the printer device description must be *NO.

Managing spooled files


When jobs that produce spooled files are running, they use specified printer files to
determine where the spooled files will go and what they will look like.

The spool support on the AS/400 system allows you to change the destination of
spooled files and to alter the appearance of a spooled file before actual printing
occurs. The Work with Spooled Files (WRKSPLF) command is the primary
command used for managing your spooled files.

Using the work with spooled files (WRKSPLF) command


By typing WRKSPLF on a command line you can display a list of your spooled
files similar to the example below.

The Work with All Spooled Files display shows you, in the Device or Queue
column, the name of the queue that the spooled file is currently in.

At the top of the display is a list of actions that can be performed on any spooled
file.

All of these actions (with the exception of Messages and Work with printing status)
can be performed using CL commands. The Work with All Spooled Files display
provides a convenient way for you to run these commands. When you use this
display, you do not have to remember the exact CL command name and the
spooled file attributes such as: name, number, and position in a particular output
queue.

| If you are using the WRKSPLF command, you can manage your spooled files by
| selecting one of the available options from the following list. This list provides the
| option, the associated CL commands, and an explanation of each option..
v Send — Send Network Spooled File (SNDNETSPLF) command
This option allows you to send the spooled file to another user on your system
or to a user in your network. Go to “Using the send option” on page 143 for
more information on using this option.
v Change — Change Spooled File Attributes (CHGSPLFA) command
This option allows you to change attributes of a spooled file.
v Hold — Hold Spooled File (HLDSPLF) command

142 OS/400 Printer Device Programming V5R1


This option allows you to stop the processing of a spooled file by a printer
writer.
v Delete — Delete Spooled File (DLTSPLF) command
This option allows you to remove the spooled file from the system.
v Display — Display Spooled File (DSPSPLF) command
This option allows you to display the contents of a spooled file.
v Release — Release Spooled File (RLSSPLF) command
This option allows the printer writer to process a previously held or saved
spooled file.
v Messages — No associated CL command
This option displays any messages associated with the spooled file.
v Attributes — Work with Spooled File Attributes (WRKSPLFA) command
This option allows you to change attributes that control how a spooled file will
look when it is printed. Go to “Using the attributes option” on page 145 for
examples of changing these attributes.
v Work with printing status — Work with Printing Status (WRKPRTSTS)
command
This option allows you to view the conditions that are preventing the spooled
file from printing. For examples on how to use this option, go to “Using the
work with printing status option” on page 147.

Using the send option


Selecting option 1 (Send) from the Work with All Spooled Files display allows you
to send a spooled file to another user on the system or to a user in a
communications network that your AS/400 system is linked to.
Notes:
1. The users to whom you want to send the spooled file must be in the system
directory. Also, if the user to whom you want to send the spooled file is a user
on another system, the name of that system must be in the system directory.
Use the Display Directory (DSPDIR) command to view the list of users and
systems in your communications network.
2. In most cases you will want to specify *ALLDATA as the value for the Data
format prompt. This will ensure that all the attributes of the spooled file are sent
with the file.

By choosing option 1 from the WRKSPLF display, the only information you have
to type to send the spooled file is the user ID and address.

Note: If your system is in a TCP/IP network, you can send and print spooled files
using the Send TCP/IP Spooled File (SNDTCPSPLF) command. For more
information, see “Sending and printing files with TCP/IP” on page 336.

Using the messages option


Selecting option 7 (Messages) from the Work with All Spooled Files display allows
you to view any system messages concerning a particular spooled file.

| If a spooled file does not start to print or finish printing, the reason could be that a
| message did not receive a response. Often, it is a check to make sure that the forms
| have the correct alignment or position in the printer. Answering these messages
| allows the job to start or continue printing.

Chapter 3. Spool support 143


Using the change option
Selecting option 2 (Change) from the Work with All Spooled Files display allows
you to change certain attributes of a spooled file. Below is a list that indicates
which of the spooled file attributes you can change using option 2.
Notes:
1. To find out the possible values you could specify for any of these attributes,
move the cursor under any of the attributes and press the Help key.
2. If the spooled file is already printing (status is WTR), only a subset of this list
of attributes can be changed.

The attributes included in the subset vary depending on the device type (*IPDS,
*SCS, *AFPDSLINE, *LINE, and *AFPDS).
| Printer
| Print sequence
| Form type
| Copies
| Restart printing
| Output queue
| Library
| File separators
| Page range to print:
| Starting page
| Ending page
| File becomes available
| Save file
| Output priority
| User data
| Align page
| Print quality
| Form feed
| Source drawer
| Print fidelity
| Print on both sides
| Form definition
| Library
| AFP characters
| Pages per side
| Page definition
| Library
| Front side overlay:
| Overlay
| Library
| Offset down
| Offset across
| Back side overlay:
| Overlay
| Library
| Offset down
| Offset across
| Constant back
| User defined object:
| Object
| Library
| Object type
| IPDS pass-through
| Font resolution

Example: To change the specified printer: Use option 2 from the Work with All
Spooled Files display by typing 2 next to the spooled file you want to work with.

The Change Spooled File Attributes display appears.

144 OS/400 Printer Device Programming V5R1


Type the name of the printer you want to specify for this spooled file.

Press the Enter key and you are returned to the Work with All Spooled Files
display.

You have now changed the specified printer for that spooled file.

Restrictions to changing spooled file attributes: Some attributes of a spooled file


cannot be changed based on the device type (DEVTYPE) of the spooled file.

The pages per side (MULTIUP), front overlay (FRONTOVL), and back overlay
(BACKOVL) attributes can only be changed if the DEVTYPE is *SCS or *IPDS.

The above attributes plus form feed (FORMFEED), print quality (PRTQLTY), and
print on both sides (DUPLEX) cannot be changed on spooled files created on the
AS/400 system with printer device type *AFPDS.

Using the attributes option


Selecting option 8 (Attributes) from the Work with All Spooled Files display allows
you to view a list of all the attributes of the specified spooled file.

You can also use the Work with Spooled File Attributes (WRKSPLFA) command to
change the attributes of a spooled file.

Initially, the attributes assigned to a spooled file are obtained from the printer file
that the application program used.

| You cannot change all of the attributes that are shown. To view the changeable
| attributes, press F13.

| You can also change the attributes in the Using the change option section by
| pressing F13.

| Note: The attributes included in the subset vary depending on the device type
| (*IPDS, *SCS, *USERASCII, *AFPDSLINE, *LINE, and *AFPDS).

| Device requirements
When you work with spooled file attributes, the device requirements shown in the
following table are displayed. The table shows the device requirements supported
on each printer.

Chapter 3. Spool support 145


Table 8. Supported Device Requirements
Printer
| 3112
| 3116
| 3812
| 3816 3130
| 3916 3160
| 3930 38201
| 4028 38251
| 4312 38271
| 4317 4230 38291
| 4324 4224 38311
| Info 4234-8 38351
| 3287 Print 4234-12 39001
1
| 4245 20 Info 4247 3935
| Device 5256 3812 Print 6400 Info Print

| Require- 5262 5224 3816 32 6408 3000 Info

| ment 6262 5252 4214 5225 4234-2 5219 SCS 55531 IPDS 6412 5583 Print 4000

Final Form X X X X X X X
Text
Variable X X X X X X
Font
Variable X X X X X X X X X
LPI
Variable X X X X X X X X
Drawer
Super/ X X X X X X
Subscript
Variable X X X X X X X X X
Character
ID
Highlight X X X X X
Extended X X X X X
3812 Fonts
Graphics X X X X
522X
Graphics X X X
4214
Graphics X X X
4234
Graphics X X X X
Barcodes X X X X
Variable X X X X
Page
Rotation
PC Printer X X X X X X X X X
Emulation
Defined X X X X X X
Characters
Variable X X X X X X X X
CPI

146 OS/400 Printer Device Programming V5R1


Table 8. Supported Device Requirements (continued)
Printer
| 3112
| 3116
| 3812
| 3816 3130
| 3916 3160
| 3930 38201
| 4028 38251
| 4312 38271
| 4317 4230 38291
| 4324 4224 38311
| Info 4234-8 38351
| 3287 Print 4234-12 39001
1
| 4245 20 Info 4247 3935
| Device 5256 3812 Print 6400 Info Print

| Require- 5262 5224 3816 32 6408 3000 Info

| ment 6262 5252 4214 5225 4234-2 5219 SCS 55531 IPDS 6412 5583 Print 4000

Transparency X X X X X X
IPDS X X X X
Transparent
Data
Field X X X
Outlining
AFP X X X
Resources
Rotated X X X
DBCS
Characters
Double- X X X
wide
Characters
1
System does not check device attributes for these printers, so all attributes are permitted. This does not guarantee
the spooled file will print correctly.

Using the work with printing status option


Selecting option 9 (Work with printing status) from the Work with All Spooled
Files display helps you find the reason Why a spooled file is not printing.

Type a 9 (Work with printing status) next to the spooled file that is not printing.

The conditions that may be preventing the spooled file from printing are
displayed.

Type a 2 (Change status) next to the condition you want to eliminate. With the
information shown in the Change Status window, you can take corrective action to
make the spooled file print. All of the conditions listed must be eliminated before
the spooled file will print.

If you need more information to eliminate the conditions, select option 5 (Display
detailed description) for an explanation of each of the conditions preventing the
spooled file from printing.

Chapter 3. Spool support 147


Restarting and controlling printing
In some cases, you may want to restart printing or control a spooled file while it is
being printed. For example:
v The system ended while a spooled file was being printed, or you want to print
only selected portions of a large spooled file.
You can use the Work with Spooled Files (WRKSPLF) command, the Work with
Output Queue (WRKOUTQ) command, or the Work with Job (WRKJOB)
command to see a list of spooled files. Type 2 (Change) next to the spooled
output file you want to work with and press the Enter key. The Change Spooled
File Attributes display appears.
Locate the Restart printing parameter and type *STRPAGE. Locate the Page range
to print parameter. This parameter has two parts: Starting page and Ending page.
Type the page number that you want the spooled file to start or resume printing
on and type the page number that you want that spooled file to stop printing
on.
v A spooled file needs to be printed immediately, but another file is currently
printing.
For example, assume spooled file A is currently printing. While A is printing,
you receive a request to have spooled file B printed immediately.
Use the Work with Spooled Files (WRKSPLF) command or Work with Output
Queue (WRKOUTQ) command to locate spooled files A and B.
Next to B, type 2 (Change) and press the Enter key. The Change Spooled File
Attributes display appears. Locate the Print sequence parameter. Change the
value of the Print sequence parameter to *NEXT and press the Enter key. This
moves B to the top of the output queue.
Next to spooled file A (currently printing and having a status of WTR), type 3
(Hold), move the cursor to the command line, and type OPTION(*PAGEEND).
Press the Enter key and A stops printing at the end of the current page.
This allows spooled file B to start printing.
When you are ready to finish printing spooled file A, type 2 (Change) next to A
and press the Enter key.
The Change Spooled File Attributes display appears. Locate the Print sequence
parameter. Change the value of the Print sequence parameter to *NEXT. Locate
the Restart printing parameter and change the value to *NEXT. File A is released
and will be the next spooled file to print, and the system will resume printing
with the page following the last page printed.
| v You want to be notified when a spooled file completes printing or is held by the
| printer writer program.
| You can specify *PRTMSG for the user option in your user profile to tell the
| system to notify you when your spooled file is being held by the printer writer
| or when printing is complete. Use the Create User Profile (CRTUSRPRF)
| command, the Change User Profile (CHGUSRPRF) command, or the Change
| Profile (CHGPRF) command, and look for the User option prompt (USROPT
| parameter). See the Security topic in the AS/400 Information Center for more
| information about these commands and the *PRTMSG value of the USROPT
| parameter.

Spooled file security


Spooled security is primarily controlled through the output queue that contains the
spooled files. In general, there are four ways that a user can become authorized to
control a spooled file (for example, hold or release the spooled file):

148 OS/400 Printer Device Programming V5R1


v User is assigned spool control authority (SPCAUT(*SPLCTL)) in the user profile.
This authority gives a user control of all spooled files in the output queues of all
libraries to which the the user has *EXECUTE authority. This authority should
only be granted to appropriate users.
v User is assigned job control authority (SPCAUT(*JOBCTL)) in the user profile,
the output queue is operator-controlled (OPRCTL(*YES)), and the user has
*EXECUTE authority to the library that the output queue is in.
v User has the required object authority for the output queue. The required object
authority is specified by the AUTCHK parameter on the CRTOUTQ command.
A value of *OWNER indicates that only the owner of the output queue is
authorized to control all the spooled files on the output queue. A value of
*DTAAUT indicates that users with *CHANGE authority to the output queue
are authorized to control all the spooled files on the output queue.

Note: The specific authorities required for *DTAAUT are *READ, *ADD, and
*DLT data authorities.
v A user is always allowed to control the spooled files created by that user.

For the Copy Spooled File (CPYSPLF), Display Spooled File (DSPSPLF), and Send
Network Spooled File (SNDNETSPLF) commands, in addition to the four ways
already listed, there is an additional way a user can be authorized.

If DSPDTA(*YES) was specified when the output queue was created, any user with
*USE authority to the output queue is allowed to copy, display, send, or move
spooled files. The specific authority required is *READ data authority.

If the user is authorized to control the file by one of the four ways already listed
above, using DSPDTA(*NO) when creating the output queue will not restrict the
user from displaying, copying, or sending the file. DSPDTA authority is only
checked if the user is not otherwise authorized to the file.

DSPDTA(*OWNER) is more restrictive than DSPDTA(*NO). If the output queue is


created with DSPDTA(*OWNER), only the owner of the spooled file (the person
who created it) or a user with SPCAUT(*SPLCTL) may display, copy, or send a file
on that queue. Even users with SPCAUT(*JOBCTL) on an operator-controlled
(OPRCTL(*YES)) output queue cannot display, copy, move, or send spooled files
they do not own.

See the See the Security topic in the AS/400 Information Center for details about
the authority requirements for individual commands.

To place a spooled file on an output queue, one of the following authorities is


required:
v Spool control authority (SPCAUT(*SPLCTL)) in the user profile. The user must
also have the *EXECUTE authority to the library that the output queue is in.
This authority gives a user control of all spooled files on the system and should
only be granted to appropriate users. If you have spool control authority you
can delete, move, hold, and release any spooled files on the system. You can also
change the attributes of any spooled file.
v Job control authority (SPCAUT(*JOBCTL)) in the user profile and the output
queue is operator-controlled (OPRCTL(*YES)). The user must also have the
*EXECUTE authority to the library that the output queue is in.
v *READ authority to the output queue. This authority can be given to the public
by specifying AUT(*USE) on the CRTOUTQ command.

Chapter 3. Spool support 149


Controlling the number of spooled files in your system
The number of spooled files in your system should be limited. When a job is
completed, spooled files and internal job control information are kept until the
spooled files are printed or canceled. The number of jobs on the system and the
number of spooled files known to the system increase the amount of time needed
to perform initial program load (IPL) and internal searches, and increase the
amount of temporary storage required.

The number of jobs known to the system can be displayed using the Work with
System Status (WRKSYSSTS) command.

You can use the Work with Spooled Files (WRKSPLF) command to identify
spooled files that are no longer needed. By periodically entering the command:
WRKSPLF SELECT(*ALL)

you can determine which spooled files are older than 6 or 7 days, and then delete
the spooled files or contact the users who created them.

For detailed information on minimizing the number of job logs (for example, by
using LOG(4 0 *NOLIST)), see the Control Language topic in the AS/400
Information Center. For information regarding the use of system values to control
the amount of storage associated with jobs and spooled files, see the Work
Management topic in the AS/400 Information Center.

Reclaiming empty spooled file members


When a spooled file has been deleted, all of the spooled file data has been erased.
However, an empty spooled file member still resides in auxiliary storage waiting to
be reused.

Having some empty spooled file members available for creating new spooled files
increases system performance. However, a large number of empty spooled files can
use large amounts of storage and decrease system performance. For example, each
spooled file member may take 16k of storage.

You can determine the balance you want to maintain between spool performance
and auxiliary storage use by setting the system value Reclaim Spool Storage
(QRCLSPLSTG) to a certain number of days. The default value for QRCLSPLSTG
is 8 days.

As an alternative, you can run the Reclaim Spool Storage (RCLSPLSTG) command
with the DAYS parameter set to *NONE to immediately reclaim all empty spooled
file members.
Notes:
1. System performance is degraded if QRCLSPLSTG is run and the DAYS
parameter value is 0.
2. The database member is immediately deleted after the deletion of a spooled
file. That means that there is no pool of unused members that can be used
when creating spooled files.

You can reclaim empty spooled file members by:


v Adjusting the value assigned to the Reclaim Spool Storage (QRCLSPLSTG)
system value.
v Using the Reclaim Spool Storage (RCLSPLSTG) command.

150 OS/400 Printer Device Programming V5R1


Example 1: Adjusting the QRCLSPLSTG system value
Let’s assume that one of your application programs had an error and it produced
hundreds of spooled files that were of no value to you. When this happened those
spooled files used lots of storage space on your system.

Change the QRCLSPLSTG system value to 1.

Delete all the unwanted spooled files that the application program created. Note
the time of day you deleted all the unwanted spooled files.

After 24 hours, provided the empty spooled file members are not reused, the
system reclaims the auxiliary storage that was being used by the empty spooled
files.

Example 2: Using the reclaim spool storage (RCLSPLSTG)


command
Let’s assume that one of your application programs had an error and it produced
hundreds of spooled files that were of no value to you. When this happened those
spooled files used lots of storage space on your system.

Delete all the unwanted spooled files that the application program created.

Run the RCLSPLSTG command with the DAYS parameter set to *NONE.

The system immediately reclaims all auxiliary spool storage that was being used
by the unwanted spooled files.

Reducing system ASP storage


You can reduce the amount of storage taken up by spooled files by moving or
creating spooled files directly into a user ASP. You can accomplish this by
specifying SPLFASP(*OUTQASP) when creating an output queue in a library that
is located in the desired user ASP.

All spooled files you place in this output queue will have the spooled file data
stored in the user ASP in a library QSPLxxxx where xxxx is the user ASP number.

| Note: The links to the job still reside on the system ASP. If the system ASP is lost,
| all spooled files, including those in the user ASPs, are lost. If a user ASP is
| lost, only spooled files in that user ASP are lost.

Spooled file names


When spooled files are created, the spooled file name is usually the same as the
name of the printer file that was used to create it. For example, if the Print key is
pressed the spooled file would be called QSYSPRT, because QSYSPRT is the printer
file used by the Print key operation.

There are several ways in which the spooled file could have a different name:
v The Override with Printer File (OVRPRTF) command was used and a name was
specified in the SPLFNAME parameter. For example, typing the following
command:
OVRPRTF QSYSPRT SPLFNAME(REPORT1)

causes the name of the spooled file to be REPORT1 instead of QSYSPRT.


v The OVRPRTF command was used and a different printer file is specified in the
TOFILE parameter. For example, typing the following command:

Chapter 3. Spool support 151


OVRPRTF QSYSPRT TOFILE(PRTF2)

causes the spooled file to be called PRTF2 (the name of the printer file specified
in the TOFILE parameter of the OVRPRTF command).
v Some IBM applications may create spooled files that have names different from
the printer files used to create them. Users have no control over spooled file
names in this situation.

Redirecting spooled files


You may want to move some of your spooled files to an output queue that has no
spooled files currently in it so that they will print sooner. To do this, enter the
WRKSPLF command and type a 2 (Change) next to each spooled file you want to
move. Press the Enter key and, in the OUTQ parameter, type the name of the
output queue you want each spooled file to go to.

File redirection occurs when a spooled file is sent to an output device other than
the one for which it was originally intended. File redirection may involve devices
that process different media (such as printer output sent to a diskette device) or
devices that process the same type of media but are of different device types (such
as 5219 Printer output sent to a 4224 Printer).

Depending on the new output device for the spooled file, the file may be printed
just as it would have been on the originally specified device. However, differences
in devices often cause the output to be formatted differently. In these cases, the
system sends an inquiry message to the message queue of the printer writer
program to inform you of the situation and allow you to specify whether you want
printing to continue.

Spooled files created by printing an OfficeVision/400 document should not be


redirected to a different output device than was originally specified in the Print
Options of the document. The document will not print correctly.

For more information about spooled file redirection, see “Redirecting output” on
page 112.

Copying spooled files


You can use the Copy Spooled File (CPYSPLF) command to copy a spooled file to
a physical file.

Note: If the data stream type is *USERASCII, *AFPDS, *AFPDSLINE, or *LINE,


(determined by the DEVTYPE parameter on the printer file) you cannot
copy the spooled file.

The original spooled file is not affected by the copy operation and can still be
printed by the printer writer program. You may want to copy a spooled file to a
database file for the following reasons:
v You may want to copy the spooled file to a physical file because there are no
commands to save spooled files on tape or diskette. However, if the system fails,
physical files are backed up and you can recover the data. You can use the spool
APIs to create your own save and restore operations for spooled files.
v You can save paper by having reports produced on microfiche instead of
printed.
v You can copy a report to a database file to be sent over communications lines for
printing at another location.

152 OS/400 Printer Device Programming V5R1


v You have collected information in a spooled file by running one of the system
display commands with OUTPUT(*PRINT) specified. The spooled file created by
this operation can be copied to a database file so that it can be read and
processed by the application program using it.

Note: If you use this method of gathering information, remember that the
system displays that you are spooling may change when new functions
are added to the system.
v You can copy the file to a spooled file so you can direct the same output to a
different output queue.
When copying spooled files to a database file, many device requirement
attributes of the spooled file cannot be copied. Most OfficeVision/400 documents
have device requirements such as variable lines per inch (LPI) and characters per
inch (CPI) that are not copied to a database file. If the database file is copied
back to the spooled file, the spooled file will not print the same as the original
file.

Selecting the control character (CTLCHAR) parameter


The CTLCHAR parameter determines which control code is produced by the Copy
Spooled File (CPYSPLF) command. You can select one of the following control
codes:
v *NONE: No print control characters are created. You can use this code, for
example, when printed displays (produced with the OUTPUT(*PRINT)
parameter) are to be read by an application program.
v *FCFC: The first character of every record contains one of the following
American National Standard control codes:
Code Action before Printing a Line
' ' Space one line (blank code)
0 Space two lines
- Space three lines
+ Suppress space
1 Skip to next channel 1
2 Skip to next channel 2
3 Skip to next channel 3
4 Skip to next channel 4
5 Skip to next channel 5
6 Skip to next channel 6
7 Skip to next channel 7
8 Skip to next channel 8
9 Skip to next channel 9
A Skip to next channel 10
B Skip to next channel 11
C Skip to next channel 12

Chapter 3. Spool support 153


You can use the first-character forms-control code to create microfiche with the
database file or print the spooled file with the Copy File (CPYF) command
(which allows spooled files to be printed using a first-character forms-control
printer file).
v *PRTCTL: The first 4 characters of every record contain skip-before and
space-before values. This code can be viewed as sssl where sss is the
skip-before line value (001 to 255) and l is the space-before value (0, 1, 2, or
3). When one part of the code is created by the CPYSPLF command, the other
part is blank. In the following examples,  represents a blank:
'005' Skip to line 5 before printing
'099' Skip to line 99 before printing
'1' Space 1 line before printing
'0' Do not space (or skip) before printing

You can use this control code when printing with an RPG/400 program if the
page size is not more than 99 lines long. To do this, move the control characters
into the RPG/400 program’s PRTCTL data structure space before and skip before
fields and then print line.

Note: Any skip to line values of 3 or less will actually be generated as space 1
line(s) to get to the correct line. For example; skip to line 2 would
generate a space 1 line to get to line 2.
v *S36FMT: Specifies that the format of the records copied to a database file is the
same as created by $UASF on System/36 for COPYPRT. Only spooled print files
can be copied when *S36FMT is specified. You can use this option when you
plan to send the spooled file to a System/36. You should copy to a database file
that has a record length of 150, 215, or 248. These are the valid record lengths for
a System/36 file.
The first record placed in the database file for each spooled file to be copied is a
heading record. Columns that are not defined are blank.

Table 9 and 10 describe the formats of the header and data records.
Table 9. Header record format
Beginning
Column Field Length Description
1 1 The letter H (to indicate the heading record).
| 4 6 The spool ID of the entry. Valid spool IDs range from SP0000 to SP9999, and from
| A00000 to Z99999.
12 8 The procedure name. This is blank if the file was not created by a procedure.
22 8 The job name. (The last 2 characters of the name are truncated.)
32 8 The user ID of the spooled file creator. (The last 2 characters of the ID are
truncated.)
42 8 The printer device file name. (The last 2 characters of the name are truncated.)
52 2 The System/36 printer ID that corresponds to the device the file is printed on.
The printer ID shown is the ID for the System/36 operating environment that
copies the file, not the environment that created the spooled file.
56 4 The forms identification. (This is the first 4 characters of the form type of the
spooled file.)
61 2 The number of copies (in binary).

154 OS/400 Printer Device Programming V5R1


Table 9. Header record format (continued)
Beginning
Column Field Length Description
65 2 The number of pages (in binary).
69 4 The number of records (in binary). This is the number of data records that follow
this heading record.
74 2 The number of lines per page (in binary).
78 1 The letter I if this entry contains print records with double-byte character set
data.
81 1 The letter M if this entry contains print records with a length greater than 132.
84 1 Lines per inch (in binary).
85 1 Characters per inch (in binary).
86 1 Font ID (in binary). The AS/400 printer file FONT parameter is converted to a
binary 1 field. The maximum font ID on System/36 OCL is 255; the AS/400
system supports font IDs above 255. Any time an AS/400 font ID above 255 is
used, this field is set to X'0B' for Courier 11 font. If you specify FONT(*CPI), the
field contains X'00'.
87 1 Justify. Valid values are X'00' (0%), X'32' (50%), and X'64' (100%).
88 1 Align. (Y means to align forms, N means not to align forms.)
89 2 The maximum length of the print lines in the spooled file that was copied.
92 10 The nontruncated user ID of the spooled file creator.
102 10 The nontruncated printer file name.
112 10 The nontruncated form type.
113 7 (Used internally by the system.)

The data records placed in the disk file for each copied spooled file have the
following format:
Table 10. Data record format
Beginning
Column Field Length Description
1 2 The page number (in binary).
3 2 The line number (in binary).
5 4 The record number (in binary).
9 1 The letter I if this print record contains double-byte character set data.
10 1 A double-byte character set shift-out character (hex 0E) if this print record starts
with double-byte character set data.
11 nnn The data to be printed. (The field length is the file record length minus 10. If the
print data is longer than the field length, it is truncated; and if it is shorter than
the field length, it is padded with blanks at the end.) The format of data may not
exactly match the format that would be produced on System/36 when multiple
prints are used to construct a single print line.

The 2-byte binary numbers are unsigned, which means that a page number of 65
535 is the largest page number in a heading record or data record. When the actual
number is larger, it will wrap beyond 65 535 to 0, then 1, 2, 3, and so on.

Chapter 3. Spool support 155


Selecting the channel value (CHLVAL) parameter
You can use the CHLVAL parameter on the CPYSPLF command to assign line
numbers for the different channels described above. This can only be specified if
*FCFC is specified for the CTLCHAR parameter. The same channel values that
were specified when the file was originally spooled should be specified when
using the CPYSPLF command.

Example of using control codes


To copy a spooled file named ORDERS in job NEWORDERS to database file
PRTORDERS so that you can use the CPYF command to print the database file,
type:
CPYSPLF FILE(ORDERS) JOB(NEWORDERS) TOFILE(PRTORDERS) CTLCHAR(*FCFC)

To print the data from the physical file, type:


OVRPRTF FILE(QSYSPRT) CTLCHAR(*FCFC) CHLVAL(*NORMAL)
CPYF FROMFILE(PRTORDERS) TOFILE(QSYSPRT)
DLTOVR FILE(QSYSPRT)

| Sample commands for additional spooling support


| You can define some functions to provide additional spooling support. Example
| source and documentation for the commands, files, and programs for these
| functions are part of library QUSRTOOL, which is an optionally installed part of
| the OS/400 program.

| Documentation about these commands can be found in library QUSRTOOL, file


| QATTINFO, and the following members:
| Member Name
| Name of Command
| TSRINFO
| Save Spooled File command
| TSRINFO
| Restore Spooled File command

| Descriptions of spooling commands in QUSRTOOL are:

| Save spooled file (ZSAVSPLF) sample command


| This command allows you to save a spooled file or a group of spooled files into a
| library and optionally save the library to a device.

| Restore spooled file (ZRSTSPLF) sample command


| This command allows you to restore spooled files from a library and optionally
| restore the library list from a device. The ZRSTSPLF command works only with
| spooled files saved using the ZSAVSPLF command.

Working with job and file separators


Separator pages are pages that separate one print job or spooled file from another.
Separator pages for print jobs (job separators) are specified on the output queue.
For each job having spooled files on the output queue, the specified number of
separator pages will print at the beginning of the printed output for each job.
Separator pages for spooled files (file separators) are specified on the printer file or
printer writer. The specified number of separator pages will print before each
spooled file.

156 OS/400 Printer Device Programming V5R1


| To print customized separator pages, for example, a banner separator page, specify
| a user exit program on the separator exit program (SEPPGM) parameter of the
| printer device description.

A sample exit program (in C and RPG) is in the QUSRTOOL library. See member
TBSINFO in file QATTINFO in library QUSRTOOL for information about this
sample exit program.

Using application program interfaces (APIs)


| There are several APIs that provide access to spooled files. Using these APIs, a
| program can copy a spooled file to a database without any loss of information. See
| the OS/400 APIs in the AS/400 Information Center for additional information
| about spool APIs.

Working with a QPRTJOB


A QPRTJOB job is a job that spooled files are associated with when the current
job’s user name is not the same as the user profile currently running. System jobs
can change to run under a user’s profile in order for a user to obtain ownership of
the spooled file instead of the system job. For example, if you send a spooled file
using the SNDNETSPLF command to user TINA on a different AS/400 system, the
file is spooled for job 999999/TINA/QPRTJOB. Spooling the file for this user’s job
instead of the system job makes sure that user TINA owns the spooled file. Then,
when she runs the WRKSPLF command, the spooled file sent to her is shown.

Note: Using SPLFOWN parameter allows you to specify who owns the spooled
file.

| QPRTJOB jobs are created automatically by the system. There may be more than
| one QPRTJOB per user on a system. A QPRTJOB has a default value of 9999
| spooled files. That number can be expanded to the maximum of 999,999 by
| changing the number in the QMAXSPLF system value. For more information about
| the QMAXSPLF system value, see the Work Management topic in the AS/400
| Information Center. When a user’s QPRTJOB gets full, the system automatically
| creates a new one for the user. A separate QPRTJOB is created for each user that
| receives spooled files sent by the SNDNETSPLF command. If you use the
| SNDNETSPLF command to send users TINA and KEVIN spooled files, there
| would be jobs named 999999/KEVIN/QPRTJOB and 999999/TINA/QPRTJOB on
| the receiving system.

QPRTJOB jobs are created and used by a variety of system functions. For example:
v Using the SNDTCPSPLF or SNDNETSPLF commands to send a spooled file to
another user on a different AS/400 system.
v Sending a spooled file from VM or MVS through a VM/MVS bridge to an
AS/400 system.
v Receiving a spooled file using TCP/IP or the line printer daemon (LPD) process.
v Using the QSPCRTSP Spool API to create a spooled file for another user.
v Using the QWTSETP Security API to set the user profile to a different user and
then create a new spooled file.
Other applications that are running can use the QSPCRTSP and QWTSETP APIs
resulting in additional QPRTJOB jobs on the system.
| v Using the SETGID API, you can create a spooled file for a different, current, or
| group user profile when SPLFOWN is set to *CURGRPPRF.

Chapter 3. Spool support 157


| v Using the SETUID API, you can set the user profile to a different user and then
| create a new spooled file for that user.

Cleanup of QPRTJOB jobs


QPRTJOB jobs continue to be reused until they have been inactive more than 24
hours. Inactive means all spooled files for the job have been deleted and no new
ones have been received for that user in more than 24 hours. The cleanup is done
by the system job QSPLMAINT.

158 OS/400 Printer Device Programming V5R1


Chapter 4. Remote System Printing
Remote system printing allows spooled files created on an AS/400 system to be
automatically sent to and printed on other systems.

The spooled output files are sent, from an output queue, using the Start Remote
Writer (STRRMTWTR) command. The STRRMTWTR command allows spooled
output files to be automatically sent to other systems using SNA distribution
services (SNADS) or Transmission Control Protocol/Internet Protocol (TCP/IP).

Information provided is:


v Definition of the remote system printing function
v Benefits of using this function
v User print information
v Spooled file attributes associated with remote system printing
v Status of spooled files being sent to remote systems
v Examples of how to use remote system printing between AS/400-to-AS/400,
AS/400 to VM or MVS, and AS/400 to PS/2.

Benefits of Using Remote System Printing


v Output queue placement.
Spooled files can be placed automatically on a specific output queue of a target
system. This support is provided through the Create Output Queue (CRTOUTQ)
and Start Remote Writer (STRRMTWTR) commands.
v Multiple remote writers increase throughput.
Output queues can have multiple remote writers started to them. This allows
multiple jobs to send spooled files simultaneously from one output queue.

Note: 10 remote writers can be started to one output queue.


v One-command interface
Once the environment (hardware and software) has been established, the Start
Remote Writer (STRRMTWTR) command initiates all activity necessary to send
spooled files to a remote system. An auto-start job entry exists in the QSPL
subsystem that starts a job automatically when the QSPL subsystem is started.
This job runs the STRRMTWTR command with the OUTQ parameter value set
to *ALL. Therefore, a remote writer(s) is started to all output queues that have a
remote system and a number of writers to autostart specified. Remote writers
are also started to a remote output queue when the remote output queue is
changed or a new one created.
v Distributed print routing with spooled file attributes
For distributed print routing, spooled file attributes are available. They are:
– User who created file
This attribute identifies the user who created the spooled file.
– System where file created
This attribute identifies the system on which the spooled file was created.
– User print information

© Copyright IBM Corp. 1997, 2001 159


This attribute is composed of the characters retrieved from the user-defined
text.
Once a spooled output file is created with user defined text, the text cannot
be changed. When the spooled output file is sent with the data format
parameter value of *ALLDATA, the user print information becomes an
attribute of the spooled file.
See “Working With User Print Information” on page 173 for more detail on
how to work with the display, retrieve, and change user print information
commands.
v Send (SND) and Defer (DFR) status’ for spooled output files
These status’ enable you to monitor the activity of spooled output files.
– SND
The spooled output file is being sent or has been sent to a remote system
– DFR
The spooled output file has been deferred from being sent

After spooled output files are successfully sent to a remote system (as best as
can be determined), they are deleted or saved, as specified by the save spooled
file attribute.

See “Send and Defer Status of Spooled Output Files” on page 174 for more detail
on the send and defer attributes of a spooled file.

How remote system printing works


The diagram below illustrates the remote system printing function. The key
commands in working with remote system printing are:
v Create Output Queue (CRTOUTQ)
v Start Remote Writer (STRRMTWTR)

An output queue is created to hold spooled output files. A remote output queue is
an output queue created for use in sending spooled output files to a remote
system. Several parameters on the CRTOUTQ command are required to do this.
When these parameters are given values, we then have a remote output queue. The
spooled output files on a remote output queue are sent by the remote writer(s)
started to the output queue. Remote writers are automatically started based on the
value specified on number of writers to autostart (AUTOSTRWTR) parameter. Or
they can be started using the STRRMTWTR command.

The STRRMTWTR command starts the writer that sends the spooled output files
on the remote output queue, to the remote system. The writer, which is a system
job, takes spooled output files from a remote output queue and sends them to a
remote system using SNADS or TCP/IP. The spooled output file can be sent to the
same user who owns the spooled output file being sent, a specific output queue, or
the output queue for the system printer on the target system. If the sending user
profile doesn’t exist on the target system, QNETSPLF user profile is used when
using SNADS.

Note: When spooled output files are sent to an AS/400 system at Version 2
Release 3 or less (or a system with the destination type of *OTHER and
using SNADS), the user profile to whom the spooled output files are being

160 OS/400 Printer Device Programming V5R1


sent must exist or be created on that target system.

The Role of the Create Output Queue (CRTOUTQ) Command


in Remote System Printing
The CRTOUTQ command has certain parameters that allow the Start Remote
Writer (STRRMTWTR) command to send spooled output files to remote systems.

The following parameters are important when working with remote system
printing. However, not all the parameters of the CRTOUTQ command are listed
here.
OUTQ
The qualified name of the output queue.
The name of the output queue can be qualified by one of the following library
values:
v *CURLIB
v Specific library name
The possible values are:
output queue name
The name of the output queue being created.
MAXPAGES
The maximum spooled file size in pages that is allowed to print between a
starting and ending time. If a spooled file exceeds the page limit it is deferred
(DFR status) until the ending time expires. For spooled files where the exact
number of pages is not known, the estimated number of pages (DSPSPLFA) is
used.
Notes:
1. You can specify up to 5 combinations of pages and starting and ending
times on the CRTOUTQ command.

Chapter 4. Remote System Printing 161


2. The method of time measurement used is the 24 hour clock. For example,
2:00 PM would be entered as 1400.
Possible values are:
*NONE
There is no limit on the size of spooled files allowed to print from this
output queue.

Element 1: Number of Pages


number-of-pages
The largest spooled file, in pages, that is allowed to print.

Element 2: Starting Time


starting-time
The time of day that the maximum spooled file size limit is to start.

Element 3: Ending Time


ending-time
The time of day that the maximum spooled output file size limit is to
end.
RMTSYS
The remote system to send spooled files to when a remote writer
(STRRMTWTR command) is started to the output queue. This is referred to as
the ’address’ by SNADS, and the ’host’ by TCP/IP. The possible values are:
*NONE
The output queue is used only for local printing. The STRRMTWTR
command cannot be used when this output queue is specified for the
OUTQ parameter.
*PASTHR
The system a user passed through from (STRPASTHR command) is
used when sending spooled files created by the user job. If a spooled
file was not created by a job that had passed through from another
system, the spooled file will be held (HLD
*INTNETADR
The INTNETADR parameter is used to identify the system when a
remote writer is started to the output queue. This value is valid only
when *IP has been specified for the CNNTYPE parameter. status).
IMGCFG
The IMGCFG parameter is used to enable the image print transform
function. For more information about image configurations. See
“Chapter 14. Working with the image print transform function” on
page 303.
*NWSA
The RMTPRTQ parameter is used to identify the system when a
remote writer is started to the output queue. This value is valid only
when *IPX has been specified on the Connection type (CNNTYPE)
parameter.
remote system name
The name of the remote system. Only the first 8 characters are used
when the connection type (CNNTYPE) parameter is specified as *SNA.

162 OS/400 Printer Device Programming V5R1


RMTPRTQ
The printer queue on the remote system to which the remote writer sends
spooled files. This RMTSYS parameter identifies the remote system.
*USER
The user profile that creates a spooled file on the source system is also
the user ID that the spooled file is sent to on the target system. This
value is valid only when the CNNTYPE parameter is *SNA.
*SYSTEM
The default system printer on the remote system determines the
printer queue. This value is valid only when the CNNTYPE parameter
is *SNA.
printer queue name
The name for the printer queue on the remote system. For remote
systems that are AS/400 systems, this is the name of an output queue
that the spooled file is created on. For remote systems that are not
AS/400 systems, this name is system-dependent. The name can be
either the actual name of the device or the name of a printer queue.
For AS/400 systems, the output queue is usually specified as library
name/output queue name. When the CNNTYPE parameter value is
*SNA and the library name qualifier is not specified, the library list of
the user on the target system is searched for the specified output
queue. When the CNNTYPE parameter value is *IP, the QUSRSYS
library is searched

The following table identifies the remote output queue on the target system
that receives the spooled output files depending on the value of the RMTPRTQ
parameter.
Table 11. Remote Printer Queue (RMTPRTQ) Values and Destination Type (DESTTYPE) Values
Remote Printer Queue (RMTPRTQ)
Destination Type
(DESTTYPE)1 *USER *SYSTEM Printer queue name
*OS400 File sent to user ID File sent to user ID File sent to user ID
QNETSPLF. File then QNETSPLF. File then QNETSPLF. File then
spooled to the default spooled to the output queue spooled to the output queue
output queue of the original of designated system specified by the printer
owner of the file. If the user printer (QPRTDEV). File is queue name. File is owned
profile of the original owner owned by a user profile by a user profile with the
doesn’t exist on the target with the same name as the same name as the original
system, the file is spooled original user profile owner user profile owner of the
to the default output queue of the spooled file. If this spooled file. If this user
for user profile QNETSPLF. user profile is not found, profile is not found, the
the QNETSPLF user profile QNETSPLF user profile is
is used. used.
*OS400V2 File sent to the file owners Not Allowed The printer queue name is
user ID on the target assumed to map to a user
system. File spooled to that ID on the target system.
user ID’s default output The file is sent to this user
queue. If the sending user ID and spooled to the user
ID doesn’t exist on the ID’s default output queue.
target system, an error is
returned to the source
system.

Chapter 4. Remote System Printing 163


Table 11. Remote Printer Queue (RMTPRTQ) Values and Destination Type (DESTTYPE) Values (continued)
Remote Printer Queue (RMTPRTQ)
Destination Type
(DESTTYPE)1 *USER *SYSTEM Printer queue name
*S390 File sent to the file owners File sent to the system Sent to remote printer
user ID on the target printer. queue name specified
system.
Other (OS/400 V1, S/36, File sent to the file owners Not Allowed The printer queue name is
S/38) user ID on the target assumed to map to a user
system. File spooled to that ID on the target system.
user ID’s default output The file is sent to this user
queue. If the sending user ID and spooled to the user
ID doesn’t exist on the ID’s default output queue.
target system, an error is
returned to the source
system.
1
Note: These connections, to the destination (or target system), are all through SNA.

AUTOSTRWTR
The number of remote writers that are started automatically by the source
system. For user-created output queues with the remote system (RMTSYS)
parameter specified as *NONE, this parameter is ignored.
1 For system-created default printer output queues, this value is
specified as 1 when the output queue is created.
*NONE
No writers are auto-started by the system to this output queue.
number of writers
The number of writers, between 1 and 10, to be auto-started to this
output queue.
MSGQ
The qualified name of the message queue to which messages created by the
remote writer started to this output queue are sent.
The name of the message queue can be qualified by one of the following
library values:
v *LIBL
v *CURLIB
v Specific library name
Possible values are:
QSYSOPR
Messages are sent to the QSYSOPR message queue.
message queue name
The name of the message queue to which messages created by the
remote writer are sent.
CNNTYPE
The type of connection with the remote system. This parameter determines the
protocol used by the remote writer when sending spooled files. Possible values
are:
*SNA Spooled files are sent using SNADS. This is similar to the Send
Network Spooled File (SNDNETSPLF) command and requires that
SNADS be configured.

164 OS/400 Printer Device Programming V5R1


*IP Spooled files are sent using TCP/IP. This is similar to the Send TCP/IP
Spooled File (SNDTCPSPLF) command and requires that the TCP/IP
product is installed. TCP/IP must also be installed on the target
system.
*IPX The spooled files are sent by using IPX.
*USRDFN
The spooled files are sent by using a user-defined connection.

The following table summarizes the valid combinations between the


connection type (CNNTYPE) and the destination type (DESTTYPE) parameters.
Table 12. Valid combinations of CNNTYPE and DESTTYPE
Connection Type (CNNTYPE)
Destination Type
(DESTTYPE) *SNA *IP *IPX *USRDFN
*OS400 X X N/A X
*OS400V2 X N/A N/A X
*PSF2 N/A X N/A X
*S390 X N/A N/A X
*NETWARE3 N/A N/A X X
*NDS N/A N/A X X
*OTHER (OS/400V1, X X N/A X
S36, S38)

DESTTYPE
The type of the remote system (RMTSYS) parameter. This parameter, along
with the type of data contained in the spooled file (DEVTYPE parameter on
the CRTPRTF command), is used by a remote writer to determine the format
used to send the spooled file.
The spooled file is held by the remote writer if the type of data in the spooled
file is not supported by the system. Possible values are:
*OS400
When the connection type (CNNTYPE) has been specified as *SNA,
spooled files are to be sent to an AS/400 system running OS/400
version 3 or later. *OS400 can be specified for all releases which
support the SNDTCPSPLF command (version 2 release 3 and later)
when CNNTYPE is *IP or *USRDFN.

Note: This value should be specified when possible. It allows the


greatest flexibility when selecting values for other parameters.
*OS400V2
Spooled files are to be sent to an AS/400 system running OS/400
version 2. This value is only valid when CNNTYPE is *SNA or
*USRDFN.
*S390 Spooled files are to be sent to S/390 system. This value is only valid
when CNNTYPE is *SNA or *USRDFN.
*PSF2 The spooled files are to be sent to a personal computer running the
PSF for OS/2 product. This value is valid only when the CNNTYPE is
*IP or *USRDFN.

Chapter 4. Remote System Printing 165


*NETWARE3
The spooled files are sent to NETWARE3. This value is only valid
when the CNNTYPE is *IPX or *USRDFN.
*NDS The spooled files are sent to NETWARE4. This value is only valid
when the CNNTYPE is *IPX or *USRDFN.
*OTHER
Spooled files are to be sent to a system not matching any of the other
special values. This includes AS/400 systems running OS/400 version
1, as well as System/36 and System/38.
CLASS
The VM/MVS SYSOUT class for spooled files sent to a VM or MVS host
system.

Note: This parameter is valid only when CNNTYPE(*SNA) and


DESTTYPE(*S390) are specified.
A The class is A.
class value
Distribution class value. Valid values range from B through Z and 0
through 9.
FCB
The FCB (forms control buffer) for spooled output files sent to a VM or MVS
host system.

Note: This parameter is valid only when CNNTYPE(*SNA) and


DESTTYPE(*S390) are specified.
*NONE
No FCB is used when sending files.
*USRDTA
The first 8 characters of the user data (USRDATA) spooled file attribute
determines the name of the FCB. If the user data is blank, no FCB is
used.
*PRTF The first 8 characters of the printer file used to spool the spooled file
determines the name of the FCB.
FCB name
The name of the forms control buffer to be used.
TRANSFORM
Whether or not to use the host print transform function to transform a spooled
file of device type *SCS or *AFPDS into ASCII data when the spooled file is
sent by a remote writer.

Note: This parameter is valid only when the CNNTYPE parameter is *IP, *IPX,
or *USRDFN.

Possible values are:


*YES Transform SCS or AFPDS data streams into ASCII.
*NO Do not transform SCS or AFPDS data streams in ASCII.
USRDTATFM
Specifies the qualified name of a user data transform program that is used to
transform the spooled file data. The possible values are:

166 OS/400 Printer Device Programming V5R1


*NONE
No user-defined data transform program is specified.
name Specifies the name of the transform program. It can be qualified by one
of the following library values:
*LIBL All libraries in the job’s library list are searched until the first
match is found.
*CURLIB
The current library for the job is searched. If no library is
specified as the current library for the job, the QGPL library is
used.
Library-name
Specifies the library to be searched.

Note: The user data transform program is only valid when the remote system
value is not *NONE. This parameter is not valid when
TRANSFORM(*YES) is specified.
MFRTYPMDL
The manufacturer, type, and model for a printer using the host print transform
function.
This parameter is only valid when TRANSFORM(*YES) or a user data
transform program is specified. The possible values are:
*IBM42011
The IBM 4201-1 Proprinter* is used.
*WSCST
The value of the WSCST parameter is used.
manufacturer-type-model
The manufacturer, type, and model for a printer using the host print
transform function.

Note: Prompting (F4) for this parameter shows many printers that can
be used as a value for this parameter.
WSCST
An object that consists of a table of attributes used to customize a given ASCII
device, such as a workstation or printer. Character presentation, font
specifications, and control key sequences are examples of characteristics that
can be customized.
This parameter is only valid when TRANSFORM(*YES) or a user data
transform program is specified. Possible values are:
*NONE
Do not specify a workstation customizing object.
The name of the workstation customizing object can be qualified by
one of the following library values:
v *LIBL
v *CURLIB
v Specific library name
workstation-customizing-object
A valid workstation customizing object which has been created with
the Create Work Station Customizing Object (CRTWSCST) command.

Chapter 4. Remote System Printing 167


DESTOPT
Specifies destination-dependent options.
Specifying CNNTYPE(*IP), adds the options that are listed below to the control
file that is sent to the LPD server. Specifying CNNTYPE(*IPX), indicates
whether the AS/400 should track the spooled file on the destination system’s
printer queue until processing is complete. For CNNTYPE (*SNA), DESTTYPE
(*OS400), or DESTTYPE (*OS400V2), the destination option indicates whether
the AS/400 should wait for confirmation from the destination system. The
possible options and their values are:
*NONE
No destination option specification.
*USRDFNTXT
The user-defined text of the user profile at the spooled file creation.
When you specify CNNTYPE(*IPX) or CNNTYPE(*SNA), this value is
ignored.
*NOWAIT
When specifying CNNTYPE(*IPX) or CNNTYPE(*SNA), once the
spooled files are sent, the AS/400 system will no longer keep track of
them.

Destination options specifiy destination-dependent options.


INTNETADR
The internet address of the remote system to which the print request is sent.
This parameter is only valid when *INTNETADR is the value for the RMTSYS
parameter and *IP or *USRDFN is the value for the CNNTYPE parameter.
Possible values are:
internet-address
The internet address is specified in the form nnn.nnn.nnn.nnn, where
nnn is a decimal number ranging from 0 through 255. (An internet
address having all binary ones or zeros in the bits of the network or
host identifier portions of the address is not valid.)
USRDFNOPT
Specifies one or more user-defined options to be used by user applications or
user-specified programs that process spooled files. The possible values are:
*NONE
No user-defined options are specified.
user-defined-option
User-defined option to be used by user applications or user-specified
programs that process spooled files.
USRDFNOBJ
Specifies a name or type of the user-defined object to be used by user
applications or user-specified programs that process spooled files. The possible
values are:
*NONE
No user-defined objects are specified.
Element 1: Name of user-defined object
The name of the user-defined object can be qualified by one of the
following library values:

168 OS/400 Printer Device Programming V5R1


*LIBL All libraries in the job’s library list are searched until the first
match is found.
*CURLIB
The current library for the job is searched. If no library is
specified as the current library for the job, the QGPL library is
used.
Library-name
Specifies the library to be searched.
Object name
User-defined object to be used by user applications or
user-specified programs that process spooled files.
Element 2: Type of user-defined object
The user object type can be one of the following:
v *DTAARA - Data Area
v *DTAQ - Data Queue
v *FILE - File
v *PSFCFG - PSF Configuration Object
v *USRIDX - User index
v *USRQ - User Queue
v *USRSPC - User Space
USRDRVPGM
Specifies the name of the user-specified driver program. The possible values
are:
*NONE
No driver program is specified.
name Specifies the name of the user driver program. The name of the driver
program can be qualified by one of the following library values:
*LIBL All libraries in the job’s library list are searched until the first
match is found.
*CURLIB
The current library for the job is searched. If no library is
specified as the current library for the job, the QGPL library is
used
library-name
Specifies the library to be searched.
User driver program name
User-specified driver program to process spooled files.

Note: The user driver program is only valid when the remote
system value is not *NONE.

Role of the Start Remote Writer (STRRMTWTR) Command


When Using Remote System Printing
The Start Remote Writer (STRRMTWTR) command starts a spooling writer that
sends spooled output files from an output queue on a source system to a remote
system (target system).

Chapter 4. Remote System Printing 169


Note: When the spooled output file is composed of an AFPDS data stream that
uses AFP resources (for example, page segments or overlays), those
resources must exist on the target system if they are to be included in the
printed output. The AS/400 system does not insert them into the spooled
output file before sending the spooled output file to the target system. This
applies only if you are not transforming the spooled file using the host print
transform function.

More than one writer can be active at the same time (as determined by the
spooling subsystem description). Up to 10 writers can be active to the same output
queue. Each writer must have a unique writer name, and only one type (printer,
remote, or diskette) of writer can be active to a single output queue. A writer that
is started can be actively sending spooled files or waiting for a spooled file to be
put on the output queue. Optionally, the writer can end automatically when it has
processed all the spooled files on the output queue. You can also change, hold, or
cancel the writer.

The following table shows the data format of the spooled file that is sent to the
destination system when the connection type is *SNA.
Table 13. Connection Type (CNNTYPE) *SNA
Data Format
Destination Type (CNNTYPE) *ALLDATA *RCDDTA
*OS/400 All device type
*OS/400 V2 All device type
*OTHER (OS/400 V1, S/36, S/38) All device type
*S390 *LINE, *AFPDSLINE, *AFPDS *USRASCII, *IPDS, *SCS

Note: All device type includes *LINE, *AFPDSLINE, *AFPDS, *USRASCII, *IPDS,
and *SCS.

You can continue with other work after starting a writer because each job runs
independently. The writer is owned by the user who issues the STRRMTWTR
command. The following are the parameters and values for the STRRMTWTR
command:
OUTQ
The qualified name of the output queue. Possible values are:
*ALL Remote writers are started for every output queue on the system
which has a remote system (RMTSYS parameter value) specified.
The number of writers started to a particular output queue is
determined by the value specified on the AUTOSTRWTR parameter of
the CRTOUTQ command.
No writer is started if an output queue already has the number of
writers to autostart started or a different type of writer (diskette or
printer) is started to the output queue.
The name of the output queue can be qualified by one of the following
library values:
v *LIBL
v *CURLIB
v Specific library name

170 OS/400 Printer Device Programming V5R1


Output queue name
The output queue name from which the printer writer processes
spooled files.
output-queue-name
The output queue from which the printer writer processes spooled
files.
WTR
The spooling writer being started. Each writer name must be unique. Possible
values are:
*OUTQ
The name of the writer is the same as that of the output queue
specified on the OUTQ parameter. If the output queue has been
specified as *ALL and the number of writers to autostart is greater
than 1, the writer name is generated by taking the first nine characters
of the output queue name and appending a successive numeric
character (2 through 0) to it.
*SYSGEN
The writer name is generated by the system, starting with
’RMTW000001’ and incrementing the numeric part for each successive
writer.
Writer name
The name by which the writer being started is identified.
MSGQ
The qualified name of the message queue to which messages created by the
writer are sent. Possible values are:
*OUTQ
Messages are sent to the message queue specified in the output queue
of the output queue named on the OUTQ parameter.
*REQUESTER
The messages are sent to the message queue of the user who started
the writer. If this value is specified for a batch job, *OUTQ is used.
The name of the message queue can be qualified by one of the
following library values:
v *LIBL
v *CURLIB
v Specific library name
Message queue name
The message queue name to which messages created by the writer are
sent.
AUTOEND
Specifies whether the writer ends automatically.
*NO The writer does not end when the last available spooled file has been
removed from the output queue. It waits for another spooled file entry
to be put on the queue.
Element 1: Ending a Writer Automatically
*YES The writer automatically ends after it has reached the state specified on
Element 2 of this parameter (*NORDYF or *FILEEND).
Element 2: Ending a Writer with a Ready File

Chapter 4. Remote System Printing 171


*NORDYF
The writer automatically ends when there are no ready spooled files
(all the available spooled files have been removed from the output
queue).
*FILEEND
The writer ends after it finishes processing one spooled file.
FORMTYPE
The name of the form type. The writer uses this value to select spooled files
from the specified output queue for sending to a remote system.

Note: A spooled file’s form type is specified in the device file that produced
the spooled file.
This is important because the output queue can contain spooled files with
many different form types. Only the spooled files with the specified form type
are sent; others wait on the output queue.

Communication with the remote system is important to determine which form


types their system supports. When the form type is known, the spooled files
can be created with the desired form type. You could also use the Change
Spooled File Attributes (CHGSPLFA) command. However, this is not as
effective as creating the spooled files with the needed form type.

Element 1: Type of Form Designation

Possible values are:


*ALL All form types are processed by the writer.
*FORMS
Available spooled files on the output queue with the same form type
are processed as a group before the writer moves on to the next form
type group. The writer first chooses the first available spooled file on
the output queue.
After the first spooled file is complete, all spooled files with the same
form type are processed. The writer again chooses the first available
spooled file on the output queue and repeats the process for that form
type.
*STD Only spooled files that specify the standard form type are selected.
Form type
The form type of the spooled files being produced.

Element 2: Message Sending Options

Note: The message sending options are most effective when the source system
is able to send the spooled files directly to a printer queue on the target
system.
*NOMSG
Neither an inquiry message nor an informational message is sent to the
message queue.
*INQMSG
An inquiry message is sent to the message queue when a spooled file
has a form type that is different than the form type last sent.

172 OS/400 Printer Device Programming V5R1


*INFOMSG
An informational message is sent to the message queue when no
spooled files requiring this form type remain in the output queue.
*MSG An inquiry message is sent to the message queue when a spooled file
has a form type that is different than the form type in the remote and
an informational message is sent when no spooled files requiring this
form type remain in the output queue.

Working With User Print Information


User print information is made up of user-defined text associated with a user. The
user-defined text is saved with the spooled file when the spooled file is created. It
can be displayed using the Display Spooled File Attributes (DSPSPLFA) command
or retrieved using the Retrieve User Print Information (RTVUSRPRTI) command.

User print information is not used when sending spooled output files to another
AS/400 or S/3X system. It is used only as information to pass to the VM/MVS
bridge customer user exit to aid in setting the Network Job Entry (NJE) header
fields.

It’s possible for a system administrator to limit users access by revoking public
authority to the particular commands.

User print information can be used any way you want. For example, it could
consist of printout distribution information or be used for accounting information
(department to charge for printing).

User print information is worked with using the Change User Print Information
(CHGUSRPRTI), Display User Print Information (DSPUSRPRTI), and Retrieve User
Print Information (RTVUSRPRTI) commands.

Using the CHGUSRPRTI Command


There is no command that allows creation of user print information. If no user
print information exists, it can be created using the CHGUSRPRTI command.

For example, running the following command modifies (or creates if it doesn’t
exist) the user print information for user LAWSON.
CHGUSRPRTI USER(LAWSON) TEXT('DEPT. 269 P.O. BOX 123')

The command acts on the user print information for the user LAWSON. The user
information is changed (or created) to DEPT. 269 P.O.Box 123.

Using the DSPUSRPRTI Command


The Display User Print Information (DSPUSRPRTI) command displays the user
print information for the specified user.
DSPUSRPRTI USER(LAWSON)

Note: DSPUSRPRTI uses the QPDSPUSRPI printer file when OUTPUT is specified
as *PRINT.

Using the RTVUSRPRTI Command


The Retrieve User Print Information (RTVUSRPRTI) command can be used in a CL
program to retrieve the user print information value associated with a user. The
values are returned in the specified CL variables for that user.

Chapter 4. Remote System Printing 173


RTVUSRPRTI USER(LAWSON) RTNTEXT(&TEXT);

When the above command is run, the following is returned:


&TEXT 'DEPT 269 P.O. BOX 123 ____'

The coded character set identifier (CCSID) is used when the text description prints
on the output.

Send and Defer Status of Spooled Output Files


When a spooled output file is on an output queue, its status can vary depending
on the mode of the output queue and/or the activity taking place with a particular
spooled file.

Of particular interest to remote system printing are the status’ of SND and DFR.

Note: DFR status is not unique to spooled output files on a remote output queue.
Spooled output files on non-remote output queues can also have a status of
DFR.
v SND
When a spooled output file is being sent to a remote system, it has a status of
SND. If the connection type is *SNA, the spooled output file may remain in SND
status until a confirmation message from the remote system is received by the
remote writer. At this time the spooled output file is deleted or saved,
depending on the save spooled file attribute. If the writer is ended while
spooled output files are in SND status, the spooled files are changed back to
RDY status.
v DFR
When a writer (printer or remote) is started to an output queue, it determines
the maximum spooled file size for the current time. Any RDY spooled files
which exceed the limit are changed to DFR status. If the spooled file exceeds the
current limit and is added to the output queue (created or moved) after a writer
is started to the output queue, the spooled output file status will be DFR.
When the system time-of-day changes such that a new maximum spooled
output file size is to take affect, the writer goes through the output queue again
and updates RDY spooled files to DFR, or DFR to RDY, depending on the new
limit and the size of the particular spooled output file. When the writer is
ended, all DFR spooled output files return to RDY.
When time ranges for the maximum spooled output file size overlap, the smaller
of the number of pages values is used. For example, assume that there were two
time ranges of 8:00:00 to 16:00:00 and 12:00:00 to 12:30:00, with number of pages
40 and 10 respectively. The largest spooled output file that would print from 8:00
am to 12:00 pm would be 40 pages. The largest spooled output file that would
print from 12:00 pm to 12:30 pm would be 10 pages. The largest spooled output
file that would print from 12:30 pm to 4:00 pm would be 40 pages.

The following screen illustrates an output queue (RMTOUTQ) with a status of


released and the first spooled output file (DMB18R1) being written (RLS/WTR).
Because DMB18R1 is being sent to a remote system, its status is SND. The next
spooled output file, DMB18R2, has a status of DFR. It could be deferred from
activity because of its size and the time of day that certain sizes of spooled output
files are allowed to be printed or sent.

174 OS/400 Printer Device Programming V5R1


Work with Queue (WRKOUTQ *RMTOUTQ)

Queue: RMTOUTQ Library: Lawson Status: RLS/WTR

Type options, press Enter.


1=Send 2=Change 3=Hold 4=Delete 5=Display 6=Release 7=Messages
8=Attributes 9=Work with printing status

Opt File User User Data Sts Pages Copies Form Type Pty
_ DMB18R1 LAWSON SND 1 1 *STD 5
8 STUMPF LAWSON RDY
_ DMB18R2 LAWSON TEST DFR 1 1 *STD 5

Bottom
Parameters for options 1, 2, 3 or command
===> _________________________________________________________________________
F3=Exit F11=View 2 F12=Cancel F20=Writers F22=Printers
F24=More keys

Spooled Output File Attributes


Selecting option 8 from the Work with Output Queue screen displays all the
attributes of a spooled output file. The following three attributes are very useful in
determining origin and ownership of spooled output files.
v System where file created
v User who created file
v User print information

You can also display a spooled output file’s attributes by using the Work with
Spooled Files (WRKSPLF) command and selecting option 8.

Chapter 4. Remote System Printing 175


Preparing AS/400 V3R1 or later to AS/400 V3R1 or later for Remote
System Printing
The diagram below illustrates AS/400-to-AS/400 remote system printing with
SNADS. Both the AS/400 source system and the AS/400 target system are at
Version 3 Release 1 or later. The values (or names) in the diagram are used in this
example.

Preparation work must be done on both the source system and target system for
the remote system printing to work. Table 14 provides a list of things that must be
present or created before remote system printing can be used.
Table 14. Source System and Target System Preparation for Remote System Printing
AS/400 Source System at V3R1 or later AS/400 Target System at V3R1 or later
| Line, controller, and device descriptions created Line, controller, and device descriptions created

| Additional information for these configuration Additional information for these configuration
| descriptions can be obtained in the Communications descriptions can be obtained in the Communications
| Configuration PDF manual. Configuration PDF manual.

176 OS/400 Printer Device Programming V5R1


Table 14. Source System and Target System Preparation for Remote System Printing (continued)
AS/400 Source System at V3R1 or later AS/400 Target System at V3R1 or later
Identify the user profile(s) to be used for remote system Depending on where (to a user ID or output queue) you
printing. want the spooled files sent, you need to create a
matching user profile or a specific output queue. Use the
This information is needed if you want a corresponding CRTUSRPRF or CRTOUTQ commands.
user profile on the target system to own the sent spooled
file(s). If you don’t care who owns the spooled files, they
can be sent to the target system and spooled to the
QNETSPLF user profile.
Setup the SNADS network. Setup the SNADS network.
v Create distribution queues and routing entries using v Create distribution queues and routing entries using
the Configure Distribution Services (CFGDSTSRV) the Configure Distribution Services (CFGDSTSRV)
command. command.
– Create a distribution queue. – Create a distribution queue.
– Create a routing entry and associate the target – Create a routing entry; associate the name of the
system name (SYSNMDLC) with the distribution distribution queue and the network ID of the target
queue. system (SYSNMD5T).
v Add users to the system directory. Use the Add v Add users to the system directory. Use the Add
Directory Entry (ADDDIRE) command. Directory Entry (ADDDIRE) command.
– Add a directory entry for the QNETSPLF user – Add a directory entry for QNETSPLF. (This entry is
profile. (This entry is used to send spooled files to used to receive spooled files from the source
the remote system.) system.)
User ID User ID
This must be QNETSPLF. This value must be QNETSPLF.
Address Address
This is the value specified on the RMTSYS This is the value specified on the RMTSYS
parameter (SYSNMDLC). parameter (SYSNMDLC).
User profile User profile
This must be *NONE. This must be QNETSPLF.
System name System name
This is the value specified on the RMTSYS This must be *LCL.
parameter (SYSNMDLC).
System group
System group Not used in this example.
Not used in this example. – Add another directory entry for user profile
– Add a directory entry for the QNETSPLF user QNETSPLF. (This entry is used to send messages
profile. (This entry is the user ID used by SNADS back to the source system).
on the source system.)
User ID
User ID This must be QNETSPLF.
This must be QNETSPLF.
Address
Address This is the name of the source system
This is the name of the source system (SYSNMD5T)
(SYSNMD5T).
User profile
User profile This value must be *NONE.
This must be QNETSPLF.
System name
System name This is the name of the source system
This is the name of the source system (*LCL). (SYSNMD5T)
System group System group
Not used in this example. Not used in this example.

Chapter 4. Remote System Printing 177


Table 14. Source System and Target System Preparation for Remote System Printing (continued)
AS/400 Source System at V3R1 or later AS/400 Target System at V3R1 or later
Create a remote output queue for remote system Create an output queue to receive the spooled files using
printing. the value on the RMTPRTQ parameter (OUTQRMT).

Use the Create Output Queue (CRTOUTQ) command.

Source System Activity - Creating the Remote Output Queue


The result of using this example would be spooled output files sent to output
queue OUTQRMT on the target system (SYSNMDLC).

Type CRTOUTQ and prompt (F4). The following screen appears. Type in the
values shown and press the Enter key. The remote output queue RMTOUTQ is
created. The other parameter values are needed to ensure connection and delivery
to the designated system.
Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name


Library . . . . . . . . . . . MYLIB Name, *CURLIB
Maximum spooled file size:
Number of pages . . . . . . . *NONE Number, *NONE
Starting time . . . . . . . . Time
Ending time . . . . . . . . . Time
+ for more values
Order of files on queue . . . . *FIFO *FIFO, *JOBNBR
Remote system . . . . . . . . . SYSNMDLC
Remote printer queue . . . . . OUTQRMT
Queue for writer messages . . . QSYSOPR Name, QSYSOPR
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Connection type . . . . . . . . *SNA *SNA, *IP
Destination type . . . . . . . . *OS400 *OS400, *OS400V2, *PSF2...
Text 'description' . . . . . . . AS/400 V3R1 to AS/400 V3R1

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

To begin sending spooled output files from the RMTOUTQ remote output queue,
run the Start Remote Writer (STRRMTWTR) command. Type STRRMTWTR and
prompt (F4).

The following screen appears. Type in the values for the parameters displayed and
press the Enter key. Spooled output files are then sent to the OUTQRMT on the
target system (SYSNMDLC).

178 OS/400 Printer Device Programming V5R1


Start Remote Writer (STRRMTWTR)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name, *ALL


Library . . . . . . . . . . . stumpf Name, *LIBL, *CURLIB
Queue for writer messages . . . *OUTQ Name, *OUTQ, *REQUESTER
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *NOMSG *NOMSG, *INQMSG, *MSG...

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Target System Activity - Printing Spooled Output Files from


the Source System
The spooled output files were sent to the OUTQRMT output queue on the target
system. To begin printing the spooled output files, start a printer writer to the
OUTQRMT output queue. Type STRPRTWTR and prompt (F4).

Type in the name of the printer (CHEROKEE2) you want to use and the name of
the output queue with the received spooled output files (OUTQRMT). Press the
Enter key and spooled output files will begin to print on the printer named
CHEROKEE2.
Start Printer Writer (STRPRTWTR)

Type choices, press Enter.

Printer . . . . . . . . . . . . cherokee2 Name, *ALL, *SYSVAL


Output queue . . . . . . . . . . OUTQRMT Name, *DEV
Library . . . . . . . . . . . stumpf Name, *LIBL, *CURLIB
Queue for writer messages . . . *DEVD Name, *DEVD, *REQUESTER
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *INQMSG *INQMSG, *MSG, *NOMSG...
File separators . . . . . . . . *FILE 0-9, *FILE
Drawer for separators . . . . . *DEVD 1-255, *DEVD, *FILE

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Multiple printer writers can be started to same output queue. This allows the
spooled output files from a particular output queue to be printed on more than

Chapter 4. Remote System Printing 179


one printer. See “Using multiple printer writer support” on page 140 for more
information on using multiple printer writers.

To see the number of writers started to the OUTQRMT output queue, run the
WRKOUTQ *ALL command. The Work with All output queues screen appears.
Type option 9 next to the OUTQRMT output queue and press the Enter key. The
Work with All Writers display appears. If the output queue has more than one
writer started to it, the writers are listed and they both are associated with the
same output queue (OUTQRMT).
Work with All output queues

Type options, press Enter.


2=Change 3=Hold 4=Delete 5=Work with 6=Release 8=Description
9=Work with Writers 14=Clear

Opt Queue Library Files Writer Status


SCCOUTQ SCCLARK 156 RLS
T93 SCCLARK 0 RLS
AFP SKS 23 RLS
AFP2 SKS 0 RLS
SKS2 SKS 0 RLS
DEFERQ STANGLER 5 HLD
STANGLER STANGLER 53 RLS
ANGELIKA STUMPF 0 RLS
9 OUTQRMT STUMPF 2 *CHEROKEE2 RLS
RMTOUTQ1 STUMPF 0 RLS
TAAOUTQ TAATOOL 0 RLS
TIEMENS TIEMENS 0 RLS
More...
Command
===>
F3=Exit F4=Prompt F5=Refresh F12=Cancel F24=More keys

Work with All Writers

Type options, press Enter.


2=Change 3=Hold 4=End 5=Work with 6=Release 7=Display messages
8=Work with output queue

Opt Writer Type Device Queue Library Status Form Type


CHEROKEE2 PRT CHEROKEE2 OUTQRMT STUMPF STR *ALL
CHIEF PRT CHIEF OUTQRMT STUMPF STR *ALL

Bottom
Parameters for options 2, 3, 4, 6 or command
===>
F3=Exit F4=Prompt F12=Cancel F22=Start printer writer F24=More keys

You can list the names of writers started to the OUTQRMT output queue by typing
WRKOUTQ OUTQRMT and prompting (F4). The Work with Output Queue
display appears. Press F20=Writers key and the Work with All Writers display
appears with a list of all writers that are started to the OUTQRMT output queue.
This sequence is shown in the following two displays:

180 OS/400 Printer Device Programming V5R1


Work with Output Queue

Queue: OUTQRMT Library: STUMPF Status: RLS/WTR

Type options, press Enter.


1=Send 2=Change 3=Hold 4=Delete 5=Display 6=Release 7=Messages
8=Attributes 9=Work with printing status

Opt File User User Data Sts Pages Copies Form Type Pty
DMB18R2 XZZ0136 *BEFORE HLD 4 1 ENTN 5
QPRINT STUMPF SAV 2 1 *STD 5

Bottom
Parameters for options 1, 2, 3 or command
===>
F3=Exit F11=View 2 F12=Cancel F20=Writers F22=Printers
F24=More keys

Work with All Writers

Type options, press Enter.


2=Change 3=Hold 4=End 5=Work with 6=Release 7=Display messages
8=Work with output queue

Opt Writer Type Device Queue Library Status Form Type


CHEROKEE2 PRT CHEROKEE2 OUTQRMT STUMPF STR *ALL
CHIEF PRT CHIEF OUTQRMT STUMPF STR *ALL

Bottom
Parameters for options 2, 3, 4, 6 or command
===>
F3=Exit F4=Prompt F12=Cancel F22=Start printer writer F24=More keys

Preparing AS/400 V3R1 or later to AS/400 V2R3 for Remote System


Printing
The diagram below illustrates AS/400-to-AS/400 remote system printing with
SNADS. The AS/400 source system is at Version 3 Release 1 or later and the
AS/400 target system is at Version 2 Release 3. The values (or names) in the
diagram are used in this example.

Note: The user ID of the target system is OUTQRMT. This user ID is associated
with a user profile, also named OUTQRMT. The default output queue for
user profile OUTQRMT is named OUTQRMT. This output queue
(OUTQRMT) is the destination of the spooled files sent from the source

Chapter 4. Remote System Printing 181


system.

Preparation work must be done on both the source system and target system for
remote system printing to work. Table 15 provides a list of things that must be
present or created before remote system printing can be used.
Table 15. Source System and Target System Preparation for Remote System Printing
AS/400 Source System at V3R1 or later AS/400 Target System at V2R3
| Line, controller, and device descriptions created Line, controller, and device descriptions created

| Additional information for these configuration Additional information for these configuration
| descriptions can be obtained in the Communications descriptions can be obtained in the Communications
| Configuration PDF manual. Configuration PDF manual.
Create a remote output queue for remote system Create an output queue named OUTQRMT to receive the
printing. Use the Create Output Queue (CRTOUTQ) spooled files. This matches the name on the RMTPRTQ
command. parameter (OUTQRMT).

Create a user profile named OUTQRMTUSR specifying


an output queue of OUTQRMT.

182 OS/400 Printer Device Programming V5R1


Table 15. Source System and Target System Preparation for Remote System Printing (continued)
AS/400 Source System at V3R1 or later AS/400 Target System at V2R3
Setup the SNADS network. Setup the SNADS network.
v Create distribution queues and routing entries using v Create distribution queues and routing entries using
the Configure Distribution Services (CFGDSTSRV) the Configure Distribution Services (CFGDSTSRV)
command. Distribution queues and routing entries are command. Distribution queues and routing entries are
used to connect to the other system. used to connect to the other system.
– Create a distribution queue. – Create a distribution queue.
– Create a routing entry and associate the target – Create a routing entry and associate the target
system name (SYSNMDLC) with the distribution system name (SYSNMD5T) with the distribution
queue. queue.
v Add users to the system directory. Use the Add v Add users to the system directory. Use the Add
Directory Entry (ADDDIRE) command. Directory Entry (ADDDIRE) command.
– Add a directory entry using the value specified on – Add a directory entry using the value specified on
the RMTPRTQ parameter (OUTQRMT). the RMTPRTQ parameter (OUTQRMT).
User ID User ID
This is the value specified on the RMTPRTQ This is the value specified on the RMTPRTQ
parameter (OUTQRMT). parameter (OUTQRMT).
Address Address
This is the value specified on the RMTSYS This is the value specified on the RMTSYS
parameter (SYSNMDLC). parameter (SYSNMDLC).
User profile User profile
Use the value of *NONE Specify the user profile whose default output
queue you want the spooled files sent to. For
System name
this example, the user profile is
This the value specified on the RMTSYS
OUTQRMTUSR.
parameter (SYSNMDLC).
System name
System group
This is the name of the target system (*LCL).
Not used in this example.
– Add a directory entry for the QNETSPLF user System group
profile. (This entry is the user ID used by SNADS Not used in this example.
on the source system.) – Add another directory entry for user profile
QNETSPLF. (This entry is used to send messages
User ID
back to the source system).
This must be QNETSPLF.
User ID
Address
This must be QNETSPLF.
This is the name of the source system
(SYSNMD5T). Address
This is the name of the source system
User profile
(SYSNMD5T)
This must be QNETSPLF.
User profile
System name
This value must be *NONE.
This is the name of the source system (*LCL).
System name
System group
This is the name of the source system
Not used in this example.
(SYSNMD5T)
System group
Not used in this example.

Source System Activity - Creating the Remote Output Queue


This is the remote output queue from which spooled output files are sent to a
remote system for printing.

Chapter 4. Remote System Printing 183


The result of using this example would be spooled output files sent to user profile
OUTQRMTUSR on the target system (SYSNMDLC). They would then be placed in
the default output queue of the user profile OUTQRMTUSR.

Note: When a remote output queue is created, writers are automatically started to
it if the AUTOSTRWTR parameter value is not *NONE.

Type CRTOUTQ and prompt (F4). The following screen appears. Type in the
values shown and press the Enter key. The remote output queue RMTOUTQ is
created. The other parameter values are needed to ensure connection and delivery
to the designated system.
Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name


Library . . . . . . . . . . . stumpf Name, *CURLIB
Maximum spooled file size:
Number of pages . . . . . . . *NONE Number, *NONE
Starting time . . . . . . . . Time
Ending time . . . . . . . . . Time
+ for more values
Order of files on queue . . . . *FIFO *FIFO, *JOBNBR
Remote system . . . . . . . . . SYSNMDLC
Remote printer queue . . . . . OUTQRMT
Queue for writer messages . . . QSYSOPR Name, QSYSOPR
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Connection type . . . . . . . . *SNA *SNA, *IP
Destination type . . . . . . . . *OS400V2 *OS400, *OS400V2, *PSF2...
Text 'description' . . . . . . . AS/400 V3R1 to AS/400 V2R3

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

To begin sending spooled output files from the RMTOUTQ remote output queue,
run the Start Remote Writer (STRRMTWTR) command by typing STRRMTWTR
and prompting (F4).

The following screen appears. Type in RMTOUTQ and press the the Enter key.
Spooled output files are then sent to the OUTQRMT output queue on the target
system (SYSNMDLC).

184 OS/400 Printer Device Programming V5R1


Start Remote Writer (STRRMTWTR)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name, *ALL


Library . . . . . . . . . . . stumpf Name, *LIBL, *CURLIB
Queue for writer messages . . . *OUTQ Name, *OUTQ, *REQUESTER
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *NOMSG *NOMSG, *INQMSG, *MSG...

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Target System Activity - Printing Spooled Output Files from


the Source System
The spooled files were sent to the OUTQRMT output queue on the target system.
To begin printing the spooled output files, start a printer writer (STRPRTWTR
command and F4 (prompt)) to that output queue as shown in the screen below.

Type in the name of the printer (PRT01) you want to use and the name of the
output queue with the received spooled output files (OUTQRMT). Press the Enter
key and spooled output files will begin to print on the printer device named
CHEROKEE2.
Start Printer Writer (STRPRTWTR)

Type choices, press Enter.

Printer . . . . . . . . . . . . PRT01 Name, *ALL, *SYSVAL


Output queue . . . . . . . . . . OUTQRMT Name, *DEV
Library . . . . . . . . . . . stumpf Name, *LIBL, *CURLIB
Queue for writer messages . . . *DEVD Name, *DEVD, *REQUESTER
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *INQMSG *INQMSG, *MSG, *NOMSG...
File separators . . . . . . . . *FILE 0-9, *FILE
Drawer for separators . . . . . *DEVD 1-255, *DEVD, *FILE

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Chapter 4. Remote System Printing 185


Preparing AS/400 V3R1 or later to VM/MVS for Remote System Printing
The diagram below illustrates AS/400-to-VM/MVS remote system printing with
SNADS. The AS/400 source system is at Version 3 Release 1 or later. The values (or
names) in the diagram are used in this example.

Preparation work must be done on both the source system and target system for
remote system printing to work. Table 16 provides a list of things that must be
present or created before remote system printing can be used.
Table 16. Source System and Target System Preparation for Remote System Printing
AS/400 Source System at V3R1 or later VM/MVS Target System
| Ensure Licensed Program 5769-CM1 is installed. This is NJE configuration for VM/RSCS and JES2 or JES3 for
| needed for communications. For more details about MVS.
| configuring SNADS connections between these systems
| see the SNA Distribution Services PDF. Contact with the host system will be critical to
establishing the correct connection with VM/MVS.
System node name, printer ID, and user ID are some of
the information the AS/400 will require.
Line, controller, and device descriptions created Communication descriptions must exist or be created to
connect the VM/MVS system to the AS/400 system.
| Additional information for these configuration Typically this would be a line, physical unit (similar to
| descriptions can be obtained in the Communications controller), and a logical unit (similar to device). The VM
| Configuration PDF manual. or MVS system configuration will require information
from the AS/400 system.
Identify the user profile to be used for remote system This user must also exist on the target system if *USER is
printing. specified on the RMTPRTQ parameter on the AS/400
system.

186 OS/400 Printer Device Programming V5R1


Table 16. Source System and Target System Preparation for Remote System Printing (continued)
AS/400 Source System at V3R1 or later VM/MVS Target System
Setup the SNADS network. For MVS, identification of the AS/400 system must be
v Create distribution queues and routing entries using entered in the JCL or JES and associated with a printer
the Configure Distribution Services (CFGDSTSRV) defined to the MVS system.
command.
For VM, identification of the AS/400 system must be
– Create a distribution queue. entered in RSCS and associated with a printer defined to
– Create a routing entry and associate the target the VM system.
system name (VM3) with the distribution queue.
v Add users to the system directory. Use the Add
Directory Entry (ADDDIRE) command.
– Add a directory entry for the QNETSPLF user
profile. (This entry is the user ID used by SNADS
on the source system.)
User ID
This must be QNETSPLF.
Address
This is the name of the source system
(SYSNMD5T).
User profile
This must be QNETSPLF.
System name
This is the name of the source system (*LCL).
System group
Not used in this example.
– Add a directory entry for QNETSPLF. (This entry is
the user ID used by SNADS to route to the target
system.)
User ID
This must be QNETSPLF.
Address
This is the name of the target system (VM3).
User profile
This must be *NONE.
System name
This is the name of the target system (VM3).
System group
Not used in this example.

Create a remote output queue for remote system


printing.

Use the Create Output Queue (CRTOUTQ) command.


When sending spooled output files to VM/MVS the
default forms type must be STANDARD (not to be
confused with *STD for the AS/400). The forms type can
be changed by overriding the printer file used to create
the spooled output files. Also, you could use the Change
Spooled File Attributes (CHGSPLFA) command and
change the forms type parameter value to standard.

Chapter 4. Remote System Printing 187


Source System Activity - Creating the Remote Output Queue
The result of using this example would be spooled output files sent to the system
printer on the target system (VM3).

Note: When a remote output queue is created, writers are automatically started to
it if the AUTOSTRWTR parameter value is other than *NONE.

Type CRTOUTQ and prompt (F4). The following screen appears. Type in the
values shown and press the Enter key. The remote output queue TEST1 is created.
The other parameter values are needed to ensure connection and delivery to the
designated system.
Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name


Library . . . . . . . . . . . MYLIB Name, *CURLIB
Maximum spooled file size:
Number of pages . . . . . . . *NONE Number, *NONE
Starting time . . . . . . . . Time
Ending time . . . . . . . . . Time
+ for more values
Order of files on queue . . . . *FIFO *FIFO, *JOBNBR
Remote system . . . . . . . . . VM3
Remote printer queue . . . . . *SYSTEM
Queue for writer messages . . . QSYSOPR Name, QSYSOPR
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Connection type . . . . . . . . *SNA *SNA, *IP
Destination type . . . . . . . . *S390 *OS400, *OS400V2, *PSF2...
VM/MVS class . . . . . . . . . . C
FCB . . . . . . . . . . . . . . FCB2
Text 'description' . . . . . . . AS/400 V3R1 to VM System named VM3
Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

To begin sending spooled output files from the RMTOUTQ remote output queue,
run the Start Remote Writer (STRRMTWTR) command by typing STRRMTWTR
and prompting (F4).

The following screen appears. Type in RMTOUTQ and press the Enter key. Spooled
output files are then sent to the printer designated as the system printer on the
target system (VM3).

188 OS/400 Printer Device Programming V5R1


Start Remote Writer (STRRMTWTR)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name, *ALL


Library . . . . . . . . . . . MYLIB Name, *LIBL, *CURLIB
Queue for writer messages . . . *OUTQ Name, *OUTQ, *REQUESTER
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *NOMSG *NOMSG, *INQMSG, *MSG...

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Target System Activity - Printing Spooled Output Files from


the Source System
The spooled files were sent to the system printer on the target system (VM3).

Preparing AS/400 V3R1 or later to PS/2 with PSF for OS/2 for Remote
System Printing
The diagram below illustrates AS/400-to-PS/2 remote system printing with
TCP/IP. The AS/400 source system is at Version 3 Release 1 or later. The PS/2
must have OS/2 2.0 or later installed.

Chapter 4. Remote System Printing 189


Note: The remote system (RMTSYS) parameter value can be either the network
name of the PS/2 system or the value *INTNETADR. If the system name is
used for the RMTSYS parameter value, the OS/400 program resolves the
name to its Internet address

Preparation work must be done on both the source system and target system for
remote system printing to work. Table 17 provides a list of things that must be
present or created before remote system printing can be used.
Table 17. Source System and Target System Preparation for Remote System Printing
AS/400 Source System at V3R1 or later PS/2 Target System
| Ensure Licensed Program 5769-TC1 for TCP/IP is Ensure IBM TCP/IP 2.0 for OS/2 is installed and
| installed. This is needed for communications. For more configured on the PS/2. See IBM Transmission Control
| details about configuring connections between systems Protocol/Internet Protocol Version 2.0 for OS/2 G544-3767 for
| see the Configuration and Reference PDF. installation and configuration help.
Line, controller, and device descriptions created. Configure the PS/2 for TCP/IP. See the manual IBM
Transmission Control Protocol/Internet Protocol Version 2.0
Additional information for these configuration for OS/2: Installation and Administration SC31-6075 for
descriptions can be obtained in the Communications configuration help.
Configuration PDF manual.
Some of the configuration values use remote output
queue description. They are: system name and Internet
address.
Create a remote output queue for remote system Ensure Line Printer Daemon (LPD) is running on the
printing. Use the Create Output Queue (CRTOUTQ) PS/2. Use the Start LPD command. See the manual IBM
command. Transmission Control Protocol/Internet Protocol Version 2.0
Identify the printer queue name for the target PS/2 for OS/2 SX75-0070 for help.
(ANNSPRIN).
Identify the internet address for the target PS/2
(9.5.50.48), or identify the system name for the target
PS/2 (ERIC). Either of these values can be used.

Source System Activity - Creating the Remote Output Queue


The result of using this example would be spooled output files sent to a printer
named ANNSPRIN on the target system (ERIC).

Note: When a remote output queue is created, writers are automatically started to
it if the AUTOSTRWTR parameter value is other than *NONE.

Type CRTOUTQ and prompt (F4). The following screen appears. Type in the
values shown and press the Enter key. The remote output queue RMTOUTQ is
created. The other parameter values are needed to ensure connection and delivery
to the designated system.

190 OS/400 Printer Device Programming V5R1


Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name


Library . . . . . . . . . . . MYLIB Name, *CURLIB
Maximum spooled file size:
Number of pages . . . . . . . *NONE Number, *NONE
Starting time . . . . . . . . Time
Ending time . . . . . . . . . Time
+ for more values
Order of files on queue . . . . *FIFO *FIFO, *JOBNBR
Remote system . . . . . . . . . ERIC
Remote printer queue . . . . . ANNSPRIN
Queue for writer messages . . . QSYSOPR Name, QSYSOPR
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Connection type . . . . . . . . *IP *SNA, *IP
Destination type . . . . . . . . *PSF2 *OS400, *OS400V2, *PSF2...
Text 'description' . . . . . . . AS/400 V3R1 to PS/2 named ERIC

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

To begin sending spooled output files from the RMTOUTQ remote output queue,
run the Start Remote Writer (STRRMTWTR) command. Type STRRMTWTR and
prompt (F4).

The following screen appears. Type in the values for the parameters displayed and
press the Enter key. Spooled output files are then sent to the remote printer queue
named ANNSPRIN on the PS/2 system named ERIC.
Start Remote Writer (STRRMTWTR)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name, *ALL


Library . . . . . . . . . . . MYLIB Name, *LIBL, *CURLIB
Queue for writer messages . . . *OUTQ Name, *OUTQ, *REQUESTER
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *NOMSG *NOMSG, *INQMSG, *MSG...

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Chapter 4. Remote System Printing 191


Target System Activity - Printing Spooled Output Files from
the Source System
The sent spooled files are received to a print queue on the PS/2. For information
on how to work with spooled files received at a PS/2, see the PSF for OS/2 User’s
Guide , G544-3767. :I1 page=end.remote system printing

Preparing AS/400 V3R7 or later to NetWare for Remote System Printing


The diagram below illustrates AS/400-to-NetWare remote system printing. The
AS/400 source system is at Version 3 Release 7 or later. The NetWare 3.12 or 4.10
must be installed for NetWare Servers.

Note: The remote system (RMTSYS) parameter value can be the NetWare server
name for *NETWARE3 or the tree name for *NDS. Partial *NDS names are
allowed for the RMTPRTQ value when the *NDS value is used. If the fully
qualified *NDS name is not given, you can look for the NetWare context that
specifies the queue by using the command CHGNWSA OPTION(*NETWARE).

Preparation work must be done on both the source system and target system for
remote system printing to work. Table 18 provides a list of things that must be
present or created before remote system printing can be used.
Table 18. Source System and Target System Preparation for Remote System Printing
AS/400 Source System at V3R7 or later NetWare Target Server
Ensure the Licensed Program NetWare Integration Ensure the NetWare Loadable Module (NLM) from the
(5769-SA3) is installed. NetWare Enhanced Integration has been installed on the
NetWare Server that owns the volume used by the
NetWare printer queue.
| Configure and start Internetwork packet exchange (IPX) Load the NetWare Enhanced Integration NLM. The file
| support on the AS/400. For IPX configuration to be loaded is AS4NW410.NLM for NetWare 4.10 or
| information see the Internet Packet Exchange PDF. AS4NW312.NLM for NetWare 3.12 servers.

192 OS/400 Printer Device Programming V5R1


Table 18. Source System and Target System Preparation for Remote System Printing (continued)
AS/400 Source System at V3R7 or later NetWare Target Server
Use the command STRNTWCNN AUTJOB(*ANY) to connect to Ensure the NetWare User specified on the STRNTWCNN
the NetWare server, or use the ADDNTWAUTE or ADDNTWAUTE command is a valid NetWare user.
command if you wish to start the STRNTWCNN
command automatically.
Use the CRTOUTQ command. Create a remote print Ensure the NetWare queue exists on a volume of a server
queue for NetWare printing. that runs the NetWare Enhanced Integration NLM.

Source System Activity - Creating the Remote Output Queue


This example shows how to send spooled files to a printer named NWQUEUE on
a NetWare 3.12 server or NDSQUEUE on a NetWare 4.10 server.

Note: When a remote output queue is created, writers are automatically started to
it if the AUTOSTRWTR parameter value is other than *NONE.

Type CRTOUTQ and prompt (F4). The following screen appears. Type in the
values shown and press the Enter key. The remote output queue RMTOUTQ is
created. The other parameter values are needed to ensure connection and delivery
to the designated system.
Create Output Queue (CRTOUTQ)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ Name


Library . . . . . . . . . . . MYLIB Name, *CURLIB
Maximum spooled file size:
Number of pages . . . . . . . *NONE Number, *NONE
Starting time . . . . . . . . Time
Ending time . . . . . . . . . Time
+ for more values
Order of files on queue . . . . *FIFO *FIFO, *JOBNBR
Remote system . . . . . . . . . NWSERVER
Remote printer queue . . . . . NWQUEUE
Queue for writer messages . . . QSYSOPR Name, QSYSOPR
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Connection type . . . . . . . . *IPX *SNA, *IP
Destination type . . . . . . . . *NETWARE3 *OS400, *OS400V2, *PSF2...
Text 'description' . . . . . . . AS/400 V3R7 to NetWare 312

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

To begin sending spooled output files from the RMTOUTQ remote output queue,
run the Start Remote Writer (STRRMTWTR) command. Type STRRMTWTR and
prompt (F4).

The following screen appears. Type in the values for the parameters displayed and
press the Enter key. Spooled output files are then sent to the remote printer queue
named NWQUEUE or NDSQUEUE on the NetWare network. .

Chapter 4. Remote System Printing 193


Start Remote Writer (STRRMTWTR)

Type choices, press Enter.

Output queue . . . . . . . . . . RMTOUTQ2 Name, *ALL


Library . . . . . . . . . . . MYLIB Name, *LIBL, *CURLIB
Queue for writer messages . . . *OUTQ Name, *OUTQ, *REQUESTER
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Form type options:
Form type . . . . . . . . . . *ALL Form type, *ALL, *STD, *FORMS
Message option . . . . . . . . *NOMSG *NOMSG, *INQMSG, *MSG...

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys

Target System Activity - Printing Spooled Output Files from


the Source System
The spooled files are received to a print queue on the NetWare server. See the
NetWare documentation for information on how to print jobs from NetWare print
queues.

194 OS/400 Printer Device Programming V5R1


Chapter 5. Working with the OS/400 Network Print Server
This chapter discusses the OS/400 network print server. The network print server
is the host or print server for print clients.

The network print server provides client access to AS/400 system print objects and
resources. Following are the network print server objects and the actions that can
be requested to be performed on these objects:
Objects
Actions
Spooled file
Create, seek, open, read, write, close, hold, release, delete, move, send, call
exit program, change attributes, retrieve message, answer message, retrieve
attributes, and list.
Writer job
Start, end, and list
Printer device
Retrieve attributes and list
Output queue
Hold, release, purge, list, and retrieve attributes
Library
List
Printer file
Retrieve attributes, change attributes, and list
Network print server
Change attributes and retrieve attributes.

How is the network print server accessed?


Before a client can communicate with the network print server, a communications
session must be established. A communications session is a logical connection
between two systems through which a client program on a local system can
communicate with a server program on a remote system.

After a communications session has been established, the client can start the
network print server by sending a special record, called a Program Start Request
(PSR), to the AS/400 system. The communications session you use can utilize
different protocols. Refer to the appropriate manual for that communications type
for information on using program start requests (PSRs).

After the network print server program has been started using a PSR, a
communications transaction has been started. A communications transaction is a
logical connection between two programs on a communications session. After this
communications transaction starts, data can be exchanged between the client and
the network print server.

© Copyright IBM Corp. 1997, 2001 195


Prestart Jobs and the Network Print Server
Prestart jobs provide increased performance between a program start request (PSR)
initiated by a client and the network print server. Prestart jobs are defined within a
subsystem. Prestart jobs become active when that subsystem is started or they can
be controlled with the Start Prestart Job (STRPJ) and End Prestart Job (ENDPJ)
commands.

The program name contained in the PSR from the client must be defined in the
prestart job entry. This is how the PSR attaches itself to a prestart job and therefore
achieves better performance.

The network print server has prestart jobs defined in the QBASE and QCMN
subsystems. The number of prestart jobs that automatically start to support the
network print server is small and thus saves system resources.

Monitoring Prestart Jobs for the Network Print Server


Monitoring prestart jobs for the network print server in the QBASE or QCMN
subsystems can be done using the Display Active Prestart Jobs (DSPACTPJ)
command. For the network print server, you need to know the subsystem your
prestart jobs are in (QBASE or QCMN) and the program the prestart jobs are
started for (QNPSERVR).

This command provides the following information:


v Prestart jobs:
– Current number
– Average number
– Peak number
v Prestart jobs in use:
– Current number
– Average number
– Peak number
v Program start requests:
– Current number waiting
– Average number waiting
– Peak number waiting
– Average wait time
– Number accepted
– Number rejected

Note: The network print server never rejects a PSR. All PSRs are handled, or
they are queued and use the next available prestart job.

Changing Prestart Job Entries


The information presented for an active prestart job can be refreshed by pressing
the F13 key while on the DSPACTPJ display. Of particular interest is the
information about PSRs. This information can indicate to you whether or not you
need to modify the available number of prestart jobs. If you have information
indicating PSRs are waiting for an available prestart job, you can modify prestart
jobs using the Change Prestart Job Entry (CHGPJE) command.

Following is an example of a prestart job entry in the QBASE subsystem for the
network print server.

196 OS/400 Printer Device Programming V5R1


SBSD(QSYS/QBASE) +
PGM(QSYS/QNPSERVR) +
USER(QUSER) +
STRJOBS(*YES) +
INLJOBS(1) +
THRESHOLD(1) +
ADLJOBS(3) +
MAXJOBS(*NOMAX) +
JOB(*PGM) +
JOBD(*USRPRF) +
MAXUSE(200) +
WAIT(*YES) +
POOLID(1) +
CLS(QGPL/QCASERVR *CALC *NONE *CALC)

If the PSRs were not being acted upon fast enough you could:
v Increase the Initial number of jobs (INLJOBS) parameter value.
v Increase the Additional number of jobs (ADLJOBS) parameter value.
Then, when the Threshold (THRESHOLD) parameter value is reached, the
additional number of jobs are prestarted.

The key is to match the number of prestart jobs to the number of PSRs that are
being sent. Keeping this association as close to 1-to-1 ensures peak system
performance.

Additional prestart jobs can be started if the number of program start requests to
the network print server exceed the number of available prestart jobs.

Exit Points and the Network Print Server


An exit point is a specific point in a system function or program where control
may be passed to an installation specified program or programs. These programs
are called exit programs because they are providing an exit from the normal
processing of the system function or program. The exit programs are usually
programs created by users.

Table 19 contains the IBM-registered exit points that can be used with the network
print server.
Table 19. Network Print Server Registered Exit Points
Type of Support Exit Point Name Exit Point Format
Entry QIBM_QNPS_ENTRY ENTR0100
Spooled file QIBM_QNPS_SPLF SPLF0100

The functions provided by these exit points are:


v QIBM_QNPS_ENTRY
This exit point is used by exit programs that want to control which users can
access the network print server.
v QIBM_QNPS_SPLF
This exit point is used by exit programs that process spooled files.

Exit programs must be registered with the AS/400 system Registration Facility.
Registration allows all users to associate exit programs with the exit points.

Chapter 5. Working with the OS/400 Network Print Server 197


AS/400 Registration Facility and the Network Print Server
The registration facility provides storage and retrieval service for both OS/400 and
non-OS/400 exit points and exit programs.

The network print server exit points are already registered with the AS/400
Registration Facility. To use these exit points, you have to register your exit
programs with the AS/400 Registration Facility.

Exit programs are registered and de-registered using the following APIs:
v Add Exit Program (QUSADDEP) API
Adds an exit program entry for a specific exit point.

Note: The network print server exit points do not define exit program data.
When you register your exit program you can provide exit program data.
However, the data is not used by the network print server.
v Remove Exit Program (QUSRMVEP) API
Removes an exit program entry for a specific exit point.

For information and examples on how to register exit programs and exit points,
see the API Reference topic in the online Information Center.

Verifying Exit Point and Exit Program Registration


The Work With Registration Information (WRKREGINF) command displays
information about exit points and exit programs. The command does not add,
delete, or change exit points or exit programs within the registration facility. The
APIs listed above must be used to initiate change.

Using the OS/400 Network Print Server Exit Points


The diagram below provides an example of several requests from a client to the
network print server using the exit points provided by the network print server.
Those requests are: access the network print server, call a user-written exit program
to verify access, put a spooled output file on an output queue, and call a

198 OS/400 Printer Device Programming V5R1


user-written exit program that faxes a spooled output file.

Exit Point QIBM_QNPS_ENTRY


Exit Point QIBM_QNPS_ENTRY is used by exit programs that want to control
which users can access the network print server. The called exit program is passed
two parameters. These parameters are pointers to structures in user domain
storage. These structures, collectively, comprise format ENTR0100.

Required Parameters:

Required Parameter Group:

1 Return code Output CHAR(1)


2 Server information Input CHAR(32)

Required Parameter Group


Return code
OUTPUT; CHAR(1) The return code parameter is a pointer to a structure in
user domain that contains the return code from the exit program. The return
code is checked upon return from the call to the exit program.
A return code value of hexadecimal F1 indicates that the network print server
allows access and continues processing.
Any other return code value indicates that the network print server rejects
access and stops processing. The exit program being called must log any
specific errors.

Chapter 5. Working with the OS/400 Network Print Server 199


The structure of the return code is:

Offset
Dec Hex Type Field
0 0 CHAR(1) Return code

Server information
INPUT; CHAR(32) The server information structure contains the user profile
name, server identifier, format name, and server function identifier.

The structure of the server information is:

Offset
Dec Hex Type Field
0 0 CHAR(10) User profile name
10 A CHAR(10) Server identifier
20 14 CHAR(8) Format name
28 1C BINARY(4) Function identifier

Exit Point QIBM_QNPS_SPLF


Exit Point QIBM_QNPS_SPLF is used by exit programs that process spooled files.
The called exit program is passed four parameters. These parameters are pointers
to structures in user domain storage. These structures, collectively, comprise format
SPLF0100.

Required Parameters:

Required Parameter Group:

1 Return code Output CHAR(1)


2 Server information Input CHAR(32)
3 Spooled file ID Input CHAR(40)
4 Spooled file exit Input CHAR(*)
program data

Required Parameter Group


Return code
OUTPUT; CHAR(1) The return code is a pointer to a structure in user domain
that contains the return code from the exit program. The return code is
checked upon return from the call to the exit program.
Any non-zero code indicates an error with the exit program. The exit program
being called must log any specific errors. Processing by the network print
server continues.

Offset
Dec Hex Type Field
0 0 CHAR(1) Return code

200 OS/400 Printer Device Programming V5R1


Server information
INPUT; CHAR(32) The server information structure contains the user profile
name, server identifier, format name, and server function identifier.

The structure of server information is:

Offset
Dec Hex Type Field
0 0 CHAR(10) User profile name
10 A CHAR(10) Server identifier
20 14 CHAR(8) Format name
28 1C BINARY(4) Function identifier

Spooled file ID
INPUT; CHAR(40) The spooled file ID structure contains the job name, user
name, job number, spooled file name, and spooled file number. This
information uniquely identifies a spooled file on the AS/400 system.

The structure of a spooled file ID is:

Offset
Dec Hex Type Field
0 0 CHAR(10) Job name
10 A CHAR(10) User name
20 14 CHAR(6) Job number
26 1A CHAR(10) Spooled file name
36 24 BINARY(4) Spooled file number

Spooled file exit program data


INPUT; CHAR(*) The spooled file exit program data information structure
contains a four byte length and the spooled file exit program data. The
contents of the spooled file exit program data is not known to the network
print server. The receiving exit program knows the structure of the spooled file
exit program data. For example, if the exit program was going to fax the
spooled file specified by the spooled file ID. The spooled file exit program data
could consist of a name, phone number, building number, and office location.

The structure of the spooled file exit program data is:

Offset
Dec Hex Type Field
0 0 BINARY(4) Length of the
spooled file exit
program data
4 4 CHAR(*) Spooled file exit
program data

Chapter 5. Working with the OS/400 Network Print Server 201


Parameter Field Descriptions
Format name. Name of the format being used.
For the network print server, two formats are supported:
v For spooled file support the value is SPLF0100.
v For entry support the value is ENTR0100.

Function identifier. Identifies, within a server, the function of the exit point. For the network print server, two
function identifiers are supported:
v For spooled file support, the value is hexadecimal 010D.
v For entry support, the value is hexadecimal 0802.

Job name. The name of the job that created the spooled file.

Job number. The number of the job that created the spooled file.

Server identifier. Identifies the OS/400 server being called. The value for the network print server is QNPSERVR.

Spooled file exit program data. Spooled file exit program data consists of additional information used by the exit
program that has registered for exit point QIBM_QNPS_SPLF. The client application provides the spooled file exit
program data.

Spooled file name. The name of the spooled file being requested.

Spooled file number. The number of the spooled file being requested.

User profile name. The user, from Client Access Express, that is making the call to the network print server.

202 OS/400 Printer Device Programming V5R1


Part 3. Advanced function printing (AFP)
Chapter 6. What Is Advanced Function Printing Restrictions when using line data and mixed data 232
(AFP)? . . . . . . . . . . . . . . . 205
Frequently used terms . . . . . . . . . . 205 Chapter 9. Printing AFPDS data . . . . . . 235
Advanced Function Printing Data Stream (AFPDS) 206 Printing AFPDS data generated on the AS/400
What this part of the manual will do for you . . . 206 system . . . . . . . . . . . . . . . 235
Using the configuration examples . . . . . . 207 System/390 AFPDS and line data . . . . . . 235
Working with the System/390 . . . . . . . . 236
Chapter 7. Resources needed to perform Sending print data to the output queue of a
Advanced Function Printing (AFP) . . . . . 209 user ID . . . . . . . . . . . . . . 236
Working with AFP resources and libraries . . . . 210 Sending print data from VM System/390 to a
Fonts and font libraries . . . . . . . . . . 210 user’s output queue on an AS/400 system. . 236
Font resource objects . . . . . . . . . . 211 Sending print data from MVS System/390 to
Font character set . . . . . . . . . . 211 a user’s output queue on an AS/400 system . 237
Code page . . . . . . . . . . . . 211 System/390 parameters and matching AS/400
Coded font . . . . . . . . . . . . 211 printer file parameters . . . . . . . . . 237
Fonts from System/390 . . . . . . . . . 211 Managing print data sent to an AS/400 output
Fonts provided by the OS/400 program . . . 212 queue . . . . . . . . . . . . . . . 240
Advanced Function Printing Fonts/400 Target AS/400 system . . . . . . . . 240
(Program 5769-FNT) . . . . . . . . . . 213 Target user ID . . . . . . . . . . . 240
AFP font collection . . . . . . . . . . 213 Target output queue . . . . . . . . . 240
IBM AFP font collection for MVS, OS/390, Target printer . . . . . . . . . . . 241
VM, and VSE: . . . . . . . . . . . 213 Sending resources and AFPDS data to network
IBM AFP font collection for AIX, OS/2, and files . . . . . . . . . . . . . . . 241
OS/400: . . . . . . . . . . . . . 213 Sending resources and AFPDS data from VM
AFP expanded core fonts . . . . . . . 214 System/390 to network files . . . . . . 241
Supported languages . . . . . . . . . 215 Sending resources and AFPDS data from
IBM compatibility fonts: . . . . . . . . 215 MVS System/390 to network files . . . . 241
IBM 4028 font metrics: . . . . . . . . 215 Receiving resources and AFPDS data sent to
Advanced Function Printing DBCS Fonts/400 network files . . . . . . . . . . . . . 241
(Program 5769-FN1) . . . . . . . . . . 216 Using the Work with Network Files
Page segments . . . . . . . . . . . . . 216 (WRKNETF) and Receive Network File
Overlays . . . . . . . . . . . . . . . 216 (RCVNETF) Commands . . . . . . . . . 242
Form definitions . . . . . . . . . . . . 217 Examples . . . . . . . . . . . . . 242
Created with AFP PrintSuite for OS/400 . . . 217 Creating resources on the AS/400 system . . . 243
Provided with the AS/400 system . . . . . 217 Printing AFPDS data on the AS/400 system . . 243
Downloaded from System/390 . . . . . . 218 Examples . . . . . . . . . . . . . 243
Inline from System/390 . . . . . . . . . 218 Additional PSF/400 functions . . . . . . 243
FORMDF parameter on printer file . . . . . 218
Page definitions . . . . . . . . . . . . 219 Chapter 10. Working with print services facility
PAGDFN parameter on printer file . . . . . 221 (PSF) configuration objects . . . . . . . . 245
About PSF configuration commands. . . . . . 245
Chapter 8. Working with line data . . . . . . 223 Creating a PSF configuration object . . . . . 245
DEVTYPE values . . . . . . . . . . . . 223 Changing a PSF configuration object . . . . 245
CTLCHAR values . . . . . . . . . . . . 224 Displaying a PSF configuration object . . . . 245
TBLREFCHR parameter . . . . . . . . . . 224 Deleting a PSF configuration object . . . . . 245
AFPCHARS parameter . . . . . . . . . . 225 Working with PSF configuration objects . . . 245
| CVTLINDTA parameter . . . . . . . . . . 225 Using PSF configuration objects . . . . . . 246
Application considerations for line data . . . . 225 Working with IPDS pass-through support for PSF
Device type considerations . . . . . . . . . 226 for OS/400 . . . . . . . . . . . . . . 246
Carriage control characters . . . . . . . . . 226 Why use IPDS pass-through support? . . . . 246
ANSI carriage control characters . . . . . . 227 How IPDS pass-through function works . . . 247
Machine carriage control characters . . . . . 227 IPDS pass-through limitations . . . . . . . 247
Table reference characters (TRC) . . . . . . . 229 Enabling IPDS pass-through support . . . . 248
Line data and IGC parameters. . . . . . . . 229 Parameters supporting IPDS pass-through 248
INVDTAMAP (invoke data map) keyword . . . 231 | IPDS to PDF transform . . . . . . . . . . 250
INVMMAP (medium-map-name) DDS keyword 232

© Copyright IBM Corp. 1997, 2001 203


| Format of the printer file’s USRDFNDTA mail
| information . . . . . . . . . . . . . 250
| Format of the STRPAGGRP mail tag. . . . . 250
| IPDS to PDF transform device configuration . . 251
| CRTDEVPRT parameters . . . . . . . 251
| CRTPSFCFG parameters . . . . . . . . 251
| PDFOUTQ . . . . . . . . . . . . 253
| PDFDIR . . . . . . . . . . . . . 253
Sharing print sessions and IPDS dialogs . . . . 254
Parameters supporting printer session and
dialog sharing . . . . . . . . . . . . 255
Additional information on session sharing. . . 257
Parameters supporting automatic session
recovery . . . . . . . . . . . . . . 257
User and device resource library lists . . . . . 258
User resource library list . . . . . . . . 258
Device resource library list . . . . . . . . 259

204 OS/400 Printer Device Programming V5R1


Chapter 6. What Is Advanced Function Printing (AFP)?
Note: Regarding AFP and Print Services Facility/400 (PSF/400)

To use advanced function printing (AFP) support on the AS/400 system, the
PSF/400 must be installed. However, if the ASCII data stream is converted
through Host Print Transform function, you can use the AFP support
without having to install the PSF/400.

See “Using Print Services Facility for OS/400 (PSF/400)” on page x for
information on when PSF/400 is required. If you have additional questions
about PSF/400, contact your IBM representative.

Advanced function printing (AFP) is the ability of programs to use the


all-points-addressable concept to print text and images on a printer. AFP supports
Advanced function printing data stream (AFPDS), Intelligent printer data stream
(IPDS) and SNA character string (SCS).

Frequently used terms


Before using this part of the manual, familiarize yourself with these terms, which
are used throughout the manual.
Term Definition of Term
AFCCU
Advanced Function Common Control Unit
AFP Advanced function printing (AFP)
The ability of programs to use the all-points-addressable concept to print
text and images on a printer.
PCL Printer Control Language
PPDS Personal Printer Data Stream
APA all-points-addressable
In AFP support, pertaining to the capability to address, refer to, and
position text, overlays, and images at any defined point on the printable
area of the paper.
AFPDS
Advanced function printing data stream (AFPDS)
In AFP support, the printer data stream used for printing advanced
function printing data. The AFPDS includes composed text, page segments,
electronic overlays, form definitions, page definitions, and fonts that are
downloaded from the AS/400 system to the printer.
APPC/PC
Advanced Program-to-Program Communications/Personal Computer
Program (APPC/PC)
A licensed program, installed on a personal computer system, that
performs APPC functions for a transaction program running on the
personal computer system.
RPM Remote PrintManager (RPM).

© Copyright IBM C