Thursday, January 18, 2018

Capturing IBMi Spool File Print Documents via Windows LPD Service

Overview
Some IBM i or Mainframe users may have a need to push spool files from the IBM i/AS400, Mainframe or other systems to a Windows server so the binary or text output can be captured and processed electronically. It's pretty easy to use Windows LPD server to help the process along. 

Steps to Set up Windows Print Services and Print Queue for Capturing Print from Other Systems

Install Windows LPD Server on Windows (By Installing Print Services in Windows 2008, 2012, 2016 or Windows 7, 8 10)

Create a new output directory called: c:\localprint and another subdirectory called c:\localprint\spool

Add a Generic Text Windows Printer and name it MAINFRAME, IBMI or whatever is desired. Make sure it is shared with the same name. MAINFRAME, IBMI, Etc.
During printer creation create a new port for the printer that outputs to c:\localprint\report.txt


After printer creation go in to printer Advanced properties and check/enable the Keep Printed
Documents setting and uncheck/disable the Enable Advanced Printing Features settings.

This will insure the .SHD and .SPL files created by the printing process are kept after printing to disk file c:\localprint\report.txt. 


Note: c:\localprint\report.txt will never be processed. For any custom processing we will process the saved spool files (.SPL) from Windows print creation. We will ignore the .SHD files which appear to hold printer settings. Periodically the c:\localprint and c:\localprint\spool directories should be cleared of files that have been processed by a custom process.


Use regedit to go into Windows Registry and edit the following key: 

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PrintPrinters\MAINFRAME (or whatever your printer name is). Set the SpoolDirectory parm in the registry key to c:\localprint\spool

Re-start Windows Print Spooler service or reboot server.


Sending Over an iSeries Text Based Spool File with Line and Page Breaks via LPR/LPR


Example command to send over spool file from iSeries to Windows server 1.1.1.1

SNDTCPSPLF RMTSYS(*INTNETADR) PRTQ(ISERIES) FILE(QSYSPRT) JOB(368405/RJS/QPADEV0003) SPLNBR(1)
DESTTYP(*OTHER) MFRTYPMDL(*WSCSTNONE) INTNETADR('1.1.1.1') WSCST(QWPDEFAULT) SEPPAGE(*NO)     
                                    
Create remote outq to send spool files over automatically from the IBM I
CRTOUTQ OUTQ(QUSRSYS/LPRTEST) RMTSYS(*INTNETADR) RMTPRTQ(ISERIES) CNNTYPE(*IP) DESTTYPE(*OTHER) MFRTYPMDL(*WSCSTNONE) WSCST(QWPDEFAULT) INTNETADR('1.1.1.1') SEPPAGE(*NO)        

No comments: