Create and define the Next operation

  1. Right-click the IMTKTutorial Java interface and select New > Operation from the context menu.
  2. 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.

  3. Select the BOOK entry point; then click OK.

    The Next operation is added to the list of Java Interfaces in COBOL Explorer.

  4. 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.

  5. 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.
  6. 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.

  7. 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.

  8. Double-click the lnk_b_details field name in the Next Operation - Interface Fields.
  9. Change the name to nextop_details, and change the direction to Output; then click OK.
  10. 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.

  11. In the Linkage Section pane, fully expand lnk_b_details.
  12. 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.
  13. Save the service interface.