LoginSignup
0
0

z/OS利用時の文字コード変換 - 動作検証(4) カタカナ系文字コードにおけるPDSメンバー名

Last updated at Posted at 2024-02-11

はじめに

日本語の文字コードとしては英小文字系と呼ばれるもの(CCSID:939/5035/1399)、カタカナ系と呼ばれるもの(CCSID:930/5026/1390)の2種類に大別されます。
また、z/OSのリソースを外部とやり取りを行う際ファイルの転送を伴う場合は、「ファイルの中身のデータ」と「ファイル名」は個別に考慮する必要があります。特にファイル名(z/OS上だとPDSメンバー名)はプラットフォームで使用できる文字の制限が違っていたり、コード変換が行われる仕組みがデータ部分とは異なっていたりするのやっかいです。

ここでは、主にCOBOLのCOPYBOOKのメンバー名として「$(¥)」記号(x'5B')を使用していて、かつ、カタカナ系の文字コードを使用しているケースについて、Git、VS Code、IDzなどを使用する場合の動作について試してみたいと思います。

関連記事

z/OS利用時の文字コード変換 - 動作検証(1) 各ツールでの文字列表示
z/OS利用時の文字コード変換 - 動作検証(2) Git利用時のコード変換
z/OS利用時の文字コード変換 - 動作検証(3) DBBユーザー・ビルド時のコード変換
z/OS利用時の文字コード変換 - 動作検証(4) カタカナ系文字コードにおけるPDSメンバー名

前提の整理

英小文字系/カタカナ系コードページ

まず、英小文字系(939/5035/1399)とカタカナ系(930/5026/1390)についておさらいです。両者はDBCSのコードポイントについては同じですが、SBCSのコードポイントが一部異なっています。

image.png

PDSメンバー名の制約

Gitなどオープン系の仕組みを利用してz/OS上のリソース(COBOLのソースやJCLなど)を管理しようとした場合、管理対象のファイルに含まれるデータと、ファイル名(PDSメンバー名)は個別に考えておく必要があります。これまでの記事ではファイルに含まれるデータ部分のみに着目していましたが、ここではファイル名(PDSメンバー名)に着目します。

Member name conventions

上のマニュアルの記述にある通り、メンバー名として使用できる英数字以外の記号は以下の3つです。
@ (x'7C'), # (x'7B'), $ (x'5B')

このうち、$(x'5B')については、英小文字系の文字コードとカタカナ系の文字コードで文字とコードポイントのマッピングが異なります。
つまり、z/OSとしてはHexで言うとx'5B'という記号は使えますが、英小文字系だとそれは$として扱われますし、カタカナ系だと¥として扱われることになります。

※英語圏だと基本的には英小文字系のコードページと同じマッピングなので、マニュアル上などは通常は$として表記されています。

また、当然のことながらPDSメンバー名として使用できる文字数は8文字以下です。

PDSメンバー/ファイルに含まれる記号

PDSのメンバーは、他のプラットフォームに持っていくとそれは"ファイル"として扱われます。プラットフォームによって扱えるファイル名の制限があるので、記号が含まれるPDSメンバー/ファイルを複数のプラットフォーム間でやりとりするのはかなり注意が必要です。先に上げたように、PDSメンバーとして利用可能な記号のうち$(x'5B')はカタカナ系の文字コードの場合¥として扱われるのでかなりやっかいです。
EBCDICやUnicodeでは\(バックスラッシュ)と¥(円記号)は当然それぞれ別の文字として識別されるわけですが、ASCIIで扱われる\(バックスラッシュ:x'5C')が日本語環境のWindows(SJIS)では¥表記になるということで、いわゆる「円記号問題」が発生します。
参考: Wikipedia-円記号

$ ¥ \ のコードポイントとのマッピングを、UTF-8、IBM-1399(英小文字系)、IBM-1390(カタカナ系) で整理すると以下のようになります。

文字 Unicode UTF-8 IBM-1399 IBM-1390 補足
$ U+0024 24 5B E0 ドル記号
¥ U+00A5 C2A5 B2 5B 円記号
\ U+005C 5C E0 B2 バックスラッシュ

WindowsではNTFSファイルシステムだとファイル名はUnicodeで保持されているようです。
参考: Character Sets Used in File Names

NTFS stores file names in Unicode. In contrast, the older FAT12, FAT16, and FAT32 file systems use the OEM character set.
...
Windows code page and OEM code page character sets used on Japanese-language operating systems contain the Yen symbol (¥) instead of a backslash (). Thus, the Yen symbol is a prohibited character for NTFS and FAT file systems. When mapping Unicode to a Japanese-language code page, WideCharToMultiByte and other conversion functions map both backslash (U+005C) and the normal Unicode Yen symbol (U+00A5) to this same character. For security reasons, your applications should not typically allow the character U+00A5 in a Unicode string that might be converted for use as a FAT file name.

Windows上で使用する機能や入力/表示の方法によって、Unicodeで言うところの\(U+005C)は¥として扱われます。
最近だとWIndows11の最新版ではコマンド・プロンプトの表記はディレクトリ区切りが\と表記されるようになりましたが、Explorerでは¥で表示されています。
image.png

image.png

このようにWindows上はディレクトリの区切り文字としてU+005Cが使われるので、ファイル名にU+005Cの文字は使えません。ただ、Unicodeでいうところの¥(U+00A5)であれば使用はできます。
つまり、ファイル名としてはバックスラッシュとしての¥は使用できませんが、本来の円記号としての¥は使用できるということになります(ただし混乱の元になるので推奨はされません)。

例えば、エクスプローラー上でファイルを作成してファイル名を指定する際に、日本語キーボードの右上の「¥」のキーを入れると、それはバックスラッシュとしての¥(x'5C')が入力されることになるので、"その文字は使えませんよ"という警告が出ます。
image.png
この吹き出しにも¥が示されていますが、これもバックスラッシュとしての¥です。一つ上のファイルに「test02¥.txt」というファイルが作成できているのが分かる通り、本来の¥(円記号: U+00A5)であればファイル名に使えます。

Windowsだとこのようにバックスラッシュと円記号がかなりややこしい話になっています。
そのため、PDSメンバー名にx'5B'の文字が含まれていて、かつ、カタカナ系の文字コードを使用している場合、そのメンバーをオープン系プラットフォームで扱う場合にはかなり面倒な問題が生じる可能性があります。(当記事の検証結果に示す通り実際にいくつか問題が生じています。)


つまるところ、カタカナ系文字コードを使用している場合、オープン系の仕組みを使用してファイルを扱う場合(z/OSだけで完結しない場合)、メンバー名としてx'5B'記号は使わないようにする、というのが定石であろうと思います。

環境情報

