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:
- Create a Java method
- Create the input and output data mapping between COBOL and Java
- First you will create a Java method: In the Snippets view, select J2C.
Double click Add Java method to J2C Java bean.
- In the Java Methods page, click Add
- In the Java method name field, type runPhoneBook for the name
of the method.
- Click Next.
- 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.
- In the Data Import page, ensure that the Choose mapping field
is COBOL_TO_JAVA. Click Browse beside
the COBOL file
- 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:
Table 1. COBOL
Importer Parameter SettingsParameter |
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 |
- Click Query to load the data.
- A list of data structures from the Ex01.cbl file is shown. Select INPUT-MSG in
the Data structures field.
- Click Next.
- In the Saving properties page, select the following values for
input type:
- Select Default for Generation
Style.
- Click Browse beside the Project
Name and choose the Web project IMSPhoneBook .
- In the Package Name field, type sample.ims.data.
- In the Class Name field, accept the default INPUTMSG.
Click Finish.
- 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.
- In the Data Import page, ensure that the Choose mapping field
is COBOL_TO_JAVA.
- 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:
Table 2. COBOL
Importer Parameter SettingsParameter |
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 |
- Click Query to load the data.
- A list of data structures from the Ex01.cbl file is shown. Select OUTPUT-MSG in
the Data structures field.
- Click Next.
- In the Saving Properties page,
- Select Default for Generation
Style.
- Click Browse beside the Project
Name and choose the Web project IMSPhoneBook .
- In the Package Name field, type sample.ims.data.
- In the Class Name field, accept the default OUTPUTMSG .
ClickFinish.
- Leave the Save session as Ant script unchecked.
- On the Java Method page , click Finish.
- 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.
- Click Finish.