IBM Support

TSPRWPR Remote Writer Page Range Support Exit Program

Troubleshooting


Problem

The TSPRWPR exit program allows a user to print a specific page range when using a remote output queue (RMTOUTQ) that is configured with a connection type of *IP or when using the Send TCP/IP Spooled File (SNDTCPSPLF or LPR) command.

Resolving The Problem

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 using 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 V4R2M0 version of QUSRTOOL; however, it will work with V3R7M0, V4R1M0, and later versions of the operating system. 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 a consulting agreement.

The following methods can be used to get the TSPRWPR utility on your operating system:

oDetach or download the PAGRANGE.SAVF file from this document, upload it to an operating system save file using an FTP session, and restore the objects from the save file.
oGet the source code from the QUSRTOOL library on a V4R4M0 or later operating system, and compile the source code using the ILE C/400 compiler (ILE C/400 is product 5769CX2 in V4RxMx and product 5716CX2 in V3R7M0).
oCall the Rochester Support Center at 1-800-IBM-SERV and ask about opening a consulting PMR to do a remote sign-on, and have the PAGRANGE save file sent to you.

Technical Support

The Remote Writer Page Range (TSPRWPR) program is not supported by the Rochester Support Center through Support Line. The TSPRWPR exit program can be used to provide a way to print page ranges with a Remote Output Queue (RMTOUTQ). The Rochester Support Center can provide assistance with restoring the TSPRWPR utility to an IBM System i system, or with configuring a RMTOUTQ that uses the TSPRWPR exit program, but will not provide assistance with potential defects in the TSPRWPR utility itself.

Note: This document contains a new version of the TSPRWPR utility, dated 06/20/2002. It 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 Page Range Support using the LPR Print Driver (TSPLPRD) Utility

Another option is to switch to using a *LAN 3812 device description that uses the LPR Print Driver (TSPLPRD) utility. For more information, refer to the following document:

N1019586: Configuring a *LAN 3812 Device Description that Uses the LPR Print Driver (TSPLPRD) Exit Program