z/OS V2.4
Windows11
PCOM V14
IDz V15.0.5
VS Code V1.77.3
Zowe Explorer V2.7
IBM Z Open Editor V3.1.1
GitHub Enterprise

動作検証

ここでは、COPYBOOKのメンバー名に「$/¥」(x'5B')が含まれているという想定で、各種操作を見ていきます。

1. 各種エディターでのPDSメンバー名表示

単純に名前にx'5B'を含むPDSメンバーを表示させてみます。

image.png

1-1.PCOM

1-1-(1)英小文字系(1399)

【設定】
image.png

【動作確認】
image.png

「CPPRM$4」というメンバー名に見えます

1-1-(2)カタカナ系(1390)

【設定】
image.png

【動作確認】
image.png

「CPPRM¥4」というメンバー名に見えます
(英小文字部分がカタカナに置き換わって見えるのはここでは想定通り)

1-2.VS Code

1-2-(1)英小文字系(1399)

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_1399": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1399"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
...

【動作確認】
image.png

「CPPRM$4」というメンバー名に見えます

1-2-(2)カタカナ系(1390)

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_1390": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1390"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                },
                "rse": {
                    "type": "rse",
                    "properties": {
                        "port": 8195,
                        "basePath": "rseapi/api/v1",
                        "encoding": "IBM-1390"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
...

【動作確認】
image.png

z/OSMF経由とRSEAPI経由の2つのプロトコルでの接続を試しましたが、どちらも「CPPRM$4」というメンバー名に見えてしまっています。おそらくメンバー名のコード変換はProfileのencoding指定ではなく英小文字系(037/1047)が固定で使われてしまっているものと思われます。

これに関連しそうなものとしては、APAR PH39690 によりz/OS V2.4, V2.5の機能拡張が提供されています。このAPARでは、z/OSMFのREST APIで、メンバー名についてのencodingを明示的に指定するためのヘッダーX-IBM-Dsname-Encodingが提供されるようです。VS CodeのZowe Explorer Extensionでこれがサポートされれば改善される可能性はあるかもしれません。

1-3.IDz

1-3-(1)英小文字系(1399)

【設定】
image.png

【動作確認】
image.png

1-3-(2)カタカナ系(1390)

【設定】
image.png

【動作確認】
image.png

「CPPRM¥4」というメンバー名に見えます

2.PDSメンバーのCOPYBOOK参照

VS CodeやIDzでは、COBOLソースからCOPYBOOkを参照している場合、ソースから参照先のCOPYBOOKを探索して中身を参照したり構文解析に使用する、といったことができます。
これがうまく機能するか見ていきます。

image.png

2-1.VS Code

2-1-(1)英小文字系(1399)

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_1399": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1399"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
...
xxx.code-workspace
...
	"settings": {
		"zopeneditor.zowe": {
			"defaultCliProfile": "isecloud_wazi01_1399.zosmf"
		}
	}
...
zapp.yaml
name: VSCode01
description: For IBM Z Open Editor 3.0.0 or newer. Wazi's code samples with COBOL, PL/I, and HLASM applications
version: 3.0.0
author:
  name: ISE

propertyGroups:
  - name: cobol-copyooks
    language: cobol
    compilerOptions: options
    libraries:
      - name: syslib
        type: mvs
        locations:
          - TAGUCHI.TEST01.COBOL.COPYLIB

【動作確認】
image.png

意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

2-1-(2)カタカナ系(1390)/zOSMF

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_1390": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1390"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                },
                "rse": {
                    "type": "rse",
                    "properties": {
                        "port": 8195,
                        "basePath": "rseapi/api/v1",
                        "encoding": "IBM-1390"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
...
xxx.code-workspace
...
	"settings": {
		"zopeneditor.zowe": {
			"defaultCliProfile": "isecloud_wazi01_1390.zosmf"
		}
	}
...
zapp.yaml
...
name: VSCode01
description: For IBM Z Open Editor 3.0.0 or newer. Wazi's code samples with COBOL, PL/I, and HLASM applications
version: 3.0.0
author:
  name: ISE

propertyGroups:
  - name: cobol-copyooks
    language: cobol
    compilerOptions: options
    libraries:
      - name: syslib
        type: mvs
        locations:
          - TAGUCHI.TEST01.COBOL.COPYLIB
...

【動作確認】
image.png

COPYBOOKの参照が機能しなかった! 恐らく、ソース中のCOPYステートメントでは「CPPARM¥4」というメンバーを探しに行こうとするが、メンバー名としては「CPPARM$4」として認識しているために見つからないのだと推察されます。

※ちなみにx'5B'の記号を含まないメンバーの探索であれば同じ設定で問題なく行えています。

2-1-(3)カタカナ系(1390)/RSEAPI

念のため、RSEAPIでも試してみます。

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_1390": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1390"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                },
                "rse": {
                    "type": "rse",
                    "properties": {
                        "port": 8195,
                        "basePath": "rseapi/api/v1",
                        "encoding": "IBM-1390"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
...
xxx.code-workspace
...
	"settings": {
		"zopeneditor.zowe": {
			"defaultCliProfile": "isecloud_wazi01_1390.rse"
		}
	}
...
zapp.yaml
...
name: VSCode01
description: For IBM Z Open Editor 3.0.0 or newer. Wazi's code samples with COBOL, PL/I, and HLASM applications
version: 3.0.0
author:
  name: ISE

propertyGroups:
  - name: cobol-copyooks
    language: cobol
    compilerOptions: options
    libraries:
      - name: syslib
        type: mvs
        locations:
          - TAGUCHI.TEST01.COBOL.COPYLIB
...

【動作確認】
image.png

COPYBOOKの参照が機能しなかった! 恐らく、ソース中のCOPYステートメントでは「CPPARM¥4」というメンバーを探しに行こうとするが、メンバー名としては「CPPARM$4」として認識しているために見つからないのだと推察されます。

※ちなみにx'5B'の記号を含まないメンバーの探索であれば同じ設定で問題なく行えています。

2-2.IDz

2-2-(1)英小文字系(1399)

【設定】
image.png

【動作確認】
image.png

意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

2-2-(2)カタカナ系(1390)

【設定】
image.png

【動作確認】
image.png

意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

3.Gitでのソース管理 / IDEからのUser Build

Git上でCOBOLソース、COPYBOOKを管理し、VS Code/IDzからDBBのUser Buildを実行するシナリオで、メンバー名にx5Bが含まれるケースを試してみます。

image.png

3-0.GitHubのリモートリポジトリの準備

GitHub上にリポジトリを作成して、英小文字系、カタカナ系それぞれのテスト用のファイルを配置しておきます。

3-0-(1)英小文字系(1399)

1399というブランチを作成して、「CPPARM$4.cpy」というCOPYBOOKを作成し、「TSUB04.cbl」というCOBOLソースから参照するようにしています。
image.png
image.png

また、.gitattributesでは、*.cpy, *.cblともにibm-1399でコード変換するような指定にしています。
image.png

3-0-(2)カタカナ系(1390)

1390というブランチを作成して、「CPPARM¥5.cpy」というCOPYBOOKを作成し、「TSUB05.cbl」というCOBOLソースから参照するようにしています。
image.png
image.png

また、.gitattributesでは、*.cpy, *.cblともにibm-1390でコード変換するような指定にしています。
image.png

3-1.VS Code

VS CodeからGitのリポジトリをクローンし、DBBを使用してUser Buildを実行してみます。

3-1-(1)英小文字系(1399)

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_dbb_1399": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1399"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
...
xxx.code-workspace
...
	"settings": {
		"zopeneditor.zowe": {
			"defaultCliProfile": "isecloud_wazi01_dbb_1399.zosmf",
			"defaultSshCliProfile": "isecloud_wazi01_dbb_1399.ssh"
		},
		"zopeneditor.userbuild.userSettings": {
			"dbbWorkspace": "/u/TAGUCHI/projects",
			"dbbHlq": "TAGUCHI.DBB",
			"dbbLogDir": "/u/TAGUCHI/projects/logs",
			"dbbDefaultZappProfile": "dbb-userbuild"
		}
	}
...

zapp.yaml
name: VSCode01
description: For IBM Z Open Editor 3.0.0 or newer. Wazi's code samples with COBOL, PL/I, and HLASM applications
version: 3.0.0
author:
  name: IBM CORPORATION

propertyGroups:
  - name: cobol-copybooks
    language: cobol
    libraries:
      - name: syslib
        type: local
        locations:
          - "**/copybook"
profiles:
  - name: dbb-userbuild
    type: dbb
    settings:
      application: zosgittest01
      command: $DBB_HOME/bin/groovyz
      buildScriptPath: /u/ibmuser/dbb-zappbuild/build.groovy
      buildScriptArgs:
        - --userBuild
        - --workspace ${zopeneditor.userbuild.userSettings.dbbWorkspace}
        - --application ${application}
        - --hlq ${zopeneditor.userbuild.userSettings.dbbHlq}
        - --outDir ${zopeneditor.userbuild.userSettings.dbbLogDir}
        - --dependencyFile ${dependencyFile}
      additionalDependencies:
        - application-conf
      logFilePatterns:
        - ${buildFile.basename}.log
        - BuildReport.*

【動作確認】

COPYBOOK参照
image.png
意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

続いて、このソースに対してDBB, zAppBuildを利用したUser Buildを実行してみます。
COPYBOOK、COBOLソースともにUSS経由で転送されて、コンパイルがうまく実行されました。

User Build 実行時のログ
=====================
Running User Build...
Identified the local root workspace path as c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01
---------------------
Checking dbb profile settings defined in your repository's zapp.yaml or zapp.json
User setting dbbDefaultZappProfile: **dbb-userbuild**
Will read settings from ZAPP profile called dbb-userbuild defined in User Settings
    application: zosgittest01
    command: $DBB_HOME/bin/groovyz
    buildScriptArgs: --userBuild,--workspace /u/TAGUCHI/projects,--application zosgittest01,--hlq TAGUCHI.DBB,--outDir /u/TAGUCHI/projects/logs,--dependencyFile ${dependencyFile}
    buildScriptPath: /u/ibmuser/dbb-zappbuild/build.groovy
    additionalDependencies: application-conf
    logFilePatterns: TSUB04.log,BuildReport.*
---------------------
Checking user settings...
User settings should be defined in your VS Code or Theia Settings under zopeneditor.userbuild.userSettings
    dbbWorkspace: /u/TAGUCHI/projects
    dbbHlq: TAGUCHI.DBB
    dbbLogDir: /u/TAGUCHI/projects/logs
    dbbDefaultZappProfile: dbb-userbuild
    localLogDir: **Optional setting is missing**
Using .gitattributes file at c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01\.gitattributes
---------------------
The default Zowe CLI profile specified as isecloud_wazi01_dbb_1399.zosmf in zopeneditor.zowe setting. Will try loading that.
Using Zowe profile isecloud_wazi01_dbb_1399.zosmf
Using ssh profile isecloud_wazi01_dbb_1399.ssh

Checking if SSH profile isecloud_wazi01_dbb_1399.ssh can connect:
Connected successfully.

Executing SSH command: 
mkdir -p '/u/TAGUCHI/projects/zosgittest01/cobol'
$
Uploading file c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01\cobol\TSUB04.cbl to /u/TAGUCHI/projects/zosgittest01/cobol/TSUB04.cbl with encoding ibm-1399
Using ssh profile isecloud_wazi01_dbb_1399.ssh
Executing SSH command: 
chtag -tc ibm-1399 '/u/TAGUCHI/projects/zosgittest01/cobol/TSUB04.cbl'
$
Fetching build file dependencies...
Found a total of 1 local include files:
c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01\copybook\CPPARM$4.cpy
Executing SSH command: 
mkdir -p '/u/TAGUCHI/projects/zosgittest01/copybook'
$
Checking if include files were updated since the last build...
Updating 1/1 local include files.
Uploading file c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01\copybook\CPPARM$4.cpy to /u/TAGUCHI/projects/zosgittest01/copybook/CPPARM$4.cpy with encoding ibm-1399
Using ssh profile isecloud_wazi01_dbb_1399.ssh
Executing SSH command: 
chtag -tc ibm-1399 '/u/TAGUCHI/projects/zosgittest01/copybook/CPPARM$4.cpy'
$
---------------------
Generating the local dependencies file for this build in C:\Users\A00527~1\AppData\Local\Temp\.userbuilddependencies
No encoding found for .userbuilddependencies. Assigning default encoding utf-8
Uploading file C:\Users\A00527~1\AppData\Local\Temp\.userbuilddependencies to /u/TAGUCHI/projects/logs/.userbuilddependencies with encoding utf-8
Using ssh profile isecloud_wazi01_dbb_1399.ssh
Executing SSH command: 
chtag -tc utf-8 '/u/TAGUCHI/projects/logs/.userbuilddependencies'
$
Executing SSH command: 
$DBB_HOME/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --userBuild --workspace /u/TAGUCHI/projects --application zosgittest01 --hlq TAGUCHI.DBB --outDir /u/TAGUCHI/projects/logs --dependencyFile /u/TAGUCHI/projects/logs/.userbuilddependencies '/u/TAGUCHI/projects/zosgittest01/cobol/TSUB04.cbl'
$ 
** Build start at 20230429.103829.038
** Build output located at /u/TAGUCHI/projects/logs
** Adding /u/TAGUCHI/projects/zosgittest01/cobol/TSUB04.cbl to Building build list
** Writing build list file to /u/TAGUCHI/projects/logs/buildList.txt
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
** Building files mapped to Cobol.groovy script
*** Building file zosgittest01/cobol/TSUB04.cbl
** Writing build report data to /u/TAGUCHI/projects/logs/BuildReport.json
** Writing build report to /u/TAGUCHI/projects/logs/BuildReport.html
** Build ended at Sat Apr 29 22:38:35 JST 2023
** Build State : CLEAN
** Total files processed : 1
** Total build time  : 5.566 seconds
** Build finished
Looking for user build logs in "/u/TAGUCHI/projects/logs".
Executing SSH command: 
find /u/TAGUCHI/projects/logs -type f -name 'TSUB04.log'
$ /u/TAGUCHI/projects/logs/TSUB04.log
Executing SSH command: 
find /u/TAGUCHI/projects/logs -type f -name 'BuildReport.*'
$ /u/TAGUCHI/projects/logs/BuildReport.html
/u/TAGUCHI/projects/logs/build.20230314.155816.058/BuildReport.json
/u/TAGUCHI/projects/logs/build.20230314.155816.058/BuildReport.html
/u/TAGUCHI/projects/logs/BuildReport.json
Total log files found: 5
Downloading logs to c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01\logs
Downloading log file /u/TAGUCHI/projects/logs/TSUB04.log. Binary: false
Downloading log file /u/TAGUCHI/projects/logs/BuildReport.html. Binary: true
Downloading log file /u/TAGUCHI/projects/logs/build.20230314.155816.058/BuildReport.json. Binary: true
Downloading log file /u/TAGUCHI/projects/logs/build.20230314.155816.058/BuildReport.html. Binary: true
Downloading log file /u/TAGUCHI/projects/logs/BuildReport.json. Binary: true
Successfully finished downloading of 5 log files to c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1399\zosgittest01\logs.

転送されたPDSメンバーを見てみます。
image.png
意図した通り、「CPPARM$4」というメンバーが作成されています。

3-1-(2)カタカナ系(1390)

【設定】

zowe.config.user.json
...
        "isecloud_wazi01_dbb_1390": {
            "properties": {
                "host": "wazi01"
            },
            "profiles": {
                "zosmf": {
                    "type": "zosmf",
                    "properties": {
                        "port": 10443,
                        "encoding": "IBM-1390"
                    }
                },
                "ssh": {
                    "type": "ssh",
                    "properties": {
                        "port": 22,
                        "privateKey": "C:\\Users\\A00527JP6\\.ssh\\ISECloud2023\\id_rsa_wazi"
                    }
                }
            },
            "secure": [
                "user",
                "password"
            ]
        },
        "base": {
            "type": "base",
            "properties": {
                "rejectUnauthorized": false
            }
        }
...
xxx.code-workspace
...
	"settings": {
		"zopeneditor.zowe": {
			"defaultCliProfile": "isecloud_wazi01_dbb_1390.zosmf",
			"defaultSshCliProfile": "isecloud_wazi01_dbb_1390.ssh"
		},
		"zopeneditor.userbuild.userSettings": {
			"dbbWorkspace": "/u/TAGUCHI/projects",
			"dbbHlq": "TAGUCHI.DBB2",
			"dbbLogDir": "/u/TAGUCHI/projects/logs",
			"dbbDefaultZappProfile": "dbb-userbuild"
		}
	}
...

zapp.yaml
name: VSCode01
description: For IBM Z Open Editor 3.0.0 or newer. Wazi's code samples with COBOL, PL/I, and HLASM applications
version: 3.0.0
author:
  name: IBM CORPORATION

propertyGroups:
  - name: cobol-copybooks
    language: cobol
    libraries:
      - name: syslib
        type: local
        locations:
          - "**/copybook"
profiles:
  - name: dbb-userbuild
    type: dbb
    settings:
      application: zosgittest01
      command: $DBB_HOME/bin/groovyz
      buildScriptPath: /u/ibmuser/dbb-zappbuild/build.groovy
      buildScriptArgs:
        - --userBuild
        - --workspace ${zopeneditor.userbuild.userSettings.dbbWorkspace}
        - --application ${application}
        - --hlq ${zopeneditor.userbuild.userSettings.dbbHlq}
        - --outDir ${zopeneditor.userbuild.userSettings.dbbLogDir}
        - --dependencyFile ${dependencyFile}
      additionalDependencies:
        - application-conf
      logFilePatterns:
        - ${buildFile.basename}.log
        - BuildReport.*

【動作確認】

COPYBOOK参照
image.png
意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

続いて、このソースに対してDBB, zAppBuildを利用したUser Buildを実行してみます。

ビルドがエラーになりました。

User Build 実行時のログ
=====================
Running User Build...
Identified the local root workspace path as c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1390\zosgittest01
---------------------
Checking dbb profile settings defined in your repository's zapp.yaml or zapp.json
User setting dbbDefaultZappProfile: **dbb-userbuild**
Will read settings from ZAPP profile called dbb-userbuild defined in User Settings
    application: zosgittest01
    command: $DBB_HOME/bin/groovyz
    buildScriptArgs: --userBuild,--workspace /u/TAGUCHI/projects,--application zosgittest01,--hlq TAGUCHI.DBB2,--outDir /u/TAGUCHI/projects/logs,--dependencyFile ${dependencyFile}
    buildScriptPath: /u/ibmuser/dbb-zappbuild/build.groovy
    additionalDependencies: application-conf
    logFilePatterns: TSUB05.log,BuildReport.*
---------------------
Checking user settings...
User settings should be defined in your VS Code or Theia Settings under zopeneditor.userbuild.userSettings
    dbbWorkspace: /u/TAGUCHI/projects
    dbbHlq: TAGUCHI.DBB2
    dbbLogDir: /u/TAGUCHI/projects/logs
    dbbDefaultZappProfile: dbb-userbuild
    localLogDir: **Optional setting is missing**
Using .gitattributes file at c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1390\zosgittest01\.gitattributes
---------------------
The default Zowe CLI profile specified as isecloud_wazi01_dbb_1390.zosmf in zopeneditor.zowe setting. Will try loading that.
Using Zowe profile isecloud_wazi01_dbb_1390.zosmf
Using ssh profile isecloud_wazi01_dbb_1390.ssh

Checking if SSH profile isecloud_wazi01_dbb_1390.ssh can connect:
Connected successfully.

Executing SSH command: 
mkdir -p '/u/TAGUCHI/projects/zosgittest01/cobol'
$
Uploading file c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1390\zosgittest01\cobol\TSUB05.cbl to /u/TAGUCHI/projects/zosgittest01/cobol/TSUB05.cbl with encoding ibm-1390
Using ssh profile isecloud_wazi01_dbb_1390.ssh
Executing SSH command: 
chtag -tc ibm-1390 '/u/TAGUCHI/projects/zosgittest01/cobol/TSUB05.cbl'
$
Fetching build file dependencies...
Found a total of 1 local include files:
c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1390\zosgittest01\copybook\CPPARM¥5.cpy
Executing SSH command: 
mkdir -p '/u/TAGUCHI/projects/zosgittest01/copybook'
$
Checking if include files were updated since the last build...
Updating 1/1 local include files.
Uploading file c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1390\zosgittest01\copybook\CPPARM¥5.cpy to /u/TAGUCHI/projects/zosgittest01/copybook/CPPARM%C2%A55.cpy with encoding ibm-1390
Using ssh profile isecloud_wazi01_dbb_1390.ssh
Executing SSH command: 
chtag -tc ibm-1390 '/u/TAGUCHI/projects/zosgittest01/copybook/CPPARM%C2%A55.cpy'
$
---------------------
Generating the local dependencies file for this build in C:\Users\A00527~1\AppData\Local\Temp\.userbuilddependencies
No encoding found for .userbuilddependencies. Assigning default encoding utf-8
Uploading file C:\Users\A00527~1\AppData\Local\Temp\.userbuilddependencies to /u/TAGUCHI/projects/logs/.userbuilddependencies with encoding utf-8
Using ssh profile isecloud_wazi01_dbb_1390.ssh
Executing SSH command: 
chtag -tc utf-8 '/u/TAGUCHI/projects/logs/.userbuilddependencies'
$
Executing SSH command: 
$DBB_HOME/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --userBuild --workspace /u/TAGUCHI/projects --application zosgittest01 --hlq TAGUCHI.DBB2 --outDir /u/TAGUCHI/projects/logs --dependencyFile /u/TAGUCHI/projects/logs/.userbuilddependencies '/u/TAGUCHI/projects/zosgittest01/cobol/TSUB05.cbl'
$ 
** Build start at 20230429.104900.049
** Build output located at /u/TAGUCHI/projects/logs
** Adding /u/TAGUCHI/projects/zosgittest01/cobol/TSUB05.cbl to Building build list
** Writing build list file to /u/TAGUCHI/projects/logs/buildList.txt
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
** Building files mapped to Cobol.groovy script
*** Building file zosgittest01/cobol/TSUB05.cbl
IKJ56231I DATA SET TAGUCHI.DBB2.COPY NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+    
IKJ56231I TEXT UNIT X'0003' CONTAINS INVALID LENGTH    
Caught: com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.CopyToPDS.execute(CopyToPDS.java:89)
	at BuildUtilities$_copySourceFiles_closure4.doCall(BuildUtilities.groovy:148)
	at BuildUtilities.copySourceFiles(BuildUtilities.groovy:123)
	at Cobol$_run_closure1.doCall(Cobol.groovy:49)
	at Cobol.run(Cobol.groovy:35)
	at Cobol$run.callCurrent(Unknown Source)
	at com.ibm.dbb.groovy.ScriptLoader._run(ScriptLoader.groovy:124)
	at com.ibm.dbb.groovy.ScriptLoader$_run$0.call(Unknown Source)
	at com.ibm.dbb.groovy.ScriptLoader.runScript(ScriptLoader.groovy:81)
	at build$_run_closure1.doCall(build.groovy:62)
	at build.run(build.groovy:54)
Caused by: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.CopyToPDS.copyAsText(CopyToPDS.java:408)
	at com.ibm.dbb.build.CopyToPDS.copyAsText(CopyToPDS.java:306)
	at com.ibm.dbb.build.CopyToPDS.copyFile(CopyToPDS.java:232)
	at com.ibm.dbb.build.CopyToPDS.doCopy(CopyToPDS.java:179)
	at com.ibm.dbb.build.CopyToPDS.execute(CopyToPDS.java:85)
	... 10 more
Caused by: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.internal.Utils.bpxwdyn(Utils.java:96)
	at com.ibm.dbb.build.CopyToPDS.copyAsText(CopyToPDS.java:404)
... 14 more
Caused by: com.ibm.jzos.RcException: BPXWDYN failed; S99ERROR/S99INFO = 0x438/0x0 RC=70778880 (0x4380000)
	at com.ibm.jzos.ZFile.bpxwdyn(ZFile.java:152)
	at com.ibm.dbb.build.internal.Utils.bpxwdyn(Utils.java:92)
	... 15 more
** Build finished
An error has occurred: Error: Something went wrong executing SSH command $DBB_HOME/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --userBuild --workspace /u/TAGUCHI/projects --application zosgittest01 --hlq TAGUCHI.DBB2 --outDir /u/TAGUCHI/projects/logs --dependencyFile /u/TAGUCHI/projects/logs/.userbuilddependencies '/u/TAGUCHI/projects/zosgittest01/cobol/TSUB05.cbl'

ログを見ると、まず、以下のように「CPPARM¥5.cpy」というファイルがUSS上に「CPPARM%C2%A55.cpy」というファイル名で転送されているようです。

...
Uploading file c:\y\VSCode_workspace\ISEConf2023_wazi_DBB1390\zosgittest01\copybook\CPPARM¥5.cpy to /u/TAGUCHI/projects/zosgittest01/copybook/CPPARM%C2%A55.cpy with encoding ibm-1390
...

その後zAppBuildのビルドのスクリプトでエラーになっていますが、エラー時のログとしては以下のようなメッセージが出ているので、USSからPDSにファイルをコピーする処理でLENGTHに関するエラーが発生しているようです。

IKJ56231I DATA SET TAGUCHI.DBB2.COPY NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+    
IKJ56231I TEXT UNIT X'0003' CONTAINS INVALID LENGTH    
Caught: com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.CopyToPDS.execute(CopyToPDS.java:89)
...
恐らくファイル名が「CPPARM%C2%A55.cpy」となっていて拡張子無しの部分の長さが8文字を超過しており、PDSへのコピーがうまくいっていないのではないかと推察されます。

3-2.IDz

IDzからGitのリポジトリをクローンし、DBBを使用してUser Buildを実行してみます。

3-2-(1)英小文字系(1399)

【設定】
プロパティー・グループ
image.png

【動作確認】
COPYBOOK参照
image.png
意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

続いて、このソースに対してDBB, zAppBuildを利用したUser Buildを実行してみます。
COPYBOOK、COBOLソースともにUSS経由で転送されて、コンパイルがうまく実行されました。

依存関係ビルドの構成例

image.png

image.png

image.png

image.png

image.png

image.png

ビルド時のログ
cd /u/TAGUCHI/projects
$DBB_HOME/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --sourceDir /u/TAGUCHI/projects --workDir /u/TAGUCHI/projects/logs --hlq TAGUCHI.DBB2 --application zosgittest01 --errPrefix U1418447 --userBuild  zosgittest01/cobol/TSUB04.cbl
/u/TAGUCHI/projects>


** Build start at 20230429.112054.020
/u/TAGUCHI/projects>

** Build output located at /u/TAGUCHI/projects/logs

** Adding zosgittest01/cobol/TSUB04.cbl to Building build list
** Writing build list file to /u/TAGUCHI/projects/logs/buildList.txt
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
/u/TAGUCHI/projects>
** Building files mapped to Cobol.groovy script


*** Building file zosgittest01/cobol/TSUB04.cbl
/u/TAGUCHI/projects>
** Writing build report data to /u/TAGUCHI/projects/logs/BuildReport.json

** Writing build report to /u/TAGUCHI/projects/logs/BuildReport.html

** Build ended at Sat Apr 29 23:21:01 JST 2023
** Build State : CLEAN
** Total files processed : 1
** Total build time  : 6.052 seconds

** Build finished

転送されたPDSメンバーを見てみます。
image.png
意図した通り、「CPPARM¥4」というメンバーが作成されています。

3-2-(2)カタカナ系(1390)

【設定】
プロパティー・グループ
image.png

【動作確認】

COPYBOOK参照
image.png
意図した通りにCOPYBOOKの中身が参照できました。ハイパーリンクで参照先のデータセットを開くこともできました。

続いて、このソースに対してDBB, zAppBuildを利用したUser Buildを実行してみます。

ビルドがエラーになりました。

依存関係ビルドの構成例
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/132331/029a04c2-4eb2-f8de-334b-4bc70dabd491.png)

image.png

image.png

image.png

image.png

image.png

ビルド時のログ

cd /u/TAGUCHI/projects
$DBB_HOME/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --sourceDir /u/TAGUCHI/projects --workDir /u/TAGUCHI/projects/logs --hlq TAGUCHI.DBB2 --application zosgittest01 --userBuild  zosgittest01/cobol/TSUB05.cbl
/u/TAGUCHI/projects>


** Build start at 20230429.114646.046
/u/TAGUCHI/projects>
** Build output located at /u/TAGUCHI/projects/logs

** Adding zosgittest01/cobol/TSUB05.cbl to Building build list

** Writing build list file to /u/TAGUCHI/projects/logs/buildList.txt
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
/u/TAGUCHI/projects>
** Building files mapped to Cobol.groovy script

Caught: com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
*** Building file zosgittest01/cobol/TSUB05.cbl


IKJ56231I DATA SET TAGUCHI.DBB2.COPY NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+    
IKJ56231I TEXT UNIT X'0003' CONTAINS INVALID PARAMETER    
/u/TAGUCHI/projects>
** Build finished
/u/TAGUCHI/projects>
com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.CopyToPDS.execute(CopyToPDS.java:89)
	at BuildUtilities$_copySourceFiles_closure5.doCall(BuildUtilities.groovy:210)
	at BuildUtilities.copySourceFiles(BuildUtilities.groovy:172)
	at Cobol$_run_closure1.doCall(Cobol.groovy:49)
	at Cobol.run(Cobol.groovy:35)
	at Cobol$run.callCurrent(Unknown Source)
	at com.ibm.dbb.groovy.ScriptLoader._run(ScriptLoader.groovy:124)
	at com.ibm.dbb.groovy.ScriptLoader$_run$0.call(Unknown Source)
	at com.ibm.dbb.groovy.ScriptLoader.runScript(ScriptLoader.groovy:81)
	at build$_run_closure1.doCall(build.groovy:62)
	at build.run(build.groovy:54)
Caused by: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.CopyToPDS.copyAsText(CopyToPDS.java:408)
	at com.ibm.dbb.build.CopyToPDS.copyAsText(CopyToPDS.java:306)
	at com.ibm.dbb.build.CopyToPDS.copyFile(CopyToPDS.java:232)
	at com.ibm.dbb.build.CopyToPDS.doCopy(CopyToPDS.java:179)
	at com.ibm.dbb.build.CopyToPDS.execute(CopyToPDS.java:85)
	... 10 more
Caused by: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.internal.Utils.bpxwdyn(Utils.java:96)
	at com.ibm.dbb.build.CopyToPDS.copyAsText(CopyToPDS.java:404)
	... 14 more
Caused by: com.ibm.jzos.RcException: BPXWDYN failed&#59; S99ERROR/S99INFO = 0x438/0x0 RC=70778880 (0x4380000)
	at com.ibm.jzos.ZFile.bpxwdyn(ZFile.java:152)
	at com.ibm.dbb.build.internal.Utils.bpxwdyn(Utils.java:92)
	... 15 more

エラー時のログとしては以下のようなメッセージが出ているので、USSからPDSにファイルをコピーする処理でエラーが発生しているようです。

IKJ56231I DATA SET TAGUCHI.DBB2.COPY NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+    
IKJ56231I TEXT UNIT X'0003' CONTAINS INVALID PARAMETER    
/u/TAGUCHI/projects>
** Build finished
/u/TAGUCHI/projects>
com.ibm.dbb.build.BuildException: java.io.IOException: com.ibm.dbb.build.BuildException: BGZTK0016E An error occurred running BPXWDYN command 'free dd(SYS00010)'.
	at com.ibm.dbb.build.CopyToPDS.execute(CopyToPDS.java:89)
...

PCOMのISH(ISPF Shell)から、USSに転送されたファイルのファイル名を見てみると...
1399(英小文字系)のコードページで見てみると、以下のように「CPPARM¥5.cpy」というファイルとして転送されています。
image.png

1390(カタカナ系)のコードページの場合は以下のような感じになります。
image.png

つまりファイル名中の`¥`は.gitattributesに指定した1390(カタカナ系)ではなく英小文字系のコードページ(037/1047辺り)が使われてコード変換されてしまい、USS上ではx'B2'のコードに変換されてしまっているものと思われます。それをPDSメンバーとして作成しようとすると、メンバー名としては使用不可の記号ということになるのでエラーになっているものと推察されます。

4.Gitでのソース管理 / JenkinsからのFull Build

GitHubで管理されているCOBOLソース、COPYBOOKを、JenkinsのPipelineからDBBのUser Buildを実行するシナリオで、メンバー名にx'5B'が含まれるケースを試してみます。

image.png

4-0.GitHubのリモートリポジトリの準備

3-0で準備したリポジトリにJenkinsファイルを追加して使用します。

Jenkinsファイル例
Jenkinsfile
// variables for Git
def srcGitRepo = null
def srcGitBranch = null
def srcGitCredentialsId = null
def srcGitRepoName = null

// variables for DBB, zAppBuild
def dbbHome = null
def zAppBuildHome = null
def dbbBuildExtraOpts = null

pipeline {
   agent {label 'wazi01'}

   options {
      skipDefaultCheckout(true)
   }

   stages {
      stage('Git Clone'){
         steps {
            script {
               // variables for Git
               srcGitRepo = scm.getUserRemoteConfigs()[0].getUrl()
               srcGitBranch = scm.branches[0].name
               srcGitCredentialsId = scm.getUserRemoteConfigs()[0].getCredentialsId()
               srcGitRepoName = srcGitRepo.tokenize('/').last().tokenize('\\.')[0]

               dir(srcGitRepoName){
                  /*sh """
                     echo 'srcGitRepo: ' $srcGitRepo
                     echo 'srcGitBranch: ' $srcGitBranch
                     echo 'srcGitCredentialsId: ' $srcGitCredentialsId
                     echo 'srcGitRepoName: ' $srcGitRepoName
                  """*/
                  def scmVars = checkout([
                     $class: 'GitSCM',
                     branches: [[name: srcGitBranch]],
                     userRemoteConfigs: [[ credentialsId: srcGitCredentialsId, url: srcGitRepo ]]
                  ])
               }
            }
         }
      }
      stage('Hello') {
         steps {
            echo 'Hello World'
         }
      }
      stage('Build'){
         steps {
            script {
               // variables for DBB, zAppBuild
               dbbHome = env.DBB_HOME
               zAppBuildHome = env.ZAPPBUILD_HOME
               dbbBuildExtraOpts = env.DBB_BUILD_EXTRA_OPTS

               sh """
                  $dbbHome/bin/groovyz $zAppBuildHome/build.groovy \
                     $dbbBuildExtraOpts  \
                     --logEncoding UTF-8 \
                     --workspace ${WORKSPACE} \
                     --application $srcGitRepoName \
                     --hlq JENKIN1.DBB \
                     --outDir /u/JENKIN1/logs \
                     --fullBuild
               """
            }
         }
      }
      stage('Test'){
          steps{
              echo 'Test Dummy'
          }
      }
      stage('Deploy'){
          steps{
              echo 'Deploy Dummy'
          }
      }
   }
}

4-1. Jenkins

4-1-(1)英小文字系(1399)

【設定】

.gitattributes
# line endings
* text eol=lf

# file encodings
.gitattributes zos-working-tree-encoding=ibm-1399 git-encoding=utf-8
*.cpy zos-working-tree-encoding=ibm-1399 git-encoding=utf-8
*.cbl zos-working-tree-encoding=ibm-1399 git-encoding=utf-8
*.bms zos-working-tree-encoding=ibm-1399 git-encoding=utf-8
*.pli zos-working-tree-encoding=ibm-1399 git-encoding=utf-8
*.mfs zos-working-tree-encoding=ibm-1399 git-encoding=utf-8
*.bnd zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.lnk zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.txt zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.groovy zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.sh zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.properties zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.asm zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.jcl zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.mac zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.json zos-working-tree-encoding=utf-8 git-encoding=utf-8

今回のシナリオではUSS上のRocket Gitでリポジトリをクローンする流れとなっています。GitHubリポジトリに含まれる.gitattributesファイルで、*.cbl, *.cpyファイルはIBM-1399でコード変換されるよう指定しています。

Jenkins Pipeline

image.png

【動作確認】
image.png

ビルド時のログ
Started by user jenkins01
 > git rev-parse --resolve-git-dir /var/jenkins_home/caches/git-853d0eddd1972f39860ec58a4d164f67/.git # timeout=10
Setting origin to https://github.ibm.com/TOMOTAG/zosgittest01.git
 > git config remote.origin.url https://github.ibm.com/TOMOTAG/zosgittest01.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
 > git config --get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials 
 > git fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/1390
Seen branch in repository origin/1399
Seen branch in repository origin/main
Seen 3 remote branches
Obtained Jenkinsfile from 273b627ad944ff42d79cc4c2cdb505f42b5924f7
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
Waiting for next available executor on ‘wazi01’
Running on wazi01 in /u/JENKIN1/agent/work/workspace/zosgittest01_1399_1399
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Git Clone)
[Pipeline] script
[Pipeline] {
[Pipeline] dir
Running in /u/JENKIN1/agent/work/workspace/zosgittest01_1399_1399/zosgittest01
[Pipeline] {
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential GitHub_TOMOTAG
Fetching changes from the remote Git repository
 > git rev-parse --resolve-git-dir /u/JENKIN1/agent/work/workspace/zosgittest01_1399_1399/zosgittest01/.git # timeout=10
 > git config remote.origin.url https://github.ibm.com/TOMOTAG/zosgittest01.git # timeout=10
Fetching upstream changes from https://github.ibm.com/TOMOTAG/zosgittest01.git
 > git --version # timeout=10
 > git --version # 'git version 2.26.2-82'
using GIT_ASKPASS to set credentials 
Using name charset 'IBM1047'
Using password charset 'IBM1047'
 > git fetch --tags --force --progress -- https://github.ibm.com/TOMOTAG/zosgittest01.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Checking out Revision 273b627ad944ff42d79cc4c2cdb505f42b5924f7 (origin/1399)
Commit message: "add Jenkinsfile"
 > git rev-parse origin/1399^{commit} # timeout=10
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 273b627ad944ff42d79cc4c2cdb505f42b5924f7 # timeout=10
 > git rev-list --no-walk 273b627ad944ff42d79cc4c2cdb505f42b5924f7 # timeout=10
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Hello)
[Pipeline] echo
Hello World
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ /usr/lpp/IBM/dbb/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --logEncoding UTF-8 --workspace /u/JENKIN1/agent/work/workspace/zosgittest01_1399_1399 --application zosgittest01 --hlq JENKIN1.DBB --outDir /u/JENKIN1/logs --fullBuild 

** Build start at 20230430.064259.042
** Build output located at /u/JENKIN1/logs/build.20230430.064259.042
** Build result created for BuildGroup:zosgittest01-1399 BuildLabel:build.20230430.064259.042
** --fullBuild option selected. Building all programs for application zosgittest01
** Writing build list file to /u/JENKIN1/logs/build.20230430.064259.042/buildList.txt
** Scanning source code.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v9.Java9 (file:/usr/lpp/IBM/idz/usr/lpp/IBM/dbb/groovy/lib/groovy-4.0.3.jar) to method sun.nio.fs.UnixFileSystem.getPathMatcher(java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v9.Java9
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
** Building files mapped to Cobol.groovy script
*** Building file zosgittest01/cobol/TSUB03.cbl
*** Building file zosgittest01/cobol/TSUB04.cbl
*** Building file zosgittest01/cobol/TSUB02.cbl
*** Building file zosgittest01/cobol/TMAIN01.cbl
** Writing build report data to /u/JENKIN1/logs/build.20230430.064259.042/BuildReport.json
** Writing build report to /u/JENKIN1/logs/build.20230430.064259.042/BuildReport.html
** Updating build result BuildGroup:zosgittest01-1399 BuildLabel:build.20230430.064259.042
** Build ended at Sun Apr 30 06:43:09 EDT 2023
** Build State : CLEAN
** Total files processed : 4
** Total build time  : 10.538 seconds

** Build finished
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
Test Dummy
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
[Pipeline] echo
Deploy Dummy
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

ビルドは正常に完了しました。

転送されたPDSメンバーを見てみます。
image.png
意図した通り、「CPPARM$4」というメンバーが作成されています。

4-1-(2)カタカナ系(1390)

【設定】

.gitattributes
# line endings
* text eol=lf

# file encodings
.gitattributes zos-working-tree-encoding=ibm-1390 git-encoding=utf-8
*.cpy zos-working-tree-encoding=ibm-1390 git-encoding=utf-8
*.cbl zos-working-tree-encoding=ibm-1390 git-encoding=utf-8
*.bms zos-working-tree-encoding=ibm-1390 git-encoding=utf-8
*.pli zos-working-tree-encoding=ibm-1390 git-encoding=utf-8
*.mfs zos-working-tree-encoding=ibm-1390 git-encoding=utf-8
*.bnd zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.lnk zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.txt zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.groovy zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.sh zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.properties zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.asm zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.jcl zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.mac zos-working-tree-encoding=ibm-1047 git-encoding=utf-8
*.json zos-working-tree-encoding=utf-8 git-encoding=utf-8

今回のシナリオではUSS上のRocket Gitでリポジトリをクローンする流れとなっています。GitHubリポジトリに含まれる.gitattributesファイルで、*.cbl, *.cpyファイルはIBM-1390でコード変換されるよう指定しています。

Jenkins Pipeline

image.png

【動作確認】
image.png

ビルド時のログ
Branch indexing
 > git rev-parse --resolve-git-dir /var/jenkins_home/caches/git-853d0eddd1972f39860ec58a4d164f67/.git # timeout=10
Setting origin to https://github.ibm.com/TOMOTAG/zosgittest01.git
 > git config remote.origin.url https://github.ibm.com/TOMOTAG/zosgittest01.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
 > git config --get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials 
 > git fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/1390
Seen branch in repository origin/1399
Seen branch in repository origin/main
Seen 3 remote branches
Obtained Jenkinsfile from 941421c5d69ffebdf4f4a5afdaab5d90b93fd955
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
Waiting for next available executor on ‘wazi01’
Running on wazi01 in /u/JENKIN1/agent/work/workspace/zosgittest01_1390_1390
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Git Clone)
[Pipeline] script
[Pipeline] {
[Pipeline] dir
Running in /u/JENKIN1/agent/work/workspace/zosgittest01_1390_1390/zosgittest01
[Pipeline] {
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential GitHub_TOMOTAG
Cloning the remote Git repository
Cloning repository https://github.ibm.com/TOMOTAG/zosgittest01.git
 > git init /u/JENKIN1/agent/work/workspace/zosgittest01_1390_1390/zosgittest01 # timeout=10
Fetching upstream changes from https://github.ibm.com/TOMOTAG/zosgittest01.git
 > git --version # timeout=10
 > git --version # 'git version 2.26.2-82'
using GIT_ASKPASS to set credentials 
Using name charset 'IBM1047'
Using password charset 'IBM1047'
 > git fetch --tags --force --progress -- https://github.ibm.com/TOMOTAG/zosgittest01.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url https://github.ibm.com/TOMOTAG/zosgittest01.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
Checking out Revision 941421c5d69ffebdf4f4a5afdaab5d90b93fd955 (origin/1390)
 > git rev-parse origin/1390^{commit} # timeout=10
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 941421c5d69ffebdf4f4a5afdaab5d90b93fd955 # timeout=10
Commit message: "add Jenkinsfile"
First time build. Skipping changelog.
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Hello)
[Pipeline] echo
Hello World
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ /usr/lpp/IBM/dbb/bin/groovyz /u/ibmuser/dbb-zappbuild/build.groovy --logEncoding UTF-8 --workspace /u/JENKIN1/agent/work/workspace/zosgittest01_1390_1390 --application zosgittest01 --hlq JENKIN1.DBB --outDir /u/JENKIN1/logs --fullBuild 

** Build start at 20230430.065016.050
** Build output located at /u/JENKIN1/logs/build.20230430.065016.050
** Build result created for BuildGroup:zosgittest01-1390 BuildLabel:build.20230430.065016.050
** --fullBuild option selected. Building all programs for application zosgittest01
** Writing build list file to /u/JENKIN1/logs/build.20230430.065016.050/buildList.txt
** Scanning source code.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v9.Java9 (file:/usr/lpp/IBM/idz/usr/lpp/IBM/dbb/groovy/lib/groovy-4.0.3.jar) to method sun.nio.fs.UnixFileSystem.getPathMatcher(java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v9.Java9
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
** Invoking build scripts according to build order: Assembler.groovy,Cobol.groovy,PLI.groovy
** Building files mapped to Cobol.groovy script
*** Building file zosgittest01/cobol/TSUB03.cbl
*** Building file zosgittest01/cobol/TSUB04.cbl
*! The compile return code (12) for zosgittest01/cobol/TSUB04.cbl exceeded the maximum return code allowed (4)
*** Building file zosgittest01/cobol/TSUB02.cbl
*** Building file zosgittest01/cobol/TMAIN01.cbl
*** Building file zosgittest01/cobol/TSUB05.cbl
*! The compile return code (12) for zosgittest01/cobol/TSUB05.cbl exceeded the maximum return code allowed (4)
** Writing build report data to /u/JENKIN1/logs/build.20230430.065016.050/BuildReport.json
** Writing build report to /u/JENKIN1/logs/build.20230430.065016.050/BuildReport.html
** Updating build result BuildGroup:zosgittest01-1390 BuildLabel:build.20230430.065016.050
** Build ended at Sun Apr 30 06:50:27 EDT 2023
** Build State : ERROR
** Total files processed : 5
** Total build time  : 10.141 seconds

** Build finished
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test)
Stage "Test" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
Stage "Deploy" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

TSUB05.cblのコンパイル時のログを見ると、以下のようにCOPYBOOKが見つからない状況になっています。

     9  IGYLI0048-S   The member "'CPPARM$5'" was not found in the "COPY" library.  Skipped to the period terminating the "COPY"
                      statement.

USS上にクローンされたファイルをPCOMのISH(ISPF Shell)から見てみます。(以下はIBM-1399:英小文字系の設定のPCOMで参照しています)
image.png

ファイル名としてx'5B'が入って欲しい部分が、「イ」(x'62') +「¥」(x'B2')となってしまっています(よく分からない変換...)。 このため、USS⇒PDSデータセットへのコピーがうまく行えなかったものと推察されます。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0