< Previous | Next >

Lesson 1.3: Create a Java method

Lesson 1.3 leads you through the creation of a Java™ method.

Before you begin, you must complete Lesson 1.2: Setting up the Web project and Java Interface and Implementations. In this lesson you will:
  1. First you will create a Java method: In the Snippets view, select J2C. Double click Add Java method to J2C Java bean.
  2. In the Java Methods page, click Add
  3. In the Java method name field, type runPhoneBook for the name of the method.
  4. Click Next.
  5. Next you will create the input data mapping between COBOL and Java: In this step, you will import the Ex01.cbl (COBOL) file that is needed to create your applicaion. The Ex01.cbl file is located in <installdir>\IBM\SDP70Shared\plugins\com.ibm.j2c.cheatsheet.content_6.0.0\Samples\IMS\phonebook, where <installdir> is the directory where this product is installed. The COBOL file contains the application program that runs on the IMS™ server. It has the definition of the structure to be passed to the IMS server via the communications area. This structure represents the customer records being returned from the IMS application program. Before you can work with a file, you must import it from the file system into the workbench. In the Input type field of the Java Method page, click New.
  6. In the Data Import page, ensure that the Choose mapping field is COBOL_TO_JAVA. Click Browse beside the COBOL file
  7. Locate the Ex01.cbl file in the file system, and click Open.
  8. Click Next.
  9. In the COBOL Importer page, click Show Advanced.
    1. Select the following options:
      Table 1. COBOL Importer Parameter Settings
      Parameter Value
      Platform Name Z/OS
      Codepage IBM-037
      Floating point format name IBM® Hexadecimal
      External decimal sign EBCDIC
      Endian name Big
      Remote integer endian name Big
      Quote name DOUBLE
      Trunc name STD
      Nsymbol name DBCS
    2. Click Query to load the data.
    3. A list of data structures from the Ex01.cbl file is shown. Select INPUT-MSG in the Data structures field.
    4. Click Next.
  10. In the Saving properties page, select the following values for input type:
    1. Select Default for Generation Style.
    2. Click Browse beside the Project Name and choose the Web project IMSPhoneBook .
    3. In the Package Name field, type sample.ims.data.
    4. In the Class Name field, accept the default INPUTMSG. Click Finish.
  11. Next you will create the output data mapping between COBOL and Java: In the Java method page, click New next to the Output type field.
  12. In the Data Import page, ensure that the Choose mapping field is COBOL_TO_JAVA.
  13. Locate the Ex01.cbl file in the file system, and click Open.
  14. Click Next.
  15. In the COBOL Importer page, click Show Advanced.
    1. Select the following options:
      Table 2. COBOL Importer Parameter Settings
      Parameter Value
      Platform Name Z/OS
      Codepage IBM-037
      Floating point format name IBM Hexadecimal
      External decimal sign EBCDIC
      Endian name Big
      Remote integer endian name Big
      Quote name DOUBLE
      Trunc name STD
      Nsymbol name DBCS
    2. Click Query to load the data.
    3. A list of data structures from the Ex01.cbl file is shown. Select OUTPUT-MSG in the Data structures field.
    4. Click Next.
  16. In the Saving Properties page,
    1. Select Default for Generation Style.
    2. Click Browse beside the Project Name and choose the Web project IMSPhoneBook .
    3. In the Package Name field, type sample.ims.data.
    4. In the Class Name field, accept the default OUTPUTMSG . ClickFinish.
    5. Leave the Save session as Ant script unchecked.
  17. On the Java Method page , click Finish.
  18. In the Binding Details page, ensure that the interactionVerb is SYNC_SEND_RECEIVE(1) to indicate that the interaction with IMS involves a send followed by a receive interaction.
  19. Click Finish.
< Previous | Next >