This document was last updated on 11 March 2014.



    • - 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 operating system. Detach the save file from this document and upload the file to the operating system using FTP from an MS-DOS prompt. Then, restore the objects. The resulting PAGRANGE save file contains the following objects:

      ObjectTypeAttributeOwnerSize
      TSPRWPR*PGMCLEQSYS188416
      TSPRWPR*MODULECLEQSYS180224
      QATTCL*FILEPFQSYS45056
      QATTINFO*FILEPFQSYS24576
      QATTSYSC*FILEPFQSYS376832

      Additionally, the QATTCL, QATTINFO, and QATTSYSC source physical files contain the following members:

      FileMemberTypeText
      QATTCLTSPRWPRCCLPCreate Remote Writer Page Range Example Program
      QATTCLTSPRWPRDCLPDelete Writer Exit Example Program Objects
      QATTINFOTSPRWPRITXTRemote Writer Page Range Support Program
      QATTSYSCTSPRWPRCRemote Writer Page Range Support Program

      There are two versions of the PAGRANGE save file attached to this document. The version that must be detached/downloaded depends on your version of OS/400 or i5/OS:

      File NameDescription
      Attachment
      pagrange-r610.savfContains a number of changes that are specific to V6R1M0 (R610) i5/OS and above.
      pagrange-r540.savfContains a number of changes that are specific to V5R4M0 (R540).

      Note: The save files for V5R3M0 (R530) i5/OS and below have been removed from this document because these versions are no longer supported. However, they are available in an internal document so if one of the older save files are needed, please contact the Rochester Support Center representation or a World Trade support represent.

      Notes:
      oIf the pagrange-r540.savf file is uploaded and restored to a system running 6.1 or 7.1 i5/OS, or if the pagrange-r540.savf file has been uploaded and restored to a system running V5R4 i5/OS and that system is later upgraded or migrated to 6.1 or 7.1 i5/OS, then the V5R4 version of the TSPRWPR utility will need to go through object conversion in order to run on the newer releases. The need for object conversion can be avoided by uploading and restoring the 6.1/7.1 version of the TSPRWPR utility instead.
      oThe save files for V5R2 (R520) OS/400 and below have been removed from this document because these versions are no longer supported. However, they are available in an internal document so if one of the older save files are needed, please contact the Rochester Support Center representation or a World Trade support represent.
      Use the following steps to create a save file on the System i system, detach or download the PAGRANGE.SAVF file to a PC, upload the file to the System i system system using FTP and then restore the objects to the QGPL library:

      1.Create a save file on the System i system using the following Create Save File (CRTSAVF) command:

      CRTSAVF FILE(QGPL/PAGRANGE) TEXT('Remote Writer Page Range Support')
      2.Detach/download the appropriate version of the TSPLPRD save file: the pagrange-r610.savf file for V6R1M0 (R610) or V7R1M0 (7.1) i5/OS or the pagrange-r540.savf file for V5R4M0 (R540) i5/OS.

      Note: If the pagrange-r540.savf file is uploaded and restored to a system running 6.1 or 7.1 i5/OS, or if the pagrange-r540.savf file has been uploaded and restored to a system running V5R4 i5/OS and that system is later upgraded or migrated to 6.1 or 7.1 i5/OS, then the V5R4 version of the TSPRWPR utility will need to go through object conversion in order to run on the newer releases. The need for object conversion can be avoided by uploading and restoring the 6.1/7.1 version of the TSPRWPR utility instead.
      3.Bring up an MS-DOS prompt.
      4.Use the CD command to connect to the folder that contains the save file (for example, type CD C:\Temp if the save file was saved in the Temp folder).
      5.Type "FTP <as400-system-name>" in order to start an FTP session to your operating system. Sign on using your operating system user profile and password.
      6.Type "BIN" at the FTP prompt to force the data transmission to binary data.
      7.Type "CD QGPL" to change the working directory to the QGPL library (or the library where the save file was generated).

      Note: If this fails with an error that says the library was not found, it could be caused by the FTP attributes on the System i system being set up with the Initial name format (NAMEFMT) parameter set to *PATH rather than *LIB. Or, in other words, FTP may be set up to connect to the Integrated File System rather than to the library structure. Use the Change FTP Attributes (CHGFTPA) command to check on this or even change the setting. Or, try typing "CD /QSYS.LIB/QGPL.LIB". Another option is to try typing "QUOTE SITE NAMEFMT 0" and then typing "CD QGPL".
      8.Type the appropriate SEND command at the FTP prompt to send the save file from the PC to the TSPLPRD save file on the operating system:

      For V5R4 i5/OS, type SEND PAGRANGE-R540.SAVF PAGRANGE
      For V6R1 i5/OS, type SEND PAGRANGE-R610.SAVF PAGRANGE

      Note: If using NAMEFMT 1, type QUOTE SITE NAMEFMT 0 to change to NAMEFMT 0 or type one of the following commands instead:

      For V5R4 i5/OS, type SEND PAGRANGE-R540.SAVF PAGRANGE.FILE
      For V6R1 i5/OS, type SEND PAGRANGE-R610.SAVF PAGRANGE.FILE
      9.Type "QUIT" to end the FTP session.
      10.Type "EXIT" to close the MS-DOS prompt.
      11.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 operating system successfully:

      DSPSAVF FILE(QGPL/PAGRANGE)

      If unsuccessful, repeat Steps 3 through 10 above.
      12.Once the PAGRANGE.SAVF file has been successfully uploaded to the PAGRANGE save file on the System i™ 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 QUSRTOOL library in V4R2M0 (R420) OS/400 and above, and instructions for compiling the source code are in member TSPRWPRI in the QATTINFO file, which is also available in the QUSRTOOL library in V4R2M0 (R420) OS/400 and above. Note: There are a couple of defects in the TSPRWPR source code prior to V5R4M0 (R540) i5/OS that may cause problems when printing OS/400 or i5/OS 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. If using the TSPRWPR source code from the QUSRTOOL library that ships with V5R4M0 (R540), V6R1M0 (R610) or V7R1M0 (7.1) i5/OS, or the using the TSPRWPR utility from one of the attached save files, then you do not need to be concerned about the defects that are discussed below. [

        • - 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 System i™ system and compiling it yourself using the ILE-C compiler.

          • - Writer Fails with Message CPF6DF9 on Large Spooled Files 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: }/* End if Page range is being processed. */ else { XFrmXtInfo->Pass_Input_Data = PASS_SPLF_DATA; }/* Transform will not be reading spooled file data. */ This causes 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 System i™ system and compiling it yourself using the ILE-C compiler. [


          • - Limitations of the Remote Writer Page Range (TSPRWPR) Utility

            ] Use of Several Application Programming Interfaces (APIs) The Remote Writer Page Range (TSPRWPR) program uses several Application Programming Interfaces (APIs) that access the spooled files being sent. Because of this, it must have sufficient authority to the output queue, the output queue library, the printer device description, and the spooled file itself. Refer to the information on the Open Spooled File (QSPOPNSP) API in the System API Reference manual for the level of authority needed. For more information, please refer to the following: Application programming interfaces topic in the IBM Knowledge Center

            7.1 http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/apiref/api.htm
            6.1 http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_61/apiref/api.htm
            Print APIs topic in the IBM Knowledge Center:
            7.1 http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/apis/print1.htm
            6.1 http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_61/apis/print1.htm
            Authority Issues One possible way of insuring this exit program has authority to process all spooled files is to use the Change Program (CHGPGM) command to change the TSPRWPR program in order to have it adopt the owner's authority, and change the owner of the program to be a user profile which has sufficient authority, such as QSYS. TSPRWPR is an Unsupported Utility As stated above, the Remote Writer Page Range (TSPRWPR) program is not supported by the Rochester Support Center through Support Line. The TSPRWPR program is an unsupported utility that provides the function of printing a range of pages when sending a spooled files from a Remote Output Queue (RMTOUTQ) to an ASCII printer which is attached to an LPD server. The Rochester Support Center may provide assistance with restoring the TSPRWPR utility to an iSeries system, or with configuring a Remote Output Queue (RMTOUTQ) that uses the TSPRWPR program; however, the Rochester Support Center will not provide assistance with potential defects in the TSPRWPR utility itself. Transformed Data Buffer Size Limit of 2MB There is a 2MB limit on the amount of transformed data that can be in a single buffer. A single spooled file record is usually 4096 or 512 bytes in size, but the transformed data can be much larger than that and could potentially run into the 2MB limitation if including a number of page segments, or something else that results in a large ratio of transformed data per spooled file data. [


          • - 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 or i5/OS 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 or i5/OS 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. [

          [{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Print","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"5.4.5;6.1;6.1.1;7.1;4.1.0;4.2.0;4.3.0;4.4.0;4.5.0;5.1.0;5.2.0;5.3.0;5.3.5;5.4.0;6.1.0;7.1.0","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SSC3X7","label":"IBM i 6.1"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":null}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSC52E","label":"IBM i 7.1"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":" ","Platform":[{"code":"","label":null}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

          Historical Number

          12594243

          Document Information

          Modified date:
          18 December 2019

          UID

          nas8N1019686