You can generate a COBOL execution object model (XOM) from
a COBOL copybook. A COBOL XOM provides your rule project with a Java™ representation of the COBOL
data structures so that you can write rules in BAL and call your rules
from a COBOL application.
About this task
The generated COBOL XOM includes a XOM Java project. You use the XOM to create a business
object model (BOM). You also use it to execute the rules on zRule
Execution Server for z/OS® or WebSphere® Application
Server for z/OS.
Note: If you already
have a Java XOM and BOM, but
you want to also execute your rules in COBOL applications, you can
generate the necessary COBOL structures by creating a COBOL copybook
from the BOM. See
Converting a BOM to enable the BOM for COBOL.
Procedure
- In the Design part of the Rule
Project Map, click Import XOM and
then select COBOL execution object model.
- In the COBOL Execution Object Model pane
in the Properties window, click Add.
- On the Import COBOL XOM page, enter
a name for the COBOL XOM.
- Click Add and select a COBOL copybook
that you want to use as a basis for the COBOL XOM. Click OK.
You can select the copybook from the file system or from your Eclipse project. If you are
operating from Rational® Developer for z Systems, you have
an extra option, Remote system, which allows you to import the copybook from
a remote system explorer.
The Package name field
indicates the package name of the generated Java class. The XOM entry name is used as the
default package name for the class.
You can add several copybooks
for a XOM.
- Optional: If you want to use different names
to represent a data item in the copybook, such as BANK1_CUSTOMER and BANK2_CUSTOMER,
and still keep the same structure, use the Copy Replacing option.
Expand Advanced in the Select COBOL
Copybook window, then select the Enable Replacing check
box. The table below the check box becomes active.
Complete
the following actions in the table:
- Click Add.
- In the Source column, enter the text that you want to replace.
- In the Target column, enter the text that you want to use instead.
- Click OK.
The Copy Replacing column on the Import COBOL
XOM page shows Yes for the selected copybook.
To
revert to no Copy Replacing, click Edit, and
then clear the Enable Replacing check box.
- Click Next.
- Optional: If a copybook contains REDEFINES statements,
the Redefines page is displayed. You can either
accept the default data item, or select one of the alternative data
items. For more information about the REDEFINES statements,
see REDEFINES statements in the copybook.
Click Next.
- Review the mappings on the Configure COBOL XOM
Mapping page.
You see the COBOL structure
that is derived from the copybook in the COBOL Structure pane.
The default Java class and class
attributes for a COBOL data item that is selected in the COBOL
Structure pane appear in the XOM Mapping pane.
If
you select a data item, all data items that map to the same Java class as the selected data
item are highlighted in bold with an equal sign (=) in the COBOL
Structure pane. These data items have an identical structure
therefore map to the same Java class
by default. If you see a data item in bold italic with an equal sign
in the COBOL Structure pane, at least one data
item with the identical structure exists when you expand the data
item. For more information, see Identical COBOL structures.
- Optional: Change the default mapping. For more
information, see Mapping COBOL structures to Java data types.
- Click Finish.
You
see the new XOM in the COBOL Execution Object Model pane
in the Properties window.
Results
The Rule Explorer now displays a Java project for the COBOL XOM.
You can
now use the COBOL XOM to create the BOM, as described in Creating a BOM entry from a XOM.