Home

 

Creating the Java data binding for the channel and containers

To create the sample, proceed as follows:

Select New Æ Other Æ J2C Æ CICS/IMS Java Data Binding.

In the Data Import dialog (Figure | 0-17):

For Choose Mapping, select COBOL CICS Channel to Java
You see a message: `Containers' cannot be empty.
Near the Containers area, click New.

Figure 20-17 Selection of Mapping COBOL CICS Channel to Java

In the new Data Import (Specify data import configuration properties) dialog:

For Import File, browse to the sample COBOL file, and click Next.

<SDPShared_dir>\plugins\com.ibm.j2c.cheatsheet.content_7.0.1.v20080710-1450\Samples\CICS32K\ec03.ccp

In the Importer (Select a communication data structure) dialog, select DATECONTAINER, TIMECONTAINER, INPUTCONTAINER, OUTPUTCONTAINER, and LENGTHCONTAINER, and click Finish (Figure | 0-18).

Figure 20-18 Discovery of the containers defined in the COBOL file

Note that there are other data structures listed in the dialog. We made the selection to create Java beans for the five containers that are defined in the COBOL file (Example | 0-2):

Example 20-2 Definition of Containers in the COBOL file ec03.cpp

*  Container names
       01 DATECONTAINER      PIC X(16) VALUE 'CurrentDate'.
       01 TIMECONTAINER      PIC X(16) VALUE 'CurrentTime'.
       01 INPUTCONTAINER     PIC X(16) VALUE 'InputData'.
       01 OUTPUTCONTAINER    PIC X(16) VALUE 'OutputMessage'.
       01 LENGTHCONTAINER    PIC X(16) VALUE 'InputDataLength'.

The Data Import dialog appears again, with the five containers listed. Click Next.

In the Saving Properties dialog (Figure | 0-19).

For Project Name, click New. The New Source Project dialog opens:
Select Java project, and click Next.

Type CICSChannel as name, and click Finish.

For Package Name, type sample.cics.data.
For Class Name, type EC03ChannelRecord.
For Channel Name, type InputRecord.

Figure 20-19 Definition of the CICS Channel name and related class name

We can use an arbitrary channel name because the COBOL file expects to receive the channel name as input (Example | 0-3).

Example 20-3 Channel name is expected in input in ec03.ccp

      *  Get name of channel
           EXEC CICS ASSIGN CHANNEL(CHANNELNAME)
                            END-EXEC.
      *  If no channel passed in, terminate with abend code NOCH
           IF CHANNELNAME = SPACES THEN
                EXEC CICS ABEND ABCODE('NOCH') NODUMP
                            END-EXEC
           END-IF.

Select the DATECONTAINER (Figure | 0-20) and enter the following values:

For Package Name, accept sample.cics.data.
For Class Name, type DateContainer.
For Container name, type CURRENTDATE.
For Container type, select CHAR.

Figure 20-20 Definition of the DATECONTAINER

Repeat this step for all other containers using the following data:

Class name: TimeContainer, InputContainer, OutputContainer, LengthContainer
Container name: CURRENTTIME, INPUTDATA, OUTPUTMESSAGE, INPUTDATALENGTH
Container type: CHAR

Note that the class names can be chosen arbitrarily, but the names of the containers must match those defined in the COBOL file (Example | 0-2).

The dialog shows no more errors. Click Finish.

At this point the CICSChannel connector project is generated with a EC03ChannelRecord and five container classes in the sample.cics.data package. Close the editor of the EC03ChannelRecord class.

ibm.com/redbooks