Chapter 8. Migrating the user interface to the Java client 345
* ----------
C/Exec Sql
C+ Set Result Sets Cursor CUSTOMER
This allows the client to retrieve the result set when the program is called as a stored
The program determines the number of parameters by accessing a pre-defined field in the
Program Status Data Structure:
D NbrParms *PARMS
After executing the OpenCust subroutine, the program determines if more than one
parameter was passed. If this is the case, the ResultSet subroutine runs, and control is
returned. The subfile processing is bypassed:
C IF NbrParms > 1
C EXSR ResultSet
The file specifications for the display file are changed, so user controlled open is specified
(the keyword USROPN is added). There is no reason to open the file if the program is
executed from a Java client. The partial line is shown here:
It is interesting to note that the functionality handled by the BldSfl subroutine is analogous to
the processing done by the SltCustWdw.populateCustBox() method. The functionality
handled by the Process subroutine is handled by the SltCustWdw.custSelected() and
OrderEntryWdw2.setSelectedCust() methods.
8.5.2 Providing an item list
As you saw earlier, the List Items button executes the SLTPARTR stored procedure. The
changes made in SLTPARTTR to accommodate the Java client are similar to the changes
made in SLTCUSTR. The original logic flow in the SLTPARTR program is virtually identical to
the flow in SLTCUSTR:
򐂰 Run the OpenPart subroutine (declares and opens the cursor for ITEM and STOCK file).
򐂰 Run the BldSfl subroutine (populates and displays the subfile).
򐂰 Run the Process subroutine (detects the chosen part or item and displays it).
The new logic flow can be summarized as:
򐂰 Run the ClosePart subroutine (resets the cursor for multiple client requests).
򐂰 Run the OpenPart subroutine (same behavior as the original version).
򐂰 If more than one parm, run the ResultSet subroutine (makes the result set available to the
caller of the stored procedure).
򐂰 If only one parm, continue as the original version did. Run the BldSfl subroutine, and then
run Process.
Since the code changes are virtually identical to the ones made in SLTCUSTR, they are not
discussed here but can be downloaded and viewed.

Get Building Java Applications for the iSeries Server with VisualAge for Java 3.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.