Call stub generator CSGBatch.xml file
The CSGBatch.xml Ant build file provides an example for running <csg> against a batch of COBOL files, such as all *.cbl files in a directory. The call stub generator and CSGBatch.xml file are available with the IBM Rational Application Developer for WebSphere Software product.
CSGBatch.xml input properties
CSGBatch.xml uses the same input properties as the CSG.xml file. For CSG.xml input property descriptions, see the topic about the call stub generator CSG.xml file. For descriptions of the <csg> attributes and elements, see the topic about invoking the call stub generator from an Ant task.
If we run the <csg> task in the Rational Application Developer graphical interface, we can define the properties using the -Dproperty_name=property_value format.
CSGBatch.xml uses the $_ProgramId_$ and $_DataElementName_$ substitution variables to manipulate the package name and parameter names generated for each COBOL file.
File location
The CSGBatch.xml Ant build file has a location such as:
product_installation_root/CobolCallStubGenerator.V1.2/CSGBatch.xml
CSGBatch.xml contents
The CSGBatch.xml file provided with the product resembles the following example:
<?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
Related tasks
Generating COBOL call stubs Invoking the call stub generator from an Ant task Invoking the call stub generator from a graphical interface
Call stub generator CSG.xml file