呼び出しスタブ・ジェネレーターの CSG.xml ファイル

CSG.xml ファイルには、<csg> カスタム・タスクを使用して Ant から、あるいは Ant ビルドとして Rational® Application Developer 内で、COBOL 呼び出しスタブ・ジェネレーターを開始する方法の完全な例が示されています。.

CSG.xml の入力プロパティー

次の表に、CSG.xml の入力プロパティーの説明を示します。<csg> タスクを Rational Application Developer グラフィカル・インターフェースで実行する場合、-Dproperty_name=property_value 形式を使用してプロパティーを定義できます。

表 1. CSG.xml の入力プロパティー. CSG.xml ファイルに、これらのプロパティーの値を指定します。
名前 必須またはオプション 説明
cobolSource 必須 COBOL ソース・ファイルの完全修飾パスを指定します。
トラブルの回避 (Avoid trouble) トラブルの回避 (Avoid trouble): すべてのパス名で、スラッシュ (/) を使用するか、 円記号を忘れずにエスケープ (¥¥) してください。gotcha

Rational Application Developer グラフィカル・インターフェースでは、${resource_loc} 組み込み変数を使用できます。これは、「パッケージ・エクスプローラー」で現在選択されているリソースの完全修飾パスに置換されます。

workSpace 必須 Java™ データ・バインディング・クラスの作成に使用する、Rational Application Developer ワークスペースまたは Eclipse ワークスペースのルート・ディレクトリーの完全修飾パスを指定します。

Rational Application Developer グラフィカル・インターフェースでは、${workspace_loc} 組み込み変数を使用できます。これは、現在アクティブなワークスペースの完全修飾パスに置換されます。

eclipseProjectName 必須 生成される Java クラスのホームを提供する、Rational Application Developer または Eclipse ワークスペース内のプロジェクトの名前を指定します。

Rational Application Developer グラフィカル・インターフェースでは、${project_name} 組み込み変数を使用できます。これは、「パッケージ・エクスプローラー」で現在選択されているリソースのプロジェクト名に置換されます。

このプロジェクトは、呼び出しスタブ・ジェネレーターを実行する前に存在していなければなりません。

callStubPackage 必須 生成される呼び出しスタブに使用するパッケージ名を指定します。

Rational Application Developer グラフィカル・インターフェースでは、 ${string_prompt:callStubPackage} 組み込み変数を使用できます。実行時に、Rational Application Developer は、ストリング値の入力を求めるプロンプトを出します。プロンプトのダイアログ・ボックスのタイトルは、callStubPackage です。

ファイルの場所

Ant ビルド・ファイル CSG.xml は、次のようなロケーションにあります。

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> 

トピックのタイプを示すアイコン 参照トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rgrid_csg_xml_file
ファイル名:rgrid_csg_xml_file.html