调用存根生成器 CSGBatch.xml 文件
Ant 构建文件 CSGBatch.xml 提供了一个针对一批 COBOL 文件(例如,某个目录中的所有 *.cbl 文件)运行 <csg> 的示例。调用存根生成器和 CSGBatch.xml 文件是随 IBM® Rational® Application Developer for WebSphere® 软件产品一起提供的。
CSGBatch.xml 输入属性
CSGBatch.xml 使用 CSG.xml 文件所使用的那些输入属性。有关 CSG.xml 输入属性描述,请参阅有关调用存根生成器 CSG.xml 文件的主题。有关 <csg> 属性和元素的描述,请参阅有关从 Ant 任务调用该调用存根生成器的主题。
如果您在 Rational Application Developer 图形界面中运行 <csg> 任务,那么可以使用 -Dproperty_name=property_value 格式来定义属性。
CSGBatch.xml 使用 $_ProgramId_$ 和 $_DataElementName_$ 替换变量来处理为每个 COBOL 文件生成的软件包名称和参数名称。
文件位置
Ant 构建文件 CSGBatch.xml 的位置如下:
product_installation_root/CobolCallStubGenerator.V1.2/CSGBatch.xml
CSGBatch.xml 内容
随产品提供的 CSGBatch.xml 文件类似于以下示例:
<?xml version="1.0" encoding="UTF-8"?>
<!-- .......................................................................... -->
<!-- This Ant build file can run the COBOLCallStubGenerator (CSG) within Rational
Application Developer. See CSG.xml for a more complete description of this file.
Except this file takes a directory of COBOL files (*.cbl) and runs <csg> against
each file.
Note: This file is configured to append the COBOL PROGRAM-ID to the callStubPackage
and to prepend the PROGRAM-ID to each parameter name (see the <callStubPackage>
and <dataElementsClass> elements). -->
<!-- .......................................................................... -->
<project default="CSGBatch">
<property name="csgDir" value="${basedir}" />
<property name="debug" value="false" />
<taskdef resource="com/ibm/ws/batch/cobol/ant/callstub/antlib.xml"
classpath="${csgDir}/lib/COBOLCallStubGenerator.jar"/>
<!-- These input properties are required. They can be specified as arguments to the Ant build. -->
<property name="cobolSourceDir" value="" /> <!-- full path to COBOL source directory -->
<property name="workSpace" value="" /> <!-- full path to Eclipse workspace -->
<property name="eclipseProjectName" value="" />
<property name="callStubPackage" value="" />
<property name="antBuildFile" value="${workSpace}/${eclipseProjectName}/src/GenAllBindings.xml" />
<target name="CSGBatch">
<csg configFile="${csgDir}/csg.properties"
workSpace="${workSpace}"
eclipseProjectName="${eclipseProjectName}"
antBuildFile="${antBuildFile}" >
<!-- Process all *.cbl files in the given cobolSourceDir. -->
<fileset dir="${cobolSourceDir}" includes="**/*.cbl" />
<!-- Append the COBOL PROGRAM-ID to the callStubPackage using substitution variables. -->
<callStubPackage>${callStubPackage}.$_ProgramId_$</callStubPackage>
<!-- Prepend the COBOL PROGRAM-ID to the parameter class name using substitution variables. -->
<dataElementsClass>$_ProgramId_$_$_DataElementName_$</dataElementsClass>
</csg>
<eclipse.refreshLocal depth="infinite" resource="${eclipseProjectName}" />
<!-- Run the data binder in a radlogcheck to detect and print errors. -->
<radlogcheck workSpace="${workSpace}" stage="begin" />
<ant antfile="${antBuildFile}" />
<radlogcheck workSpace="${workSpace}" stage="end" />
<!-- Delete the antBuildFile. It is no longer needed and is merely a build artifact. -->
<delete file="${antBuildFile}" failonerror="false"/>
</target>
</project