Invoking the call stub generator from an Ant task
You can run the COBOL call stub generator from an Ant task.
Before you begin
Create a Rational® Application Developer project for the code that is generated by the COBOL call stub generator.
Create a call stub generator configuration file. Ensure that the settings for the EclipseHome, WorkSpace, and EclipseProjectName required properties are correct.
Check the PROCEDURE statement for the COBOL source file.
About this task
To run the COBOL call stub generator from an Ant task, you must create a <csg> task that specifies values for required attributes that identify the call stub generator configuration file and the COBOL source files that are used as source for the call stub generator. You also can specify values for optional attributes in the task. Table 1 describes supported <csg>, <cobolModule>, and <dataElement> attributes and nested elements that you can use in the <csg> task.
<callStubPackage>com.ibm.cobol.$_ProgramId_$</callStubPackage>
At
run time, the $_ProgramId_$ variable is substituted
with the COBOL PROGRAM-ID. If several COBOL files are specified by
the input <fileset> or <filelist>, then $_ProgramId_$ is
substituted with the PROGRAM-ID of each COBOL file as the call stub
generator iterates over the input file list.Name | Default value | Required or Optional | Description |
---|---|---|---|
<csg> attributes and nested elements | |||
configFile | Required | Specifies the fully qualified path to the call stub generator configuration file. | |
workSpace | Optional | Specifies the fully qualified path to the root
directory of the Rational Application Developer or
Eclipse workspace to be used to create the Java™ data binding class. Any value that is specified for workSpace overrides the WorkSpace value in the call stub generator configuration file, which is identified by the configFile value. |
|
eclipseProjectName | Optional | Specifies the name of the project in the Rational Application Developer or Eclipse workspace
that provides the home for the generated Java class. The project must exist before running the call stub generator. Any value that is specified for eclipseProjectName overrides the EclipseProjectName value in the call stub generator configuration file, which is identified by the configFile value. |
|
antBuildFile | ${workSpace}/${eclipseProjectName}/src/GenAllBindings.xml | Optional | Specifies the output location for the data binder Ant build file that is generated by the <csg> task. |
<fileset>, <filelist> | Required | Specifies one or more COBOL source files that provide input to the call stub generator. You can specify multiple <fileset> and <filelist> types. <fileset> and <filelist> types that are specified outside of a <cobolModule> element use the COBOL PROGRAM-ID as the COBOL module name. | |
<cobolModule> | Optional | Specifies the name of the COBOL module or DLL file that is associated with all the <fileset> and <filelist> files that are nested within the <cobolModule> element. You can specify multiple <cobolModule> elements. | |
<callStubPackage> | Required | Specifies the package name and the file path
of generated file to use for the generated call stub. For this element, you can specify an internal call stub generator property for the substitution variables $_ProgramId_$, the COBOL PROGRAM-ID, or $_CobolModule_$, the COBOL module. For example: <callStubPackage>com.ibm.cobol.$_ProgramId_$</callStubPackage> At run time, the $_ProgramId_$ variable is substituted with the COBOL PROGRAM-ID. |
|
<callStubClass> | COBOL program PROGRAM-ID | Optional | Specifies the class name to use for the generated
call stub. For this element, you can specify an internal call stub generator property for the substitution variables $_ProgramId_$, the COBOL PROGRAM-ID, or $_CobolModule_$, the COBOL module. |
<build> | Unknown Build | Optional | Specifies a user-assigned build identifier. |
<mockPackage> | Optional | Specifies the name of the package for the mock class. | |
<mockClass> | Optional | Specifies the name of the class to use for the mock test harness. | |
<dataElementsPackage> | {callStubPackage}.parameters | Optional | Specifies the package name to use for the data
binding classes of one or more COBOL parameters and the return value. For this element, you can specify an internal call stub generator property for the substitution variables $_DataElementName_$, the COBOL parameter name, $_ProgramId_$, the COBOL PROGRAM-ID, or $_CobolModule_$, the COBOL module. |
<dataElementsClass> | Parameter name | Optional | Specifies the class name to use for the data
binding classes of one or more COBOL parameters and the return value. For this element, you can specify an internal call stub generator property for the substitution variables $_DataElementName_$, the COBOL parameter name, $_ProgramId_$, the COBOL PROGRAM-ID, or $_CobolModule_$, the COBOL module. For example, to prepend the PROGRAM-ID onto the class names for the COBOL parameters and return value: <dataElementsClass>$_ProgramId_$_$_DataElementName_$</dataElementsClass> At run time, the $_ProgramId_$ variable is substituted with the COBOL PROGRAM-ID and the $_DataElementName_$ variable is substituted with the name of the COBOL parameter or return value. If the COBOL program has several parameters, then $_DataElementName_$ is substituted with the name of each COBOL parameter as the call stub generator iterates over them. |
<dataElement> | Optional | Specifies a package and class name for a COBOL parameter or return value. The parameter is identified using the name and programId attributes. The package and class names are specified using the packageName and className attributes. You can specify multiple <dataElement> elements. | |
<cobolModule> attributes and nested element | |||
libname | COBOL program PROGRAM-ID | Optional | Specifies the name of the COBOL module or DLL file that contains one or more COBOL programs. |
<fileset>, <filelist> | Required | Specifies one or more COBOL source files that provide input to the call stub generator. Each COBOL file is associated with the COBOL module that is defined by libname. | |
<dataElement> attributes | |||
name | Required | Specifies the name of the COBOL PROCEDURE parameter. | |
programId | Required | Specifies the PROGRAM-ID of the COBOL program that contains the parameter. | |
packageName | ${callStubPackage}.parameters | Optional | Specifies the package name to use for the data
binding class for this COBOL parameter or return value. For this attribute, you can specify an internal call stub generator property for the substitution variables $_DataElementName_$, the COBOL parameter name, $_ProgramId_$, the COBOL PROGRAM-ID, or $_CobolModule_$, the COBOL module. |
className | Parameter name | Optional | Specifies the class name to use for the data
binding class for this specific COBOL parameter or return value. For this attribute, you can specify an internal call stub generator property for the substitution variables $_DataElementName_$, the COBOL parameter name, $_ProgramId_$, the COBOL PROGRAM-ID, or $_CobolModule_$, the COBOL module. |
Procedure
Results
The command runs the call stub generator. If the command is successful, the call stub generator creates a Java call stub to run a COBOL program.
What to do next
Use the generated Java call stub to run a COBOL program.