Net Print/400 - Printing a spooled file

The program NETPRTIB processes an AS/400 spooled file, retrieving a copy of the spooled file based on the input parameters. Then the program transforms the spooled file into a printable or displayable format, and sends the transformed data to the client (browser). The program works in conjunction with the SNDSPLFNP command (Webulator/400 session), or the link results of the Netprtsp.d2w Net.Data macro (CGI session) to receive the input parameters. The parameters listed for the CGI session are necessary information if you wish to create your own interface to call this program, or modify the Net.Data Macro provided. In a CGI session, NETPRTIB receives the parameters from a query string environment variable.

The NETPRTIB program was created with the user profile (USRPRF) parameter of the program set to *USER. As a result, owner authority adoption will not take place based upon execution of the NETPRTIB program. If adoption is desired, the program must be changed or called from within another that does adopt the owner's authority.

How to Construct a URL to Call NETPRTIB Directly

You can call the NETPRTIB program directly from the browser location if you know the details for a given spooled file on your system, and the server user profile has spooled file authorities for that spooled file.

The basic form of a URL is:


Basic Format for Calling NETPRTIB Directly from the browser

The NETPRTIB program accepts parameters via named query string value. See section Parameters: (CGI Session) for more information on the order and meaning of each parameter. In addition, a parameter is added at the end of the query string (.np or .htm). This is needed by Microsoft IE browsers to ensure that the Net Print/400 plug-in is properly loaded to print the report. An example URL follows:

Other examples

Using Manufacturer Type and Model:

In this example the, Manufacturer type and model parameter is "*HP4" which corresponds to a Hewlett Packard LaserJet 4 series printer.

Using Printer Device Name:

In this example the Manufacturer type and Model parameter is "*DEVD", and the Printer device name is "mydevice", where "mydevice" is an AS/400 printer device description that must correspond to the attributes of the actual printer where the report will be printed.

Using Workstation Customizing Object:

In this example the Manufacturer type and Model parameter is *WSCST, and the Workstation customizing object is "myobject" in "myobjectlib". The "myobject" WSCST must define the attributes of the printer where the report will be printed.

For more general information about URL locations, visit this link.

Parameters: (CGI Session)

Spooled File Name: (FILE)

Job Name: (JOBNAME)

User Name: (USERNAME)

Job Number: (JOBNUMBER)

Spooled File Number: (SPLNBR)

Manufacturer Type and Model: (MFRTYPMDL)

Workstation Customizing Object: (WSCSTOBJ)

Workstation Customizing Object Library: (WSCSTLIB)

Printer Device Description: (DEVD)

Processing a Report using a Net.Data macro<


The user must identify which spooled file is to be printed or displayed. In a CGI environment one way to identify it is to use the supplied Net.Data macro. Once a spooled file is identified, the NETPRTIB program must be called to send the spooled file data to the browser to be printed or displayed. Note:Basic Information about CGI, and CGI Scripts can be found at this link.

The Net.Data Macro and its Parameters

The Net Print/400 product includes a sample Net.Data macro. It is installed into the install home folder, and may be accessed via the IFS root in the /QDLS/NPW directory. If you use the sample macro, you must ensure that Net.Data is installed and configured correctly for your server. You should also copy the macro to a location where other macros on your system are located.

The Net.Data macro as provided, displays a list of spooled files available based on the parameters entered in at the Net.Data form. To do this, the Net.Data interface calls the program NETPRTSP which sends the spooled file list back to the macro, which then displays the list to the browser. Each spooled file name displayed at the browser has a link. When the link is selected by the user, the NETPRTIB program is called to send the spooled file to the browser.

Using the Net.Data macro as provided, a typical session would be:

  1. At the location box in the browser, type in the URL necessary to run the Net.Data macro (see the section on constructing a URL in Net Print/400 configuration). The browser screen will look like Figure 5.1. If you chose "advanced form", the browser screen will look like Figure 5.2.

  2. Enter criteria and press "Display spool files".

  3. The list of spooled files is presented. As shown in Figure 5.3

  4. Select a link for a report to be sent to the browser.

  5. Print, or save to disk.

Figure 5.1 Net.Data Interface- Basic Form

Figure 5.2 Net.Data Interface -Advanced Form

Figure 5.3 A displayed list of spooled files.

These are the screens you would see from the Net.Data macro provided.

Net.Data Form Parameters

Basic Form:

Advanced Form:

Customizing the Net.Data Macro
The code for the Net.Data macro provided can be customized to suit individual needs. You might want to change the appearance to conform with other applications you have, or make it look unique.The final objective must be to send a request to the server to execute the main processing program NETPRTIB, sending in the appropriate parameters. See "Parameters: (CGI Session)" for information on parameters.

Note: For more information on Net.Data, Please refer to the IBM Net.Data information and documentation. Additional information can be found at:

Customizing the error messages delivered to the browser in a CGI environment

All CGI messages can be found in the message file NPWMSGF. Each of these messages, associated with CGI errors, are in the area NPW07XX. The content of these messages can be edited to suit the users needs. Care should be taken to retain the general format and meaning of the various messages to insure proper operation and user understanding.

Creating Your Own Interface and CGI to Process a Report

You can create your own CGI program and forms to generate a list of spooled files based on some specific criteria. For example, you might want to only print spooled files with a particular file name. Your CGI program would retrieve parameters for only those spooled files, and display a link at the browser that would send a request to the server to execute the NETPRTIB program with a query string filled with specific parameters for the report to be printed or displayed.

The Manufacturer Type and Model Parameter

Both methods of processing reports (Webulator/400 and CGI) require a parameter called Manufacturer Type and Model which corresponds to the "printer name" variable to determine how the report is to be converted for display or printing at the browser. This parameter has four options, the first being a specific printer (refer to Appendix A, "Available Printer Types" for list of available printers). This parameter tells the main processing program what type of format to use for transformation and printing. The other options Workstation Customizing Object, Device Description, and HTML are discussed below.

User Created Workstation Customizing Object (*WSCST)

An alternative to Manufacturer Type and Model (MFRTYPMDL) is to use a user created Workstation Customizing object (*WSCST). This is an object that consists of a table of attributes used to customize a given ASCII printer. For detailed information on how to create your own WSCST object, refer to Chapter 6.3 - "Customizing ASCII Printers that use the Host Print Transform" in the AS/400 Printing IV book (Document Number GG24-4389), "AS/400 Advanced Series Workstation Customization Programming Version 3" (Document Number SC41 - 3605).

Printer Device Description (*DEVD)

This option uses an existing AS/400 printer device. The Device Description can be used to define an ASCII printer. The Device Description must be created using the command - Create Device Description (Printer) (CRTDEVPRT). An already established printer, setup the way you want it to be, can be immediately used. This is also an ideal method to define your own printer type if your printer does not exist in the list of available printers (Appendix A, "Available Printer Types,").

Display as an HTML document

You can view the contents of the spooled file at the browser. Limited primarily to only spooled files with a printer device type of *SCS. To display a report, `*HTML' must be the entry to the Manufacturer Type and Model parameter to the NETPRTIB program or the "Display" link must be used. The NETPRTIB program then uses the printer type EPSONFX850 to do the Host Print Transform.

Copyright © I/NET All rights reserved.