- Right-click the
IMTKTutorial Java interface and select
New > Operation from the context menu.
- In the
Operation name field, type
Next.
The
Entry point list shows only the
book program. This is because each service interface can use only one program, and you specified the
book program in the Add operation we defined earlier for this same service interface.
- Select the
BOOK entry point; then click
OK.
The
Next operation is added to the list of Java Interfaces in COBOL Explorer.
- Click the
Next operation to refresh the Interface Mapper.
The
Next Operation - Interface Fields pane is blank in anticipation of new definitions for this operation.
- Based on the instructions for the Add operation, define a COBOL Assignment for the
lnk-function field and set its value to
4. This is the value that instructs the program to get the next record.
- Create an interface field named
lnk_file_status from the COBOL Entry Point field
link-file-status; then set its direction to
Output.
The program action that retrieves the next record gets the required record from the data file and returns it. So we need a set of output fields into which the fields of this record return.
- Drag
lnk-b-details from the
Linkage Section pane to the
Next Operation - Interface Fields pane.
The new interface field created is called
lnk_b_details. As we did when defining the Add operation, we will change the field name to ensure that it is different from the name used for similar groupings in the other operations for this interface.
- Double-click the
lnk_b_details field name in the
Next Operation - Interface Fields.
- Change the name to
nextop_details, and change the direction to
Output; then click
OK.
- Fully expand the tree for
nextop_details, and change the type of
lnk_b_retail from
BigDecimal to
int, just as we did for the Add operation.
In the application, the
lnk_b_stockno field serves as an output field and is also the field in which the key identifying the required record is input. To handle this, we will now create an input interface field to accept the key.
- In the
Linkage Section pane, fully expand
lnk_b_details.
- Drag
lnk-b-stockno from the
Linkage Section pane to the
Next Operation - Interface Fields pane and drop it.
In the
Next Operation - Interface Fields pane, rearrange the fields by moving
lnk-b-stockno to the top of the list.
This ensures that the new interface field is first on the list and thus the first field to supply its value to the program.
- Save the service interface.