< 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 an EJB project and create a message-driven bean.
In this lesson, you
  1. On the Java Method page, click Add.
  2. In the Queue name field, type IVPPIPE4. The queue name is the name of the transaction pipe where the IMS™ callout messages are held. IVPPIPE4 is the pre-defined transaction pipe that is used by the IMS callout sample. For more information about the queue name, see
    If you import the provided IMS inbound sample instead of creating a new project, the queue name is set to SYNCTP04. For end-to-end testing, you have two options:
    1. Modify the queue name to use the IMS application that is provided in the IMS callout sample IVP: This option lets you test the J2C sample without having to create or modify your own IMS application or define an OTMA destination descriptor on the IMS host system.
    2. Modify or create an IMS application and define an OTMA destination descriptor on the IMS host system:
      1. Create or modify an IMS application to issue a synchronous callout request by using the DL/I ICAL call. For example:
        ICAL  SENDRECV MYDDTOR1 001000 00050 00100
        where:
        • SENDRECV is the required subfunction code
        • MYDDTOR1 is the descriptor name that you must define on the IMS host system.
        • 001000 is the time, in hundredths of a second, to wait for the response
        • 00050 is the size of the request data in bytes
        • 00100 is the size of the response data in bytes
        This example demonstrates how to send a synchronous callout request message to a destination named MYDDTOR1 with 50 bytes of request data. The application expects 100 bytes of response data to be returned without a timeout value of 1000 (or 10 seconds).
      2. This example demonstrates how to send a synchronous callout request message to a destination named MYDDTOR1 with 50 bytes of request data. The application expects 100 bytes of response data to be returned without a timeout value of 1000 (or 10 seconds).
        D MYDDTOR1 TYPE=IMSCON TMEMBER=HWS1 TPIPE=SYNCTP04 SYNTIMER=1000
        where:
        • MYDDTOR1 is the descriptor name that is specified in the DL/I ICAL call
        • HWS1 is the appropriate TMEMBER name in your environment
        • SYNCTP04 is the queue name that is specified in your Java method and J2C activation specification
        • 1000 is the timeout value in hundredths of a second.
        For more information about the DL/I ICAL call syntax, the OTMA destination descriptor, and the IMS synchronous callout function, see IMS Version 10 synchronous callout function
  3. In the EJB method name field, type invokeCall.
  4. Beside the Input type field of the Java Method page, click New.
  5. In the Data Import page, ensure that the Choose mapping field is COBOL to Java. Click Browse beside the COBOL file field.
  6. Browse to find the file location of the SYCALOUT.cpy file. (You can find a copy in your product installation folder: <installdir>/IBM/IBMIMShared/plugins/com.ibm.j2c.cheatsheet.content/Samples/IMS/inbound).
    sycalout.cpy
                *
          *    IMS Callout Sample copybook
          *
          *********************************************************************/
          *                                                                   */
          * (c) Copyright IBM Corp. 2008                                      */
          * All Rights Reserved                                               */
          * Licensed Materials - Property of IBM                              */
          *                                                                   */
          * DISCLAIMER OF WARRANTIES.                                         */
          *                                                                   */
          * The following (enclosed) code is provided to you solely for the   */
          * purpose of assisting you in the development of your applications. */
          * The code is provided "AS IS." IBM MAKES NO WARRANTIES, EXPRESS OR */
          * IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF   */
          * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING   */
          * THE FUNCTION OR PERFORMANCE OF THIS CODE.                         */
          * IBM shall not be liable for any damages arising out of your use   */
          * of the generated code, even if they have been advised of the      */
          * possibility of such damages.                                      */
          *                                                                   */
          * DISTRIBUTION.                                                     */
          *                                                                   */
          * This generated code can be freely distributed, copied, altered,   */
          * and incorporated into other software, provided that:              */
          *   - It bears the above Copyright notice and DISCLAIMER intact     */
          *   - The software is not for resale                                */
          *                                                                   */
          *********************************************************************/
    
            01  CALLOUT-REQUEST.
                05  CALLOUT-REQUEST-STR      PIC X(50).
    
            01  CALLOUT-RESPONSE.
                05  CALLOUT-RESPONSE-STR     PIC X(50).
  7. 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 is shown. Select CALLOUT-REQUEST in the Data structures field.
    4. 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 IMSInbound.
    3. In the Package Name field, type sample.ims.data.
    4. In the Class Name field, accept the default CALLOUTREQUEST. ClickFinish.
  11. Beside the Output type field of the Java Method page, click New.
  12. In the Data Import page, ensure that the Choose mapping field is COBOL to Java. Click Browse beside the COBOL file field.
  13. Browse to find the file location of the SYCALOUT.cpy file. (You can find a copy in your product installation folder: <installdir>/IBM/IBMIMShared/plugins/com.ibm.j2c.cheatsheet.content/Samples/IMS/inbound).
  14. Click Open.
  15. Click Next.
  16. 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 is shown. Select CALLOUT-RESPONSE in the Data structures field.
    4. Click Next.
  17. In the Saving Properties page,
    1. Select Default for Generation Style.
    2. Click Browse beside the Project Name and choose the web project IMSInbound.
    3. In the Package Name field, type sample.ims.data.
    4. In the Class Name field, accept the default CALLOUTRESPONSE. ClickFinish.
  18. Click Finish.
  19. Click Finish to complete the definition of the method.
  20. After all artifacts are generated, select IMSInbound > ejbModule > sample.ims, right click CALLOUTSB.java, and select > Open With > Java Editor. Edit the invokeCall method:
      public sample.ims.data.CALLOUTRESPONSE invokeCall(
                  		 		 		 sample.ims.data.CALLOUTREQUEST cALLOUTREQUEST) {
                  		 		 // TODO Need to implement business logic here. 
                  		 		 System.out.println("Synchronous callout request from IMS to WebSphere MDB");		 		 
                  		 		 
                  		 		    
                          System.out.println(cALLOUTREQUEST.getCallout__request__str());
                  
                          sample.ims.data.CALLOUTRESPONSE response = new CALLOUTRESPONSE();
                          System.out.println("Synchronous callout response from WebSphere MDB to IMS");		 		 
                          response.setCallout__response__str("HELLO FROM WAS MDB");
                          return response;
      }
< Previous | Next >

Feedback