呼び出しスタブ・ジェネレーターの CSGBatch.xml ファイル
Ant ビルド・ファイル CSGBatch.xml には、一連の COBOL ファイル (ディレクトリー内のすべての *.cbl ファイルなど) に対して <csg> を実行する例があります。呼び出しスタブ・ジェネレーターと CSGBatch.xml ファイルは、IBM® Rational® Application Developer for WebSphere® Software 製品で使用可能です。
CSGBatch.xml の入力プロパティー
CSGBatch.xml は、CSG.xml ファイルと同じ入力プロパティーを使用します。 CSG.xml 入力プロパティーの説明については、呼び出しスタブ・ジェネレーター CSG.xml ファイルに関するトピックを参照してください。 <csg> の属性およびエレメントの説明については、Ant タスクからの呼び出しスタブ・ジェネレーターの起動に関するトピックを参照してください。
<csg> タスクを Rational Application Developer グラフィカル・インターフェースで実行する場合、-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