Print spoolfiles via pdf streaming

This operative system’s function is not so popular but you can save some money printing AFPDS spool files to non-IPDS printers: all you need is a printer who can print pdf in streaming (pdf direct).

Here are the steps:

  • spooled by a program is generated
  • it is released to a virtual printer
  • the latter converts it to pdf on the fly using the QSYSPRT system prtf
  • at the same time, the qsysprt spool in the format of “USERASCII” is turned to a second print queue
  • it turns it over to the physical printer

Here are the steps you need to take to implement the configuration

First, you need to create the printing device that points to the physical printer

CRTDEVPRT DEVD (PRTFISICA)             
 DEVCLS(-LAN)    
 TYPE(3812)    
 MODEL(1)    
 LANATTACH(-IP)                   
 PORT(9100) //to be inserted based on physical printer mark/model            
 FONT(11 -NONE)                       
 FORMFEED('AUTOCUT')                   
 INACTTMR(-SEC15)                     
 MFRTYPMDL(-HP4) //to be inserted based on physical printer brand/model           
 PPRSRC1(-A4)                         
 PPRSRC2(-A4)                         
 RMTLOCNAME('192.168.10.1') //printer ip address           
 SYSDRVPGM(-HPPJLDRV) //to be inserted based on physical printer brand/model           
 TEXT('HP Logistics Office Printer') 

After that, it switches to generating an object of type “PSFCFG” that will take care of the transformation from spool to pdf

CRTPSFCFG PSFCFG(QGPL/PRTPDF)                 
 USRRSCLIBL(JOBLIBL)                     
 RLSTMR(SEC15)                          
 PRTRSPTMR(NOMAX)                        
 PDFGEN(SPLF)                           
 PDFDEVTYPE(IP40300)                     
 PDFPPRDWR1(A4)                         
 PDFPPRDWR2(A4)                          
 PDFSENDER(SPLFOWN)                     
 PDFOUTQ(QUSRSYS/PRTFISICA)             
 TEXT('PSFCFG for PRTFISICA') 

And finally, you create the device that will trigger the transformation using the object “PSFCFG” and send the print out to the physical printer

CRTDEVPRT DEVD (PRTPDF)                                 
 PORT(12501) //choose a free port on your "i" with NETSTAT OPTION(-CNN) command                                      
 FONT(011 "NONE")                                  
 FORMFEED('AUTOCUT')                              
 RMTLOCNAME('127.0.0.1')                          
 USRDFNOBJ(QGPL/PRTPDF )PSFCFG)               
 TEXT('Virtual printer pdf') 

At this point, you just have to release the spool to the PRTPDF printer and verify that the spool is printed correctly on paper.

NB: Be careful that if the QSYSPRT has the HOLD parameter set to “YES” the release on the second output queue must be done manually: the system will wait for the user to release it to send the stream to the physical printer.

Related Posts
DB2 for i SQL – String Manipulation – POSSTR-LOCATE-LOCATE_IN_STRING (EN)

Introduction Often, in our applications, we need to work with text strings, and DB2 SQL can come in very useful Read more

DB2 for i – FAQ & Howtos (EN)

DB2 Database and SQL ... maybe the most important things on IBM i platform: here's a collection of FAQs, tips Read more

IBM i 7.4 Announcement (En)

Comes directly with the Easter egg this IBM announcement for the news of the IBM i 7.4 version, iNext version Read more

Generated Always Columns (EN)

Introduction "Generated Always Column": are columns, table fields, filled by DB2 engine: something like columns with a default value but Read more

Recent Posts

VsCode Extention: Bob Cozzi’s RPG IV to RPG Free Conversion

👉 Review: Bob Cozzi’s RPG IV to RPG Free Conversion – a useful VS Code extension for RPG modernization If…

9 months ago

IBM i & SQL Tips #010 – Locating Programs in the Call Stack with STACK_INFO

Hello everyone, I’d like to highlight another excellent contribution by Massimo Duca, part of his ongoing IBM i & SQL…

9 months ago

Trying out “Display File DDS Edit” for VS Code

Intrigued by some recent posts from Cristian Larsen on LinkedIn (New Release – Display File DDS Edit v 0.10.1), I…

10 months ago

Project Bob: the next-gen AI partner for IBM i and IBM Z application development

Hello everyone, Today I’d like to draw your attention to a major new announcement from IBM: Project Bob — a…

10 months ago

IBM i & SQL Tips #6: Calling REST APIs and Parsing JSON Responses with SQL

I want to share with you a particularly useful article by Massimo Duca in the IBM i & SQL Tips…

11 months ago

How Parameter Passing Works in IBM i Programs (RPG / Cobol)

Hello everyone, I’d like to highlight a very useful article by Marco Riva on Markonetools, where he clearly explains how…

11 months ago