The iSeries Table Web component can be used to display database records similar to the way in which they are displayed in a subfile on the host.
To display database records in an iSeries Table Web component, you need to,
When you create an iSeries Table Web component in your JSP file, one of the attributes you set is the name of the service program that the table calls. To specify the name and location of the service program on the host, you first need to select the Get data from an iSeries service program check box (on the Parameters tab in the attributes view). This enables the Library and Object fields in which you specify the library name where the service program is located, and the name of the service program, respectively.
When you create the iSeries Table Web component, you specify the Selection mode as None, Single, or Multiple. If you specify None, the subfile data that is displayed cannot be selected. If you specify Single, a radio button appears next to each subfile record allowing a single record to be selected. If you specify Multiple, a check box is placed next to each subfile record allowing multiple records to be selected. To determine the record that was selected, you create a Web interaction with the subfile page as the input page. In the procedure that is defined for this interaction, you code a call to the QdtsReadcSF API. This API returns the relative record number of the record selected or 0 if no record is selected. For example:
DGetRec B D info likeDS(rec) * C Eval rc = QdtsReadcSF(SFLName: %Addr(Rec): %Size(Rec): 1) C If rc > 0 C Eval info.name = SFLName *.. process record C Else * .. no record selected
The iSeries Table Web component uses the following procedures in the service program that it calls. Note that the procedure names are case sensitive.
Each procedure is passed two parameters from the iSeries Table Web component. The first parameter is a 10 character string that is the name of the iSeries Table Web component. The second parameter is an optional one that corresponds to a data structure. You define the fields of this structure in the Service program parameters section in Table Web component.
It is important that the lengths and types of the columns defined in the table attribute view match exactly the length and type of the fields defined in the subfile record structure in your program, and that they are in the correct order. If there is a mismatch, the subfile will not display correctly. If you want to examine what is in the subfile *USRSPC object in the QTEMP library, you can do so by using the DMPSYSOBJ command. Before doing this, at least one interaction must have been performed to create a job on the iSeries server. To get the qualified job name, look at the console in the WebSphere Test Environment for a line like this:
iSeries host job id [964666/QUSER/QZRCSRVS]On an iSeries command line, put this job in service mode by using the STRSRVJOB command:
STRSRVJOB 964666/QUSER/QZRCSRVSWhen the job is in service mode, use the DMPSYSOBJ command to dump the contents of the space to a spoolfile:
DMPSYSOBJ OBJ(ITEMLIST) CONTEXT(QTEMP) OBJTYPE(*USRSPC)Use the WRKSPLF command and display spool file QPSRVDMP. You will see the space content in a dump format.
Your service program interacts with the iSeries Table Web component by coding to subfile APIs. The data for a subfile is actually stored in a user space object (*USRSPC object type) on the host. This user space is created in library QTEMP for the current job that is executing the program.
Subfile APIs in your service program manipulate the records in the user space object that are displayed in the iSeries Table Web component on a JSP page. The subfile API names and the operation that each API performs are described below.
API name | API operation |
---|---|
QdtsAppendSF | Add a record |
QdtsChainSF | Chain to a record |
QdtsClearSF | Clear a subfile |
QdtsCountSF | Return a count of subfile records |
QdtsDeleteSF | Delete a subfile record |
QdtsInitSF | Initialize the subfile |
QdtsReadcSF | Read a selected record |
QdtsSetDspAtrSF | Set display attributes for each subfile cell |
QdtsSetNxtCgSF | Set the next changed record |
QdtsSetRcdNbrSF | Set the current record number |
QdtsUpdateSF | Update a record |
When you select Get data from an iSeries service program on the Parameters tab in the table attributes view, the radio buttons for Service program behavior are available for selection.
The default option, Writes a page at a time indicates that the service program clears the user space at the PGUP and PGDN procedures. The INIT, PGUP, and PGDN procedures need to be coded in the service program. This option also indicates that the footer section displays only the page up and page down buttons.
The option Writes a page as requested indicates that the service program will not clear the user space at each PGDN procedure. This option requires that the INIT and PGDN procedures be coded in the service program. The footer section displays only the page up and page down buttons.
The option Writes entire subfile, indicates that a footer section is displayed in the table for paging purposes. Page up and page down buttons appear in this footer as well as paging information in the form of page x of y, for example Page 5 of 10. This option also indicates that regardless of the number of records that are read into the user space for display in the table, those records represent the entire set of records that will be displayed in the table. This option also requires that the INIT procedure is coded in the service program . The PGUP and PGDN procedures are not required since they are not invoked in this case.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.