Exercise 1.3: Creating a 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 Project Explorer view, expand the project InOutArray in Dynamic Web Projects.
- Right-click on InOutImpl.java in JavaSource and select Source > Add method to J2C Java bean.
- In the Java Method page click Add.
- In the Java method name field, type runInOut for the name of the method.
- Click Next.
Creating the input data mapping between COBOL and Java
- Beside 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 field.
- Browse to find the file location of the InEqualsOut.cbl file (You can find a copy in your product installation folder: \rad\eclipse\plugins\com.ibm.j2c.cheatsheet.content_6.0.0\Samples\IMS\InOutArray).
- Click Open.
- Click Next.
- In the COBOL Importer page, click Show Advanced.
- Select the following options:
Parameter
|
Value
|
Platform Name
|
Z/OS
|
codepage
|
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
|
- Click Query to load the data.
- A list of data structures is shown. Select IN-OUT-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 InOutArray.
- In the Package Name field, type sample.ims.data.
- In the Class Name field, accept the default INOUTMSG. Click Finish.
- In the Java Method page, select Use input type for output.
- Click Finish.
- Click Finish to complete the definition of the method.
- In the Java Methods page, click Finish.
Now you are ready to begin Exercise 1.4: Creating a Java proxy class to test your application.