Exercise 1.3: Creating the Java Method
Before you begin, you must complete Exercise 1.2: Setting up the Web project and Java interface and implementations .
Exercise 1.3 leads you through the creation of a Java method. In this exercise you will
- Create a Java method
- Create the input and output data mapping between COBOL and Java
Creating a Java method
- In the Snippets view, select J2C. Right click Add Java method to J2C Java bean.
- In the Java method name field, type runPhoneBook for the name of the method. Click Next.
Creating 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 <RSDP_installdir>\rad\eclipse\plugins\com.ibm.j2c.cheatsheet.content_6.0.0\Samples\IMS\phonebook, where <RSDP_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 Specify the input/output type of the Java Method page, click New.
- In the Data Import page, ensure that the Choose mapping field is COBOL_TO_JAVA. Click Browse beside the Cobol file name field.
- Locate the Ex01.cbl file in the file system, and click Open.
- Click Next.
- In the COBOL Importer page, Click Show Advanced.
- Select the following options:
Parameter
|
Value
|
Platform Name
|
Z/OS
|
Code Page
|
037
|
Floating point format name
|
IBM 390 Hexadecimal
|
External decimal sign
|
EBCDIC
|
Endian name
|
Big
|
Remote integer endian name
|
Big
|
Quote name
|
DOUBLE
|
Trunc name
|
STD
|
Nsymbol name
|
DBCS
|
- Beside the Data structures list, click the Query button.
- The data structures from the Ex01.cbl file are displayed. Select INPUT-MSG.Click Next.
- In the Saving properties page, select the following values for input type:
- The GenerationStyle is Default.
- Click Browse beside the Project Name field to choose the Java project IMSPhoneBook
- In the Package Name field, enter sample.ims.data
- In the Class Name field, accept the default name INPUTMSG. Click Finish.
Creating the output data mapping between COBOL and Java
- In the Java method page, click New next to the Output type field.
- In the Data Import page, ensure that the Choose mapping field is COBOL_TO_JAVA.
- Click the Browse button besides the Cobol file name field:
- Locate the Ex01.cbl file. Click Open.
- Once the file is added, Click Next.
- In the COBOL Importer page, Click on the Show Advanced.
- In the COBOL Importer page, select the following communication data structures:
Parameter
|
Value
|
Platform Name
|
Z/OS
|
Floating point format name
|
IBM 390 Hexadecimal
|
codepage
|
037
|
External decimal sign
|
EBCDIC
|
Endian name
|
Big
|
Remote integer endian name
|
Big
|
Quote name
|
DOUBLE
|
Trunc name
|
STD
|
Nsymbol name
|
DBCS
|
- Beside the Data structures text area, click the Query button.
- The data structures from the Ex01.cbl file are displayed.
Select OUTPUT-MSG. Click Next.
- In the Saving properties page, select the following values for output type:
- The GenerationStyle is Default.
- Click Browse beside the Project Name field to choose the Java project IMSPhoneBook
- In the Java package Name field, enter sample.ims.data
- In the Java Class Name field, accept the default name OUTPUTMSG. Click Finish.
- On the Java Method page , click Finish to complete the operation.
- In the Binding Details page, ensure that interactionVerb is SYNC_SEND_RECEIVE(1) to indicate that the interaction with IMS involves a send followed by a receive interaction. Click Finish.
Now you are ready to begin Exercise 1.4: Deploying the application.