More on TCP/IP Printing
August 23, 2002 Timothy Prickett Morgan
Hey, Ted:
I’ve been reading your articles on TCP/IP printing and I thought I’d pass on a tidbit of information that my shop recently received from Rochester support.
|
One of the nagging issues with TCP/IP printer support has been the lack of Page Range support for IP printers. This means that users cannot select a range of pages to print from their spool files. We have been using a shareware tool called Spool Tool to get around this. Spool Tool copies a range of pages and creates a new spool file, which can then be printed.
It appears that IBM has stepped up to the plate and offers a utility that enables page range support via the native commands. IBM sent us a save file containing the compiled utility, which we restored to QGPL. We then changed the OUTQ description for our IP printers as described in the attached document. It works great! Perhaps you can apply your editorial magic to this information and pass it along to your readers.
Thanks for all the great information you share with the readers of Midrange Guru. The Qshell stuff is really helpful for those of us being dragged kicking and screaming into the eunuch’s world. (Our AIX boxes now outnumber our AS/400s two to one.)
— Cliff Kelley
Thanks for sharing the save file with other readers of the Midrange Gurua, Cliff.
Readers, please note that Guild Companies and I cannot vouch for this save file. Use it at your own risk. Caveat emptor. Your mileage may vary.
The email Cliff received from IBM follows.
— Ted
Visit IBM online at: http://www.ibm.com/eserver/iseries/support
iSeries and AS/400 Technical Support Information
IBM Support Line Technical Document
Document Number: 12594243
Functional Area: Print
SubFunctional Area: Network Print from iSeries
SubSubFunctional Area: Remote Output Queues (RMTOUTQs)
Product: OS/400 PRINT/SPOOL (5769SS1SP) Release: ALL Classification: Public Use Keywords:
Document Title:TSPRWPR Remote Writer Page Range Support Exit Program
Document Description:
Note: This document previously was entitled Page Range Support on Remote Output Queue (LPR)
The TSPRWPR exit program allows a user to have only a specific page range printed or sent via remote output queues (RMTOUTQs) that are configured with a connection type of *IP or using the LPR or SNDTCPSPLF commands. This page range support is provided only for *SCS or *AFPDS spooled files that are transformed to ASCII before being sent. The specific page range to use is extracted from the attributes for each spooled file at the time the file is printed or sent. This exit program can also be used on remote output queues that are configured with a connection type of *IP to provide the same page range function.
This exit program also serves the purpose of providing an example of a Writer Transform Exit, as it is written to the Writer Transform Exit interface as documented in the AS/400 System API Reference manual. This exit program was introduced in the R420 version of QUSRTOOL, but will work with R370, R410 and later versions of OS/400. This tool is supplied as is without support. Therefore, any assistance with configuring or a remote output queue (RMTOUTQ) that uses the TSPRWPR utility must be done through Consult Line/400.
The following methods can be used to get the TSPRWPR utility on your OS/400:
- Detach or download the PAGRANGE.SAVF file from this document, upload it to an OS/400 save file using an FTP session, and restore the objects from the save file.
- Get the source code from the QUSRTOOL library on an R440 or later OS/400, and compile the source code using the ILE C/400 compiler (ILE C/400 is product 5769CX2 in R4xx and product 5716CX2 in R370).
- Call the Rochester Support Center at 800-237-5511 and ask about opening a Consult Line PMR in order to do a remote sign-on, then have the PAGRANGE save file sent to you.
Note: This document contains a new version of the TSPRWPR utility, dated 06/20/2002, that corrects a problem where the writer will fail with message CPF6DF9–Transformed data buffer too small, when printing a large spooled file containing image data and the Page range to print (PAGERANGE) parameter is set to “1 *END” (so the entire spooled file is to be printed). It is recommended that the TSPRWPR utility be restored from the attached save file using the instructions in the section entitled Getting the Remote Writer Page Range (TSPRWPR) Utility from the Attached Save File. However, the TSPRWPR source code can be edited and the TSPRWPR program recompiled using the instructions in the section entitled Getting the Remote Writer Page Range (TSPRWPR) Utility from the QUSRTOOL Library.
Getting the Remote Writer Page Range (TSPRWPR) Utility from the Attached Save File
To restore the TSPRWPR utility from the attached save file, a save file must be created on the OS/400. Detach the save file from this document and upload the file to the S/400 using FTP from an MS-DOS prompt. Then, restore the objects. The resulting PAGRANGE save file contains the following objects:
|------------+------------+------------+------------+---------| |Object |Type |Attribute |Owner |Size | |------------+------------+------------+------------+---------| |TSPRWPR |*PGM |CLE |QSYS |188416 | |------------+------------+------------+------------+---------| |TSPRWPR |*MODULE |CLE |QSYS |180224 | |------------+------------+------------+------------+---------| |QATTCL |*FILE |PF |QSYS |45056 | |------------+------------+------------+------------+---------| |QATTINFO |*FILE |PF |QSYS |24576 | |------------+------------+------------+------------+---------| |QATTSYSC |*FILE |PF |QSYS |376832 | |------------+------------+------------+------------+---------|
Additionally, the QATTCL, QATTINFO, and QATTSYSC source physical files contain the following members:
|------------+----------+------+------------------------------| |File |Member |Type | Text | |------------+----------+------+------------------------------| |QATTCL |TSPRWPRC |CLP | Create Remote Writer | | | | | Page Range Example Program | |------------+----------+------+------------------------------| |QATTCL |TSPRWPRD |CLP | Delete Writer Exit | | | | | Example Program Objects | |------------+----------+------+------------------------------| |QATTINFO |TSPRWPRI |TXT | Remote Writer Page | | | | | Range Support Program | |------------+----------+------+------------------------------| |QATTSYSC |TSPRWPR |C | Remote Writer Page | | | | | Range Support Program | |------------+----------+------+------------------------------|
(See attached file: pagrange.savf .) Use the following steps to create a save file on the iSeries or AS/400 system, detach or download the PAGRANGE.SAVF file to a PC, upload the file to the iSeries or AS/400 system using FTP and then restore the objects to the QGPL library:
-
Create a save file on the iSeries or AS/400 system using the following Create Save File (CRTSAVF) command:
CRTSAVF FILE(QGPL/PAGRANGE) + TEXT('Remote Writer Page Range Support')
- Detach or download the PAGRANGE.SAVF file from this document and save it in a folder on your PC.
- Bring up an MS-DOS prompt.
- Use the CD command to connect to the folder that contains the PAGRANGE.SAVF file. For example, if the PAGRANGE.SAVF file was saved in the Temp folder, then type “CD C:Temp”.
- Type FTP <as400-system-name> in order to start an FTP session to your OS/400. Sign on using your OS/400 user profile and password.
- Type BIN at the FTP prompt to force the data transmission to binary data.
- Type CD QGPL at the FTP prompt to connect to the QGPL library on the OS/400.
- Type SEND PAGRANGE.SAVF PAGRANGE at the FTP prompt to send the PAGRANGE.SAVF file from the PC to the PAGRANGE save file on the OS/400.
- Type QUIT to end the FTP session.
- Type EXIT to close the MS-DOS prompt.
- Use the following Display Save File (DSPSAVF) command on the iSeries or AS/400 system to verify that the file has been uploaded to the OS/400 successfully:
-
DSPSAVF FILE(QGPL/PAGRANGE)
If unsuccessful, repeat Steps 3 through 10.
- Once the PAGRANGE.SAVF file has been successfully uploaded to the PAGRANGE save file on the iSeries or AS/400 System, restore the objects from the PAGRANGE save file using the following Restore Object (RSTOBJ) command:
-
RSTOBJ OBJ(*ALL) SAVLIB(PAGRANGE) DEV(*SAVF) OBJTYPE(*ALL) + SAVF(QGPL/PAGRANGE) RSTLIB(QGPL)
Getting the Remote Writer Page Range (TSPRWPR) Utility from the QUSRTOOL Library
The source code for the remote writer page range utility is in member TSPRWPR in the QATTSYSC file (which is available in the R420 version of the QUSRTOOL library) and instructions for compiling the source code are in member TSPRWPRI in the QATTINFO file (which is also available in the R420 version of the QUSRTOOL library).
There are a couple of defects in the TSPRWPR source code that may cause problems when printing OS/400 spooled files through a Remote Output Queue (RMTOUTQ) that is configured to use the TSPRWPR utility. These defects are described below. To avoid these defects completely, use the attached save file instead. For instructions on using the save file, refer to the section entitled Getting the Remote Writer Page Range (TSPRWPR) Utility from the Attached Save File above.
Entire Spooled File Prints when Starting Page is Set to 1
There is a defect in the source code that will cause an entire spooled file to be printed if the page range starts with page 1, even when the ending page is something other than *END. To correct this defect, search for the following string in the TSPRWPR source member:
if (XFrmXtInfo->StartPage != PRT_WHOLE_FILE) and then change it to the following: if ((XFrmXtInfo->StartPage != PRT_WHOLE_FILE) || (XFrmXtInfo->EndPage != LAST_PAGE))
Note: This defect has been fixed in the TSPRWPR source code and program that are contained in the attached save file, so if the attachment is used then this is not a concern. However, the source code should be changed if you will be using the TSPRWPR source code that is included in the QUSRTOOL library on your iSeries or AS/400 system and compiling it yourself using the ILE-C compiler.
Writer Fails with Message CPF6DF9 on Large SPLFs Containing Image Data
There is another defect in the source code that will cause the writer to fail with message CPF6DF9–Transformed data buffer too small, when printing a large spooled file containing image data and the Page range to print (PAGERANGE) parameter is set to “1 *END” (so the entire spooled file is to be printed). This problem can be circumvented by changing the attributes of the spooled file to set the Save spooled file (SAVE) parameter to *YES and then printing the spooled file in two pieces. For example, to print a 1000 page spooled file, set the PAGERANGE parameter to “1 500” to print the first half of the spooled file, then set the PAGERANGE parameter to “501 *END” and release the spooled file again to print the second half of the spooled file.
The problem was caused by trying to read the entire spooled file in a single buffer. The spooled file contained over a thousand pages of image data, so calling Host Print Transform (HPT) single buffer caused the data returned to exceed the size of the buffer.
To correct this defect, search for the following lines in the TSPRWPR source member and delete them:
if ((XFrmXtInfo->StartPage != PRT_WHOLE_FILE) || (XFrmXtInfo->EndPage != LAST_PAGE)) {
then search for the following lines in the TSPRWPR source member and delete them as well:
}/* End if Page range is being processed. */ else { XFrmXtInfo->Pass_Input_Data = PASS_SPLF_DATA; }/* Transform will not be reading spooled file data. */
This will cause the TSPRWPR utility to read the spooled file 1 buffer at a time, rather than try to read the entire spooled file in a single buffer. Note: This defect has been fixed in the TSPRWPR source code and program that are contained in the attached save file, so if the attachment is used then this is not a concern. However, the source code should be changed if you will be using the TSPRWPR source code that is included in the QUSRTOOL library on your iSeries or AS/400 system and compiling it yourself using the ILE-C compiler.
Limitations of the Remote Writer Page Range (TSPRWPR) Utility
The TSPRWPR exit program uses several APIs that access the spooled files being sent. Because of this, it must have sufficient authority to the output queue that the spooled file is on, the library that the output queue is in, and the spooled file itself. See the System API Reference manual under the QSPOPNSP API for the level of authority needed. One possible way of insuring this exit program has authority to process all spooled files is to use the Change Program (CHGPGM) CL command to change the program to adopt its owners authority and to use the Edit Object Authority (EDTOBJAUT) command to verify that program is owned by a user profile that has sufficient authority, such as QSYS.
Using the TSPRWPR Utility with an Existing Remote Output Queue For remote output queues with a connection type of *IP, specify the name (TSPRWPR) and library for the User Data Transform parameter in the output queue description and turn off Host Print Transform. To change an existing remote output queue, type the following commands on the OS/400 command line. Press the Enter key after each command:
ENDWTR WTR(output-queue) OPTION(*IMMED) CHGOUTQ OUTQ(output-queue-library/output-queue) TRANSFORM(*NO) + USRDTATFM(QGPL/TSPRWPR) MFRTYPMDL(*SAME) WSCST(*SAME)
Note: The output queue description’s Manufacturer type and model (MFRTYPMDL) and Workstation customizing object (WSCST) parameters will still be used, but the remote writer will no longer call Host Print Transform (HPT) directly to convert the OS/400 spooled file to an ASCII printer data stream. The remote writer will call the TSPRWPR program, and the TSPRWPR program will call Host Print Transform (HPT) to convert only the pages specified in the Page range to print (PAGERANGE) parameter in the attributes for each spooled file.
Sponsored By ADVANCED SYSTEMS CONCEPTS |
SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:
Take 6 minutes to view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based AS/400 and iSeries data access can be! In just a few short minutes, you can find out ways to make your job easier and improve data access throughout your organization. Download the ViewPoint movie here . For more information or a FREE trial of SEQUEL, call 847/605-1311 or visit Advanced Systems Concepts. |