Creating data binding using an Ant Script
You can use the CICS/IMS Data binding wizard to create
an Ant script simply by selecting Save session as Ant script.
Before you begin
- Discovery agents perform the actual import of data (see the performImport task in the script example) to produce data that is called import result.
- Resource writers consume the import result (see the writeToWorkspace task in the example script) to produce appropriate application artifacts.
About this task
During the import and generation steps, the discovery agent and the resource writer require a set of user input to be provided. The discovery agent and the resource writer can be paired invarious ways to import and generate the artifact that you want. They are identified by their name (QName). For example, the Cobol discovery agent is identified by the following name: {com/ibm/adapter}CobolDiscoveryAgent.
The following example describes the data discovery section
of the Ant script used to generate J2C Data Binding:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:adapter="http://com.ibm.adapter" default="DataBinding1" name="/Test1/DFHCOMMAREA.xml">
<delete file="error.txt"/>
<property name="debug" value="true"/>
<property name="project1" value="Test1"/>
<target name="DataBinding1">
<adapter:createProject projectName="${project1}" projectType="Java"/>
<adapter:discover>
<adapter:performImport agent="{com/ibm/adapter}CobolDiscoveryAgent">
<adapter:importResource>
<adapter:propertyGroup name="CobolFileGroup">
<adapter:propertyElement name="CobolFile" value="D:\samples\CICS\taderc99\taderc99.cbl"/>
</adapter:propertyGroup>
</adapter:importResource>
<adapter:queryProperties>
<adapter:propertyGroup name="ImportProperties">
<adapter:propertyElement name="Platform" value="Win32"/>
<adapter:propertyElement name="Codepage" value="ISO-8859-1"/>
<adapter:propertyElement name="Numproc" value="PFD"/>
<adapter:propertyElement name="FloatingPointFormat" value="IEEE 754"/>
<adapter:propertyGroup name="ExternalDecimalSignGroup">
<adapter:propertyElement name="ExternalDecimalSign" value="ASCII"/>
</adapter:propertyGroup>
<adapter:propertyGroup name="EndianGroup">
<adapter:propertyElement name="Endian" value="Little"/>
<adapter:propertyElement name="RemoteEndian" value="Little"/>
</adapter:propertyGroup>
<adapter:propertyGroup name="CompileOptions">
<adapter:propertyElement name="Quote" value="DOUBLE"/>
<adapter:propertyElement name="Trunc" value="STD"/>
<adapter:propertyElement name="Nsymbol" value="DBCS"/>
</adapter:propertyGroup>
</adapter:propertyGroup>
</adapter:queryProperties>
<adapter:queryResult>
<adapter:selectElement name="DFHCOMMAREA"/>
</adapter:queryResult>
</adapter:performImport>
<adapter:writeToWorkspace writer="{com/ibm/adapter/cobol/writer}JAVA_WRITER">
<adapter:propertyGroup name="COBOLToJavaResourceWriter">
<adapter:propertyGroup name="Java Type Name">
<adapter:propertyElement name="Project Name" value="${project1}"/>
<adapter:propertyElement name="Package Name" value="sample.mm"/>
<adapter:propertyElement name="Class Name" value="DFHCOMMAREA"/>
<adapter:propertyElement name="Overwrite existing class" value="true"/>
<adapter:propertyElement name="GenerationStyle" value="Default"/>
</adapter:propertyGroup>
</adapter:propertyGroup>
</adapter:writeToWorkspace>
</adapter:discover>
<eclipse.refreshLocal depth="infinite" resource="${project1}"/>
<eclipse.incrementalBuild project="${project1}"/>
<condition property="errorexist">
<available file="error.txt" property="errorexist"/>
</condition>
<fail if="errorexist" message="BUILD Failed: please see workspace log file or error.txt for details."/>
</target>
</project>
Here are the details for two tasks in the script: