호출 스텁 생성기 CSG.xml 파일
CSG.xml 파일은 Ant 빌드로 Rational® Application Developer 내 또는 <csg> 사용자 정의 태스크를 사용하여 Ant에서 COBOL 호출 스텁 생성기를 시작하는 방법의 전체 예를 제공합니다.
CSG.xml 입력 특성
다음 테이블은 CSG.xml 입력 특성을 설명합니다. <csg> 태스크를 Rational Application Developer 그래픽 인터페이스에서 실행하면, -Dproperty_name=property_value 형식을 사용하여 특성을 정의할 수 있습니다.
Name | 필수 또는 선택사항 | 설명 |
---|---|---|
cobolSource | Required | COBOL 소스 파일에 대한 완전한 경로를 지정합니다.![]() Rational Application Developer 그래픽 인터페이스에서, ${resource_loc} 기본 제공 변수를 사용할 수 있으며, 이 변수는 패키지 탐색기에서 현재 선택된 자원의 완전한 경로로 대체됩니다. |
workSpace | Required | Java™ 데이터 바인딩 클래스를 작성할
Eclipse 작업공간 또는 Rational Application Developer의 루트 디렉토리에 대한 완전한 경로를 지정합니다. Rational Application Developer 그래픽 인터페이스에서, 현재 활성 작업공간의 완전한 경로로 대체되는 ${workspace_loc} 기본 제공 변수를 사용할 수 있습니다. |
eclipseProjectName | Required | 생성된 Java 클래스에 대한 홈을 제공하는 Rational Application Developer 또는 Eclipse 작업공간의 프로젝트
이름을 지정합니다. Rational Application Developer 그래픽 인터페이스에서, ${project_name} 기본 제공 변수를 사용할 수 있으며, 이 변수는 패키지 탐색기에서 현재 선택된 자원의 프로젝트 이름으로 대체됩니다. 호출 스텁 생성기를 실행하기 전에 프로젝트가 존재해야 합니다. |
callStubPackage | Required | 생성된 호출 스텁에 사용할 패키지 이름을 지정합니다. Rational Application Developer 그래픽 인터페이스에서, ${string_prompt:callStubPackage} 기본 제공 변수를 사용할 수 있습니다. 런타임 시, Rational Application Developer에서 문자열 값이 프롬프트됩니다. 프롬프트 대화 상자의 제목은 callStubPackage입니다. |
파일 위치
CSG.xml Ant 빌드 파일에는 다음과 같은 위치가 있습니다.
product_installation_root/CobolCallStubGenerator.V1.2/CSG.xml
CSG.xml 컨텐츠
제품과 함께 제공된 CSG.xml 파일은 다음 예와 유사합니다.
<?xml version="1.0" encoding="UTF-8"?>
<!-- ........................................................................... -->
<!-- This Ant build file is used for invoking the COBOLCallStubGenerator (CSG)
within Rational Application Developer. It has two steps:
1. Calls CSG for the given cobolSource file.
CSG is invoked using the custom <csg> task.
<csg> generates the Java call stub and the data binder Ant file.
2. Invokes the data binder Ant file that is generated by <csg>.
The data binder Ant file invokes the data binder and generates
the data binding Java classes for the COBOL parameters.
To configure this file for use within Rational Application Developer:
1. Run -> External Tools -> External Tools Configuration.
2. New Ant Build
Buildfile: full_path_to_this_file.xml
Arguments: -DcobolSource=${resource_loc}
-DworkSpace=${workspace_loc}
-DeclipseProjectName=${project_name}
-DcallStubPackage=${string_prompt:callStubPackage}
Refresh: project
Build: project
JRE: same as workspace (needs J2C tools installed)
Usage instructions:
1. Load the COBOL source into the project.
2. Select the COBOL source file or source directory in Project Explorer.
3. Click Run -> External Tools -> CSG Ant build. -->
<!-- ........................................................................... -->
<project default="CSG">
<property name="csgDir" value="${basedir}" />
<property name="debug" value="false" />
<!-- Include the <csg> and <radlogcheck> task definitions -->
<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="cobolSource" value="" /> <!-- full path to COBOL source file -->
<property name="workSpace" value="" /> <!-- full path to Eclipse workspace -->
<property name="eclipseProjectName" value="" />
<property name="callStubPackage" value="" />
<!-- The output from the <csg> task is the data binder Ant build file. The data binder Ant
build file invokes the data binder and generates the data binding classes for all
the COBOL parameters for all the COBOL files processed by <csg>. -->
<property name="antBuildFile" value="${workSpace}/${eclipseProjectName}/src/GenAllBindings.xml" />
<!-- Quick way to get the directory of the input COBOL file, in case you wanted to use it
to specify a list of files in the <fileset> type. -->
<dirname property="cobolSourceDir" file="${cobolSource}" />
<target name="CSG">
<csg configFile="${csgDir}/csg.properties"
workSpace="${workSpace}"
eclipseProjectName="${eclipseProjectName}"
antBuildFile="${antBuildFile}" >
<!-- In this example, the input is a single COBOL file, specified using a <fileset>.
You can modify the input to be a list of COBOL files, using either the
<fileset> or <filelist> types. For example, instead of using the cobolSource
property, you can use the cobolSourceDir property to specify all *.cbl files
in the directory or use <filelist> to list a subset of files in the directory.
Examples for setting the input to a list of files are included here, but commented out. -->
<fileset file="${cobolSource}" />
<!-- Example: Set the input to all *.cbl files in a directory: -->
<!-- <fileset dir="${cobolSourceDir}" includes="**/*.cbl" /> -->
<!-- Example: Set the input to a subset of files in a directory: -->
<!-- <filelist dir="${cobolSourceDir}" files="G10M0802.cbl primitve.ccp natltest.ccp" /> -->
<!-- Example: Associate all the nested files with the specified <cobolModule>: -->
<!-- <cobolModule libname="MyDLLName">
<fileset dir="${cobolSourceDir}" includes="**/*.ccp" />
</cobolModule> -->
<!-- You can specify multiple <cobolModule> elements. -->
<callStubPackage>${callStubPackage}</callStubPackage>
<!-- Example: You can use some internal call stub generator properties as substitution
variables. For example, to include the COBOL PROGRAM-ID ($_ProgramId_$) in the
callStubPackage: -->
<!-- <callStubPackage>${callStubPackage}.$_ProgramId_$</callStubPackage> -->
<!-- If not defined, the package name for the data binding classes is
${callStubPackage}.parameters. -->
<!-- <dataElementsPackage>${callStubPackage}.parameters</dataElementsPackage> -->
<!-- Example: Use substitution variables to prepend the COBOL PROGRAM-ID to the
parameter class name. -->
<!-- <dataElementsClass>$_ProgramId_$_$_DataElementName_$</dataElementsClass> -->
<!-- The Java package and class for the parameter identified by 'name' in COBOL
program 'programId' -->
<!-- <dataElement name="#REQUIRED" programId="#REQUIRED" packageName="" className="" /> -->
<!-- You can specify multiple <dataElement> elements. -->
</csg>
<!-- Refresh the workspace in order to compile the Java call stubs generated by <csg> -->
<eclipse.refreshLocal depth="infinite" resource="${eclipseProjectName}" />
<!-- radlogcheck first takes a snapshot of the Rational Application Developer log
(${workSpace}/.metadata/.log). Later, radlogcheck examines the log and searches
for any errors generated during this data binding step. -->
<radlogcheck workSpace="${workSpace}" stage="begin" />
<!-- Now run the data binder Ant build file that is generated by the <csg> task. -->
<ant antfile="${antBuildFile}" />
<!-- Scan the log for any errors that occured during the data binding step.
If errors are detected, the product writes them to the console. -->
<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>