< Previous | Next >

Lesson 3: Create a Java method

Lesson 3 leads you through the creation of a Java™ method.
Before you begin, you must complete Lesson 2: Set up a web project and Java Interface and Implementations.
In this lesson you will
  1. In the Enterprise Explorer view, expand the project InOutArray in Web Projects.
  2. Select Java Resources > src > InOutImpl.java; right-click on InOutImpl.java, and select Source > Add/Edit J2C Java bean method.
  3. In the Java Method page, click Add.
  4. In the Name field, type runInOut for the name of the method.
  5. Beside the Input type field, click New.
  6. In the Data Import page, ensure that the Choose mapping field is COBOL to Java. Click Browse beside the COBOL file field.
  7. Browse to find the file location of the InEqualsout.cbl file. (You can find a copy in your product installation folder: <installdir>/IBM/IBMIMShared/plugins/com.ibm.j2c.cheatsheet.content/Samples/IMS/InOutArray).
    InEqualsOut.cbl
       IDENTIFICATION DIVISION.   
            program-id. pgm1.                                        
            ENVIRONMENT DIVISION.                                             
            CONFIGURATION SECTION.                                            
            DATA DIVISION. 
    
            LINKAGE SECTION.
    
           01  IN-OUT-MSG.
               05  WS-LL                      PIC S9(3) COMP VALUE +0.
               05  WS-ZZ                      PIC S9(3) COMP VALUE +0.
               05  WS-TRCD                    PIC X(5).          
               05  INDX                       PIC 99.
               05  WS-CUSTOMER     OCCURS 1 TO 8 TIMES 
                   DEPENDING ON INDX.
                   15  WS-CUST-NUMBER         PIC  X(5).
                   15  WS-CUST-NAME           PIC  X(20).
               05  WS-FUNC-CODE               PIC  X(6).
    
            PROCEDURE DIVISION.      
  8. Click Open, and 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 is shown. Select IN-OUT-MSG in the Data structures field, and click Next.
  10. In the Saving Properties page,
    1. Select Default for Generation Style.
    2. Click Browse beside the Project Name and choose the web project InOutArray.
    3. In the Package Name field, type sample.ims.data.
    4. In the Class Name field, accept the default INOUTMSG. ClickFinish.
    5. Leave the Save session as Ant script cleared.
  11. In the Java Method page, select Use input type for output.
  12. Click Finish.
  13. Click Finish to complete the definition of the method.
< Previous | Next >

Feedback