352 Mastering the IBM WebFacing Tool
Figure 10-43 Master View display
The database Web pages are now ready to be accessed from other applications. We show
you how to integrate these Web pages within a WebFacing application in Chapter 11,
“Integration with other Web applications” on page 375.
10.3 Displaying spooled files by calling another WebFacing
Menu options 1 and 3 also use the query for reporting purposes. However, the output of these
options is printed to a spooled file. Refer to Chapter 4, “5250 sample application” on page 47,
for details about the menu.
OS/400 provides access to many system objects, such as spooled files and active jobs,
through the use of system APIs. In this section, we use some of those APIs within a HLL,
such as RPG, to create a function that has the same functionality as the Work with Spooled
File (WRKSPLF) command. We then use the IBM WebFacing Tool to Web-enable the new
program that contains this function. Then we use our original WebFacing application, the
Flight Reservation System, to call the new program.
For this example, we don’t modify the original sample application. We create a new
application to support the display spooled files function.
Note: This example was created for V5R1 of OS/400. For details about reference material
for these system APIs, refer to the programming section in the iSeries Information Center:
Chapter 10. Dealing with unsupported features 353
10.3.1 Programs involved
To illustrate this function, we use three programs, display files, and a help panel group. The
programs that are used are:
LSTSPLF: Using the APIs mentioned, this program creates a user space and then calls
the API to obtain a list of the spooled files. As each spooled file entry is returned, it is
added to a subfile. The sample program returns a list of spooled files for the current user.
A different user can be specified by passing a different value for the parameters to the
CPYSPL: When the user selects a spooled file to be displayed, this CL program copies
the selected spooled file to a temporary physical file in QTEMP. It then calls RPG program
DSPSPL to display the contents of the physical file.
DSPSPL: This RPG program displays the contents of the spooled file, which is in the
temporary physical file, within a subfile. The user can scroll through the display and use
the command line to move to the top or bottom of the subfile.
All the programs and files are located within the save file called SPOOLWORK. Refer to
Appendix B, “Additional material” on page 465, for the instructions to restore the save file.
10.3.2 Testing the function using the 5250 interactive session
Test the program:
1. Add the library that contains the required programs to the library list.
2. Enter the following command:
3. A list of current user’s spooled files is displayed as shown in Figure 10-44. Use option 5 to
display the contents of the spooled file.
Figure 10-44 Current user’s spooled files as a result of using CALL LSTSPLF within 5250 application
Note: In the example, the entire contents of the spooled file are added to the subfile. If your
spooled files tend to be very large, for example over 1,000 records, consider modifying the
program to load the subfile one page at a time.