JP2018025852A - Program analysis method, program analyzer and analysis program - Google Patents
Program analysis method, program analyzer and analysis program Download PDFInfo
- Publication number
- JP2018025852A JP2018025852A JP2016155457A JP2016155457A JP2018025852A JP 2018025852 A JP2018025852 A JP 2018025852A JP 2016155457 A JP2016155457 A JP 2016155457A JP 2016155457 A JP2016155457 A JP 2016155457A JP 2018025852 A JP2018025852 A JP 2018025852A
- Authority
- JP
- Japan
- Prior art keywords
- program
- file
- programs
- types
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
Description
本発明はプログラム分析方法、プログラム分析装置および分析プログラムに関する。 The present invention relates to a program analysis method, a program analysis apparatus, and an analysis program.
情報処理システムで使用されるプログラムは、長期間の運用に伴って拡張や変更が繰り返されることが多い。その結果として、プログラムの記述方法に一貫性がなくなることや、実質的に同じ内容の命令文が様々なプログラムに重複して記述されることがあり、当該プログラムの保守性が低下してしまうことがある。保守性の低いプログラムを使用し続けると、プログラムの可読性が低いために保守作業量が増大し、保守コストが大きくなってしまう。そこで、保守性が低くなったプログラムの構造を見直して再設計し、保守コストが小さくなるようにプログラムを修正することがある。 A program used in an information processing system is frequently expanded or changed with a long-term operation. As a result, the program description method may become inconsistent, and imperative statements with substantially the same content may be duplicated in various programs, reducing the maintainability of the program. There is. If a program with low maintainability is used continuously, the readability of the program is low, so the amount of maintenance work increases and the maintenance cost increases. Therefore, the structure of a program with low maintainability may be reviewed and redesigned, and the program may be modified to reduce maintenance costs.
プログラムの保守性が低くなる状況の1つとして、複数のプログラムが同一のファイルにアクセスする状況が挙げられる。ファイルにアクセスするプログラムには、当該ファイルから読み込むデータまたは当該ファイルに書き込むデータの構造を示すデータ構造定義文が記述されることがある。データ構造定義文では、例えば、1以上のデータ項目の項目名やデータ型が定義される。ここで、同じファイルにアクセスする複数のプログラムに、実質的に同じ内容のデータ構造定義文が記述されることが生じ得る。これら複数のプログラムのデータ構造定義文は、データ項目の項目名などが統一されていないために、互いに若干異なることがある。この状況では、ファイルに格納するデータの構造を変えようとすると各プログラムに応じた変更を行うことになり、プログラムの保守性が低くなる。 One situation in which the maintainability of the program is low is a situation in which a plurality of programs access the same file. In a program that accesses a file, a data structure definition statement indicating the structure of data read from the file or data written to the file may be described. In the data structure definition statement, for example, item names and data types of one or more data items are defined. Here, it may occur that data structure definition statements having substantially the same contents are described in a plurality of programs that access the same file. The data structure definition statements of the plurality of programs may be slightly different from each other because the item names of the data items are not unified. In this situation, if the structure of the data stored in the file is to be changed, the change is made according to each program, and the maintainability of the program is lowered.
そこで、例えば、データ項目名の統一を支援するソフトウェア標準化方法が提案されている。提案のソフトウェア標準化方法では、同じファイルにアクセスする複数のプログラムに定義されたデータ項目名を抽出し、抽出したデータ項目名を列挙した画面を表示する。列挙されたデータ項目名を参考にしてユーザに標準データ項目名を入力させ、プログラム中のデータ項目名を標準データ項目名に自動的に置換する。 Therefore, for example, a software standardization method that supports unification of data item names has been proposed. In the proposed software standardization method, data item names defined in a plurality of programs accessing the same file are extracted, and a screen listing the extracted data item names is displayed. The user inputs a standard data item name with reference to the enumerated data item names, and automatically replaces the data item name in the program with the standard data item name.
また、例えば、標準化装置が提案されている。提案の標準化装置は、同じファイルにアクセスする複数のプログラムに定義されたデータ項目名を抽出し、抽出したデータ項目名を列挙した画面を表示する。標準化装置は、列挙されたデータ項目名の中からユーザに標準データ項目名を選択させる。標準化装置は、ユーザが選択した標準データ項目名を元のプログラムとは異なる外部ファイルに保存し、プログラムに含まれるデータ構造定義文を削除し、当該外部ファイルを参照するようにプログラムを修正する。 For example, a standardization device has been proposed. The proposed standardization apparatus extracts data item names defined in a plurality of programs that access the same file, and displays a screen listing the extracted data item names. The standardization apparatus causes the user to select a standard data item name from among the listed data item names. The standardization apparatus saves the standard data item name selected by the user in an external file different from the original program, deletes the data structure definition sentence included in the program, and corrects the program to refer to the external file.
また、例えば、プログラム修正支援装置が提案されている。提案のプログラム修正支援装置は、プログラムに定義されたデータ項目毎に、当該プログラムのロジック中で使用されている回数をカウントし、使用回数が多いデータ項目を検討候補としてユーザに提示する。また、例えば、リエンジニアリング支援装置が提案されている。提案のリエンジニアリング支援装置は、プログラムを分析し、プログラムで使用されるデータ項目それぞれについて、データ項目名などの定義が外部ファイルに記載されている割合などの各種指標値を算出する。リエンジニアリング支援装置は、算出した指標値を所定の業界標準値と比較することで、プログラムの修正に要する日数や資金を見積もる。 For example, a program correction support apparatus has been proposed. For each data item defined in the program, the proposed program correction support device counts the number of times the program is used in the logic of the program, and presents the data item with a large number of uses to the user as a candidate for examination. For example, a re-engineering support device has been proposed. The proposed re-engineering support apparatus analyzes the program and calculates various index values such as a ratio in which definitions such as data item names are described in the external file for each data item used in the program. The re-engineering support apparatus estimates the number of days and funds required to modify the program by comparing the calculated index value with a predetermined industry standard value.
しかし、上記特許文献1,2に記載の技術においてユーザに提供される情報は、現在プログラムで使用されている複数通りのデータ項目名のみである。このため、プログラム修正の効率化に資する情報を提供するという点で改善の余地がある。
However, the information provided to the user in the techniques described in
例えば、現在使用されている複数通りのデータ項目名の中から標準データ項目名を選択する場合において、何れを標準データ項目名として選択すればよいかの判断に役立つ何らかの情報が提供されることが好ましい。また、例えば、限られた時間で保守性改善効果の大きいプログラム修正を行いたい場合において、何れのデータ項目名を優先的に検討すればよいかの判断に役立つ何らかの情報が提供されることが好ましい。 For example, when a standard data item name is selected from a plurality of currently used data item names, some information is provided to help determine which one should be selected as the standard data item name. preferable. In addition, for example, in the case where it is desired to modify a program having a large maintainability improvement effect in a limited time, it is preferable that some information that is useful for determining which data item name should be preferentially examined is provided. .
1つの側面では、本発明は、プログラム修正の効率化に資する情報を提供できるプログラム分析方法、プログラム分析装置および分析プログラムを提供することを目的とする。 In one aspect, an object of the present invention is to provide a program analysis method, a program analysis apparatus, and an analysis program that can provide information that contributes to the efficiency of program correction.
1つの態様では、コンピュータが実行するプログラム分析方法が提供される。同一のファイルにアクセスする複数のプログラムを含むプログラム資産から、それぞれがファイルに格納されるデータの構造を示す複数のデータ構造定義文を抽出する。複数のデータ構造定義文の間の比較に基づいて複数のデータ構造定義文を複数のタイプに分類し、複数のタイプそれぞれについて複数のプログラムのうち当該タイプに属するデータ構造定義文を使用するプログラムの数をカウントする。複数のタイプの間のプログラムの数の分布を示す分布情報を出力する。 In one aspect, a program analysis method executed by a computer is provided. A plurality of data structure definition statements each indicating a structure of data stored in the file are extracted from a program asset including a plurality of programs accessing the same file. A program that classifies a plurality of data structure definition statements into a plurality of types based on a comparison between a plurality of data structure definition statements, and uses a data structure definition statement belonging to that type among a plurality of programs for each of the plurality of types. Count the number. Output distribution information indicating the distribution of the number of programs among multiple types.
また、1つの態様では、記憶部と演算部とを有するプログラム分析装置が提供される。また、1つの態様では、コンピュータに実行させる分析プログラムが提供される。 In one aspect, a program analysis device having a storage unit and a calculation unit is provided. In one aspect, an analysis program to be executed by a computer is provided.
1つの側面では、プログラム修正の効率化に資する情報を提供できる。 In one aspect, information that contributes to efficient program modification can be provided.
以下、本実施の形態を図面を参照して説明する。
[第1の実施の形態]
第1の実施の形態を説明する。
Hereinafter, the present embodiment will be described with reference to the drawings.
[First Embodiment]
A first embodiment will be described.
図1は、第1の実施の形態のプログラム分析装置の例を示す図である。
第1の実施の形態のプログラム分析装置10は、既存のプログラム資産の保守性を向上させて情報処理システムの保守コストを低下させるときに使用される。プログラム分析装置10は、既存のプログラム資産を分析し、プログラム資産の修正作業を支援する。プログラム分析装置10は、ユーザが操作するクライアント装置でもよいし、クライアント装置からネットワーク経由でアクセスされるサーバ装置でもよい。
FIG. 1 is a diagram illustrating an example of a program analysis apparatus according to the first embodiment.
The
プログラム分析装置10は、記憶部11および演算部12を有する。記憶部11は、RAM(Random Access Memory)などの揮発性半導体メモリでもよいし、HDD(Hard Disk Drive)やフラッシュメモリなどの不揮発性ストレージでもよい。演算部12は、例えば、CPU(Central Processing Unit)やDSP(Digital Signal Processor)などのプロセッサである。ただし、演算部12は、ASIC(Application Specific Integrated Circuit)やFPGA(Field Programmable Gate Array)などの特定用途の電子回路を含んでもよい。プロセッサは、RAMなどのメモリ(記憶部11でもよい)に記憶されたプログラムを実行する。プログラムには、分析プログラムが含まれる。複数のプロセッサの集合(マルチプロセッサ)を「プロセッサ」と呼ぶこともある。
The
記憶部11は、プログラム資産13を記憶する。プログラム資産13は、同一のファイルにアクセスする複数のプログラムを含む。これら複数のプログラムの一部または全部は、当該同一のファイルからデータを読み出すプログラムであってもよい。また、これら複数のプログラムの一部または全部は、当該同一のファイルにデータを書き込むプログラムであってもよい。プログラム資産13に含まれるプログラムは、例えば、COBOLなどのプログラミング言語によって記述されたソースプログラムである。
The
複数のプログラムそれぞれは、例えば、ファイルに格納されるデータ(読み出すデータまたは書き込むデータ)の構造を示すデータ構造定義文を含む。ただし、これら複数のプログラムの一部は、データ構造定義を記載した外部ファイルを参照するものであってもよい。データ構造定義を記載した外部ファイルをプログラムから参照することは、例えば、COPY文やinclude文などを用いて行うことができる。プログラム資産13は、このような外部ファイルを含んでもよい。データ構造定義文は、例えば、ファイルに格納されるデータに含まれる1以上のデータ項目を識別するための1以上のデータ項目名と、当該1以上のデータ項目に対応する1以上のデータ型とを含む。
Each of the plurality of programs includes, for example, a data structure definition statement indicating the structure of data (read data or write data) stored in a file. However, some of the plurality of programs may refer to an external file that describes the data structure definition. The external file describing the data structure definition can be referred to from a program using, for example, a COPY statement or an include statement. The
プログラム資産13の中には、同一のファイルに対して異なるデータ構造定義文を使用するプログラムが混在している。これは、例えば、プログラム資産13の拡張や変更を繰り返す過程で、プログラム間でデータ項目名が統一されなかったことにより生じ得る。また、これは、例えば、処理ロジックを記述する都合上、既存のプログラムで使用しているデータ型とは異なるデータ型を用いて新たなプログラムを作成したことにより生じ得る。また、これは、例えば、2以上のデータ項目の集合を集団項目とみなし、集団項目に対して独自の集団項目名を定義したことにより生じ得る。
In the
演算部12は、記憶部11に記憶されたプログラム資産13を分析し、同一のファイルに対する異なるデータ構造定義文の使用状況を可視化する。演算部12は、プログラム資産13から、同一のファイルに格納されるデータの構造を示す複数のデータ構造定義文を抽出する。例えば、演算部12は、プログラム資産13から、図1に示すデータ構造定義文14a,14b,14c,14d,14e,14fを抽出する。
The
データ構造定義文14a,14b,14c,14d,14e,14fは、例えば、互いに異なるプログラムに記述されていたデータ構造定義文である。データ構造定義文14a,14d,14fは、データ項目名が「key−item」でありデータ型が「X(10)」であることを示している。データ構造定義文14b,14eは、データ項目名が「key−item」でありデータ型が「N(5)」であることを示している。データ構造定義文14cは、データ項目名が「item−01」でありデータ型が「X(10)」であることを示している。ここで、「X(10)」は半角10文字を表し、「N(5)」は全角5文字を表しており、両者は同じデータ長を示している。
The data
演算部12は、抽出した複数のデータ構造定義文の間の比較に基づいて、複数のデータ構造定義文を複数のタイプに分類する。例えば、演算部12は、異なるデータ型を使用するデータ構造定義文を異なるタイプに分類する。また、例えば、演算部12は、異なるデータ項目名を使用するデータ構造定義文を原則として異なるタイプに分類する。ただし、演算部12は、データ項目名の一部分(例えば、接頭辞)のみ異なるデータ構造定義文など、類似するデータ項目名を使用するデータ構造定義文を同じタイプに分類してもよい。
The
上記のデータ構造定義文14a,14b,14c,14d,14e,14fは、例えば、タイプ15a,15b,15cに分類される。すなわち、データ構造定義文14a,14d,14fはタイプ15aに分類される。データ構造定義文14b,14eはデータ型がタイプ15aと異なるため、タイプ15bに分類される。データ構造定義文14cはデータ項目名がタイプ15a,15bと異なるため、タイプ15cに分類される。
The data
演算部12は、複数のタイプそれぞれについて、当該タイプに属するデータ構造定義文を使用するプログラムの数をカウントする。上記のタイプ15aのプログラム数は3、タイプ15bのプログラム数は2、タイプ15cのプログラム数は1である。
For each of the plurality of types, the
そして、演算部12は、複数のタイプの間のプログラム数の分布を示す分布情報16を出力する。例えば、演算部12は、プログラム分析装置10に接続されたディスプレイに分布情報16を表示させる。また、例えば、演算部12は、他の装置に分布情報16を送信する。分布情報16は、複数のタイプそれぞれのプログラム数を示すグラフ(例えば、積み上げ棒グラフ)であってもよい。また、分布情報16は、複数のタイプの間のプログラム数の比を示すグラフ(例えば、円グラフ)であってもよい。演算部12は、分布情報16と併せて、各タイプに属するデータ構造定義文を出力してもよい。
And the calculating
第1の実施の形態のプログラム分析装置10によれば、プログラム資産13から同一のファイルに対する複数のデータ構造定義文が抽出され、抽出された複数のデータ構造定義文が比較されて複数のタイプに分類される。そして、複数のタイプそれぞれについて当該タイプに属するデータ構造定義文を使用するプログラムの数がカウントされ、複数のタイプの間のプログラム数の分布を示す分布情報16が出力される。
According to the
これにより、同一のファイルに対する複数のデータ構造定義文の使用状況を可視化することができ、プログラム資産13の修正の効率化に資する情報を提供することができる。例えば、複数のデータ構造定義文を集約する(例えば、データ項目名を統一する)にあたり、複数のタイプのうち最もプログラム数の多いタイプを標準データ構造定義文として選択することで、修正作業を効率化することができる。また、例えば、プログラム数の多いタイプを優先的に修正対象として検討することで、限られた時間の中で保守性改善効果の大きい修正作業を優先的に行うことが可能となる。
As a result, it is possible to visualize the usage status of a plurality of data structure definition statements for the same file, and to provide information that contributes to efficient modification of the
[第2の実施の形態]
次に、第2の実施の形態を説明する。
図2は、プログラム分析装置のハードウェア例を示すブロック図である。
[Second Embodiment]
Next, a second embodiment will be described.
FIG. 2 is a block diagram illustrating a hardware example of the program analysis apparatus.
プログラム分析装置100は、CPU101、RAM102、HDD103、画像信号処理部104、入力信号処理部105、媒体リーダ106および通信インタフェース107を有する。CPU101、RAM102、HDD103、画像信号処理部104、入力信号処理部105、媒体リーダ106および通信インタフェース107は、バス108に接続されている。なお、プログラム分析装置100は、第1の実施の形態のプログラム分析装置10に対応する。RAM102またはHDD103は、第1の実施の形態の記憶部11に対応する。CPU101は、第1の実施の形態の演算部12に対応する。
The
CPU101は、プログラムの命令を実行する演算回路を含むプロセッサである。CPU101は、HDD103に記憶されたプログラムやデータの少なくとも一部をRAM102にロードし、プログラムを実行する。なお、CPU101は複数のプロセッサコアを備えてもよく、プログラム分析装置100は複数のプロセッサを備えてもよく、以下で説明する処理を複数のプロセッサまたはプロセッサコアを用いて並列に実行してもよい。また、複数のプロセッサの集合(マルチプロセッサ)を「プロセッサ」と呼んでもよい。
The
RAM102は、CPU101が実行するプログラムやCPU101が演算に用いるデータを一時的に記憶する揮発性の半導体メモリである。なお、プログラム分析装置100は、RAM以外の種類のメモリを備えてもよく、複数個のメモリを備えてもよい。
The
HDD103は、OS(Operating System)やミドルウェアやアプリケーションソフトウェアなどのソフトウェアのプログラム、および、データを記憶する不揮発性の記憶装置である。プログラムには、分析プログラムが含まれる。なお、プログラム分析装置100は、フラッシュメモリやSSD(Solid State Drive)などの他の種類の記憶装置を備えてもよく、複数の不揮発性の記憶装置を備えてもよい。
The
画像信号処理部104は、CPU101からの命令に従って、プログラム分析装置100に接続されたディスプレイ111に画像を出力する。ディスプレイ111としては、CRT(Cathode Ray Tube)ディスプレイ、液晶ディスプレイ(LCD:Liquid Crystal Display)、プラズマディスプレイ(PDP:Plasma Display Panel)、有機EL(OEL:Organic Electro-Luminescence)ディスプレイなどを用いることができる。
The image
入力信号処理部105は、プログラム分析装置100に接続された入力デバイス112から入力信号を取得し、CPU101に出力する。入力デバイス112としては、マウスやタッチパネルやタッチパッドやトラックボールなどのポインティングデバイス、キーボード、リモートコントローラ、ボタンスイッチなどを用いることができる。また、プログラム分析装置100に、複数の種類の入力デバイスが接続されていてもよい。
The input
媒体リーダ106は、記録媒体113に記録されたプログラムやデータを読み取る読み取り装置である。記録媒体113として、例えば、磁気ディスク、光ディスク、光磁気ディスク(MO:Magneto-Optical disk)、半導体メモリなどを使用できる。磁気ディスクには、フレキシブルディスク(FD:Flexible Disk)やHDDが含まれる。光ディスクには、CD(Compact Disc)やDVD(Digital Versatile Disc)が含まれる。
The
媒体リーダ106は、例えば、記録媒体113から読み取ったプログラムやデータを、RAM102やHDD103などの他の記録媒体にコピーする。読み取られたプログラムは、例えば、CPU101によって実行される。なお、記録媒体113は、可搬型記録媒体であってもよく、プログラムやデータの配布に用いられることがある。また、記録媒体113やHDD103を、コンピュータ読み取り可能な記録媒体と言うことがある。
For example, the
通信インタフェース107は、ネットワーク114に接続され、ネットワーク114を介して他の装置と通信を行うインタフェースである。通信インタフェース107は、スイッチなどの通信装置とケーブルで接続される有線通信インタフェースでもよいし、基地局と無線リンクで接続される無線通信インタフェースでもよい。
The
次に、ファイルにアクセスするソースプログラムの記述方法について説明する。
図3は、第1のレコード定義方法の例を示す図である。
ソースプログラム131は、プログラミング言語としてCOBOLを用いて記述されたソースプログラム(ソースコード)の例である。ソースプログラム131は、見出し部(IDENTIFICATION DIVISON)、環境部(ENVIRONMENT DIVISION)、データ部(DATA DIVISION)および手続き部(PROCEDURE DIVISION)を含む。
Next, a description is given of a method for describing a source program that accesses a file.
FIG. 3 is a diagram illustrating an example of the first record definition method.
The
見出し部には、プログラム名が記述される。ソースプログラム131のプログラム名は「PROGRAM1」である。環境部には、アクセスするファイルの論理ファイル名と中間ファイル名との対応関係が記述される。論理ファイル名と中間ファイル名は何れも、ファイルシステムが使用する物理的なファイル名(実ファイル名)とは異なる仮想的なファイル名である。論理ファイル名は、データ部で使用されるファイル名である。中間ファイル名は、後述するジョブ制御言語(JCL:Job Control Language)プログラムで使用されるファイル名である。ソースプログラム131がアクセスするファイルの論理ファイル名は「人事−REC」、中間ファイル名は「FILE1」である。
The program name is described in the heading part. The program name of the
データ部には、論理ファイル名と対応付けて、論理ファイル名が示すファイルに格納されるデータの構造を示すレコード定義が記述される。第2の実施の形態のレコード定義は、第1の実施の形態のデータ構造定義文に対応する。レコード定義は、ファイルに格納されるデータに含まれる1以上のレコード(データ項目)を示す。1つのレコードに対して、1つのデータ項目名と1つのデータ型とが定義される。ただし、処理ロジックを記述するのに好適な場合、2以上のレコードの集合に対し集団項目名が付与されることがある。 In the data portion, a record definition indicating the structure of data stored in the file indicated by the logical file name is described in association with the logical file name. The record definition of the second embodiment corresponds to the data structure definition statement of the first embodiment. The record definition indicates one or more records (data items) included in the data stored in the file. One data item name and one data type are defined for one record. However, when suitable for describing processing logic, a group item name may be given to a set of two or more records.
ソースプログラム131には、論理ファイル名「人事−REC」に対して、(従業員コード,X(5))、(所属コード,X(3))、(氏名,N(10))というレコード定義が記述されている。データ型であるX(5)は5文字の半角文字列を表し、X(3)は3文字の半角文字列を表し、N(10)は10文字の全角文字列を表している。
The
手続き部には、データ部で定義されたレコード定義を利用した処理ロジックが記述される。手続き部には、論理ファイル名が示すファイルからデータを読み出す処理ロジックが記述されることがある。その場合、データ項目名を変数名として用いて、ファイルから読み出したデータを参照することができる。また、手続き部には、論理ファイル名が示すファイルにデータを書き込む処理ロジックが記述されることがある。その場合、データ項目名を変数名として用いて、ファイルに書き込むデータを生成することができる。 In the procedure part, processing logic using the record definition defined in the data part is described. The procedure part may describe processing logic for reading data from the file indicated by the logical file name. In that case, data read from the file can be referred to using the data item name as the variable name. In the procedure section, processing logic for writing data to a file indicated by the logical file name may be described. In that case, data to be written to the file can be generated using the data item name as the variable name.
図4は、第2のレコード定義方法の例を示す図である。
ソースプログラム132は、図3のソースプログラム131と同様に、プログラミング言語としてCOBOLを用いて記述されたソースプログラムの例である。ソースプログラム132の環境部には、ソースプログラム131と同様に、論理ファイル名「人事−REC」と中間ファイル名「FILE1」が記述されている。すなわち、ソースプログラム132は、ソースプログラム131と同じファイルにアクセスすることがある。
FIG. 4 is a diagram illustrating an example of the second record definition method.
The
ただし、ソースプログラム131と異なり、ソースプログラム132のデータ部にはレコード定義が直接記述されていない。その代わりに、ソースプログラム132のデータ部には、レコード定義ファイル133を参照するCOPY文が記述されている。COPY文は、参照先のレコード定義ファイルに記述されたレコード定義を取り込む命令文である。ソースプログラム132は、ファイル名が「人事RECファイル」であるレコード定義ファイル133のレコード定義をデータ部に取り込んでいる。
However, unlike the
レコード定義ファイル133は、ソースプログラムから分離されたレコード定義用の外部ファイルである。レコード定義ファイル133には、ソースプログラム131のデータ部と同様に、(従業員コード,X(5))、(所属コード,X(3))、(氏名,N(10))というレコード定義が記述されている。レコード定義ファイル133のレコード定義をソースプログラム132のデータ部に取り込むことで、論理ファイル名「人事−REC」が示すファイルのデータにソースプログラム132からアクセスすることができる。
The
レコード定義ファイル133はソースプログラム132から分離されているため、複数のソースプログラムがレコード定義ファイル133を共有することも可能である。なお、上記のCOPY文とレコード定義ファイル133を利用したレコード定義の方法は、C言語のinclude文とヘッダファイルを利用することによっても実現できる。
Since the
ここで、情報処理システムを長期間運用していると、情報処理システム上で使用されるプログラム資産の拡張や変更が繰り返されることがある。その結果として、同一のファイルに対して、図3のような埋め込み形式のレコード定義を利用するソースプログラムと図4のような外部参照形式のレコード定義を利用するソースプログラムとが、プログラム資産の中に混在することがある。また、レコード定義の記述方法が統一されず、ソースプログラムやレコード定義ファイルによってレコード定義が異なることがある。 Here, when the information processing system is operated for a long period of time, the expansion and change of the program assets used on the information processing system may be repeated. As a result, a source program that uses an embedded record definition as shown in FIG. 3 and a source program that uses an external reference record definition as shown in FIG. May be mixed. In addition, the record definition description method is not uniform, and the record definition may differ depending on the source program or the record definition file.
同一のファイルに対して異なるレコード定義が存在する原因として、例えば、不注意により既存のデータ項目名と異なるデータ項目名を使用して新しいソースプログラムを作成してしまったことが考えられる。この場合、事後的にデータ項目名を統一することが可能であることが多い。一方、原因として、例えば、処理ロジックを記述する都合上、既存のソースプログラムが使用していない新たな集団項目名を定義した場合や、意図的に既存のレコード定義とは異なるデータ型を使用した場合も考えられる。この場合、処理ロジックが変わらないようにレコード定義を事後的に統一することが難しいことがある。 One possible cause of the existence of different record definitions for the same file is, for example, that a new source program has been created using a data item name that is different from an existing data item name. In this case, it is often possible to unify data item names afterwards. On the other hand, as a cause, for example, when defining a new group item name that is not used by an existing source program for the convenience of describing processing logic, or intentionally using a data type that is different from the existing record definition Cases are also conceivable. In this case, it may be difficult to unify the record definitions afterwards so that the processing logic does not change.
同一のファイルについてのレコード定義が様々なソースプログラムに重複して記述されている場合、プログラム資産の保守性が低下して以降の保守コストが増大する。また、同一のファイルについて複数のタイプのレコード定義が存在する場合にも、プログラム資産の保守性が低下して以降の保守コストが増大する。そこで、理想的には、1つのファイルについて1つのレコード定義ファイルを作成し、当該ファイルにアクセスするソースプログラムは全て当該レコード定義ファイルを参照するようにすることが好ましい。 When the record definition for the same file is described in duplicate in various source programs, the maintainability of the program asset is lowered and the subsequent maintenance cost is increased. In addition, even when there are a plurality of types of record definitions for the same file, the maintainability of the program asset is lowered and the subsequent maintenance cost is increased. Therefore, ideally, it is preferable that one record definition file is created for one file, and all source programs that access the file refer to the record definition file.
ただし、上記のように、同一のファイルについてのレコード定義を機械的に統一することが難しい場合がある。そこで、プログラム資産の保守性を向上させるために、情報処理システムのユーザやエンジニアなどがソースプログラムを見直し、統一することが可能な範囲でレコード定義を修正することがある。第2の実施の形態のプログラム分析装置100は、そのようなレコード定義の修正作業を支援する。具体的には、プログラム分析装置100は、複数のタイプのレコード定義の使用状況を可視化する。
However, as described above, it may be difficult to mechanically unify record definitions for the same file. Therefore, in order to improve the maintainability of program assets, the record definition may be corrected within a range where a user or an engineer of the information processing system can review and unify the source program. The
以下、プログラム分析装置100による可視化方法を説明する。まず、ソースプログラムからアクセスされるファイルの物理的同一性を判定する方法について説明する。
図5は、JCLファイルの例を示す図である。
Hereinafter, the visualization method by the
FIG. 5 is a diagram illustrating an example of a JCL file.
JCLファイル134は、1以上のソースプログラムを所定の順序で起動させるジョブを制御するためのJCLプログラムを記述したバッチファイルである。JCLファイル134のファイル名は「JCL01」である。プログラム分析装置100は、JCLファイル134を用いて、論理ファイル名から実ファイル名を特定する。
The
JCLファイル134には、複数のジョブステップが定義される。各ジョブステップについて、JCLファイル134には、ジョブ名と、起動されるソースプログラムのプログラム名が記述される。図5のJCLファイル134には、ジョブ名「JOB1」とプログラム名「PROGRAM1」が記述されている。また、各ジョブステップについて、JCLファイル134には、中間ファイル名と実ファイル名との対応関係が記述される。図5のJCLファイル134には、中間ファイル名「FILE1」が実ファイル名「FILE1.DAT1」に対応することが記述されている。同様に、中間ファイル名「FILE2」が実ファイル名「FILE2.DAT2」に対応し、中間ファイル名「FILE3」が実ファイル名「FILE3.DAT3」に対応することが記述されている。
A plurality of job steps are defined in the
なお、JCLファイル134には、データの使用方法を示すパラメータが記述されることがある。「NEW」はそのジョブステップでデータを新規に生成することを示す。「OLD」はそのジョブステップの前から存在するデータを排他的に読み出すことを示す。「SHR」はそのジョブステップの前から存在するデータを共有で読み出すことを示す。
In the
図6は、ファイル参照テーブルの例を示す図である。
プログラム分析装置100は、1以上のソースプログラムと1以上のJCLファイルとを分析してファイル参照テーブル135を生成する。ファイル参照テーブル135は、プログラム名、中間ファイル名、論理ファイル名、レコード定義ファイル名、JCLファイル名、ジョブ名および実ファイル名の項目を有する。
FIG. 6 is a diagram illustrating an example of a file reference table.
The
プログラム名の項目には、ソースプログラムやJCLファイルから抽出されたプログラム名が登録される。中間ファイル名の項目には、ソースプログラムやJCLファイルから抽出された中間ファイル名が登録される。論理ファイル名の項目には、ソースプログラムから抽出された論理ファイル名が登録される。レコード定義ファイル名の項目には、ソースプログラムから抽出されたレコード定義ファイル名が登録される。ただし、レコード定義が直接埋め込まれているソースコードについては、レコード定義ファイル名の項目は空欄となる。JCLファイル名の項目には、JCLファイルのファイル名が登録される。ジョブ名の項目には、JCLファイルから抽出されたジョブ名が登録される。実ファイル名の項目には、JCLファイルから抽出された実ファイル名が登録される。 In the program name item, a program name extracted from a source program or a JCL file is registered. In the intermediate file name item, an intermediate file name extracted from the source program or JCL file is registered. The logical file name extracted from the source program is registered in the logical file name item. The record definition file name extracted from the source program is registered in the record definition file name field. However, for the source code in which the record definition is directly embedded, the record definition file name field is blank. In the JCL file name item, the file name of the JCL file is registered. The job name extracted from the JCL file is registered in the job name item. The real file name extracted from the JCL file is registered in the real file name item.
プログラム分析装置100は、1以上のソースプログラムそれぞれについて、見出し部からプログラム名を抽出し、環境部から中間ファイル名と論理ファイル名を抽出する。また、プログラム分析装置100は、抽出した論理ファイル名についてのCOPY文がデータ部に記述されている場合、COPY文に含まれるレコード定義ファイル名を抽出する。プログラム分析装置100は、抽出したプログラム名と中間ファイル名と論理ファイル名とレコード定義ファイル名を対応付けてファイル参照テーブル135に登録する。
For each of one or more source programs, the
例えば、プログラム分析装置100は、ソースプログラム131から、プログラム名「PROGRAM1」、中間ファイル名「FILE1」および論理ファイル名「人事−REC」を抽出して登録する。レコード定義がソースプログラム131に直接埋め込まれているため、レコード定義ファイル名の項目は空欄になる。また、例えば、プログラム分析装置100は、ソースプログラム132から、プログラム名「PROGRAM2」、中間ファイル名「FILE1」、論理ファイル名「人事−REC」およびレコード定義ファイル名「人事RECファイル」を抽出して登録する。
For example, the
また、プログラム分析装置100は、1以上のJCLファイルそれぞれについて、JCLファイル名、ジョブ名、プログラム名、中間ファイル名および実ファイル名を抽出する。プログラム分析装置100は、ファイル参照テーブル135から、抽出したプログラム名と中間ファイル名を含む情報を検索し、検索した情報と対応付けて、抽出したJCLファイル名とジョブ名と実ファイル名をファイル参照テーブル135に登録する。
Further, the
例えば、プログラム分析装置100は、JCLファイル134から、JCLファイル名「JCL01」、ジョブ名「JOB1」、プログラム名「PROGRAM1」、中間ファイル名「FILE1」および実ファイル名「FILE1.DAT1」を抽出する。プログラム分析装置100は、ファイル参照テーブル135から、プログラム名「PROGRAM1」と中間ファイル名「FILE1」に対応する行を検索する。プログラム分析装置100は、ファイル参照テーブル135の検索した行に、JCLファイル名「JCL01」、ジョブ名「JOB1」および実ファイル名「FILE1.DAT1」を登録する。
For example, the
これにより、プログラム名とレコード定義ファイル名と実ファイル名を紐付けることができる。すなわち、複数のソースプログラムそれぞれがデータアクセスに用いる物理的なファイルと、参照するレコード定義ファイルとを特定できる。 Thereby, the program name, the record definition file name, and the actual file name can be associated. That is, a physical file used for data access by each of a plurality of source programs and a record definition file to be referenced can be specified.
次に、プログラム資産に含まれるレコード定義のタイプ分類について説明する。
図7は、レコード定義のタイプ分類例を示す図である。
レコード定義141〜145は、同一のファイルについての異なるレコード定義であり、例えば、異なるソースプログラムに記述されたものである。
Next, the type classification of the record definition included in the program asset will be described.
FIG. 7 is a diagram illustrating an example of type classification of record definition.
The
レコード定義141に記述された「XXX−KEY」、「XXX−FLG」は集団項目名である。レコード定義141に記述された「XXX−PGM−ID」、「XXX−SEQ−NO」、「XXX−TANMATSU−KBN」はデータ項目名である。また、レコード定義141に記述された「XXX−FLG−1」、「XXX−FLG−2」、「XXX−FLG−3」、「XXX−FLG−4」、「XXX−FLG−5」はデータ項目名である。また、レコード定義141に記述された「XXX−SITE−MEI」、「XXX−SITE−MEI−RYAKUSHO」、「FILLER」はデータ項目名である。レコード定義141に記述された「X(07)」、「9(02)」、「X(01)」、「N(15)」、「N(07)」、「X(21)」はデータ型である。
“XXX-KEY” and “XXX-FLG” described in the
データ項目名に含まれる「XXX−」は接頭辞である。2つのデータ項目名の同一性を判断するにあたり、プログラム分析装置100は、接頭辞を匿名化する(接頭辞の違いを無視する)ことがある。データ項目名の接頭辞は論理ファイル名と関連していることがある。例えば、論理ファイル名が「U01−REC」であるファイルについてのデータ項目名が「U01−AAA」のように定義されることがある。この場合、データ項目名の先頭に付加されている「U01−」を接頭辞とみなすことができる。
“XXX-” included in the data item name is a prefix. In determining the identity of two data item names, the
レコード定義142は、データ項目名「XXX−SITE−MEI」に対応するデータ型が「X(30)」である点でレコード定義141と異なる。また、レコード定義142は、データ項目名「XXX−SITE−MEI−RYAKUSHO」に対応するデータ型が「X(14)」である点でレコード定義141と異なる。よって、レコード定義141が第1のタイプに属するとすると、レコード定義142は第2のタイプに属する。
The
レコード定義143は、「XXX−SITE−MEI−RYAKUSHO」が集団項目名であり、「XXX−SITE−MEI−RYAKU−KJ」がデータ項目名である点でレコード定義141と異なる。レコード定義143は、レコード定義141,142の何れとも異なっている。よって、レコード定義143は第3のタイプに属する。
The
図8は、レコード定義のタイプ分類例を示す図(続き)である。
レコード定義144は、レコード定義141のデータ項目名「XXX−FLG」が「XXX−SHORI−FLG」に変更されている点でレコード定義141と異なる。また、レコード定義144は、レコード定義141のデータ項目名「FILLER」が「XXX−FILLER」に変更されている点でレコード定義141と異なる。レコード定義144は、レコード定義141〜143の何れとも異なっている。よって、レコード定義144は第4のタイプに属する。なお、接頭辞を匿名化する場合、「FILLER」と「XXX−FILLER」とが実質的に同じであると判断されてもよい。
FIG. 8 is a diagram (continued) showing an example of type classification of record definition.
The
レコード定義145は、データ項目名「XXX−SITE−MEI」に対応するデータ型が「X(30)」である点でレコード定義141と異なる。また、レコード定義145は、データ項目名「XXX−SITE−MEI−RYAKUSHO」に対応するデータ型が「X(14)」である点でレコード定義141と異なる。また、レコード定義145は、レコード定義141のデータ項目名「FILLER」が「XXX−FILLER」に変更されている点でレコード定義141と異なる。上記のデータ型の差異は、レコード定義142と同様である。また、上記のデータ項目名の差異は、レコード定義144と同様である。しかし、レコード定義145は、全体としてレコード定義141〜144の何れとも異なっている。よって、レコード定義145は第5のタイプに属する。このように、レコード定義141〜145は互いに異なるタイプに属することになる。
The
図9は、タイプ分類テーブルの例を示す図である。
プログラム分析装置100は、上記のようにして分類した複数のタイプの使用状況を可視化するにあたり、タイプ分類テーブル136を生成する。
FIG. 9 is a diagram illustrating an example of the type classification table.
The
プログラム分析装置100は、レコード定義のタイプ毎に、当該タイプに属するレコード定義を使用するソースプログラムの数をカウントする。複数のソースプログラムが共通のレコード定義ファイルをCOPY文によって参照している場合、COPY文1つにつきカウントが+1される。また、プログラム分析装置100は、タイプ毎に共通のレコード定義ファイルを作成してソースプログラムに直接記述されたレコード定義を全て外部参照形式に変換した場合の削減率を試算する。削減率は、現在のプログラム資産に含まれるソースプログラムの総ステップ数(例えば、総行数)に対する、変換により減少するソースプログラムのステップ数(例えば、減少行数)の割合である。
For each type of record definition, the
削減率は実ファイル毎に算出される。多数のソースプログラムに埋め込み形式で記述されているタイプが存在する実ファイルは、削減率が大きくなりやすい。一方、既に1つまたは少数のレコード定義ファイルを参照する外部参照形式に統一されているタイプが存在する実ファイルは、削減率が小さくなりやすい。また、少数のソースプログラムでしか使用されていないタイプが存在する実ファイルは、削減率が小さくなりやすい。 The reduction rate is calculated for each real file. An actual file having a type described in an embedded format in a large number of source programs tends to have a large reduction rate. On the other hand, a reduction rate tends to be small for an actual file that already has a type that is standardized to an external reference format that refers to one or a few record definition files. In addition, a reduction rate tends to be small for an actual file having a type that is used only by a small number of source programs.
ここで、接頭辞を匿名化してデータ項目名同士を比較した場合(接頭辞を無視した場合)、接頭辞を無視しない場合よりもタイプ数が少なくなる。この場合、接頭辞のみ異なるレコード定義の記述を統一することができれば、接頭辞を無視しない場合よりも削減率が大きくなる。そこで、プログラム分析装置100は、接頭辞を無視しない場合と接頭辞を無視した場合の両方についてプログラム数や削減率を算出することが好ましい。
Here, when the prefixes are anonymized and the data item names are compared with each other (when the prefix is ignored), the number of types is smaller than when the prefix is not ignored. In this case, if the description of the record definitions that differ only in the prefix can be unified, the reduction rate becomes larger than the case where the prefix is not ignored. Therefore, it is preferable that the
タイプ分類テーブル136は、実ファイル名、プログラム数、削減率、接頭辞無視のプログラム数および接頭辞無視の削減率の項目を有する。実ファイル名の項目には、ソースプログラムからアクセスされる物理的なファイルの実ファイル名が登録される。プログラム数の項目には、接頭辞を無視せずにレコード定義をタイプ分類したときの複数のタイプのソースプログラム数が列挙される。実ファイル名とプログラム名の関係は、ファイル参照テーブル135を用いて特定することができる。 The type classification table 136 includes items of an actual file name, the number of programs, a reduction rate, the number of programs ignoring prefixes, and a reduction rate ignoring prefixes. In the real file name item, the real file name of a physical file accessed from the source program is registered. In the program number field, the number of source programs of a plurality of types when a record definition is classified without ignoring the prefix is listed. The relationship between the actual file name and the program name can be specified using the file reference table 135.
削減率の項目には、接頭辞を無視しないことで得られた複数のタイプそれぞれを外部参照形式に変換した場合の削減率が登録される。接頭辞無視のプログラム数の項目には、接頭辞を無視してレコード定義をタイプ分類したときの複数のタイプのソースプログラム数が列挙される。接頭辞を無視したときのタイプ数は、接頭辞を無視しないときのタイプ数以下となる。接頭辞無視の削減率の項目には、接頭辞を無視することで得られた複数のタイプそれぞれを外部参照形式に変換した場合の削減率が登録される。接頭辞を無視したときの削減率は、接頭辞を無視しないときの削減率以上となる。 In the item of reduction rate, the reduction rate when each of a plurality of types obtained by not ignoring the prefix is converted into an external reference format is registered. In the item of the number of programs ignoring the prefix, the number of source programs of a plurality of types when the record definition is typed by ignoring the prefix is listed. The number of types when the prefix is ignored is less than the number of types when the prefix is not ignored. In the item “reduction rate of ignoring prefix”, a reduction rate when each of a plurality of types obtained by ignoring the prefix is converted into an external reference format is registered. The reduction rate when the prefix is ignored is greater than the reduction rate when the prefix is not ignored.
プログラム分析装置100は、生成したタイプ分類テーブル136に基づいて可視化画面をディスプレイ111に表示する。次に、可視化画面の例を説明する。
図10は、レコード定義分布の第1の可視化例を示す図である。
The
FIG. 10 is a diagram illustrating a first visualization example of the record definition distribution.
可視化画面151はディスプレイ111に表示される。可視化画面151は、実ファイル名が「ファイルA」であるファイルについての複数のタイプの使用状況を示す。可視化画面151の左側の円グラフは、接頭辞を無視しない場合の複数のタイプの間のプログラム数の比を示している。可視化画面151の右側の円グラフは、接頭辞を無視した場合の複数のタイプの間のプログラム数の比を示している。
The
円グラフを用いることで、あるファイルについて最も多く使用されているレコード定義のタイプを把握することが容易となる。ユーザは、例えば、最も多く使用されているタイプを標準レコード定義として選択し、当該ファイルのレコード定義を標準レコード定義に統一することを検討することが考えられる。また、円グラフを用いることで、標準レコード定義以外のタイプがどの程度使用されているか把握することが容易となる。これにより、ユーザは、例えば、当該ファイルのレコード定義を修正することによるプログラム資産の保守性向上効果を見積もることが可能となる。プログラム分析装置100は、ユーザ入力に応じて、異なるファイルについての円グラフを表示してもよい。
By using a pie chart, it is easy to grasp the type of record definition that is most frequently used for a certain file. For example, the user may select the most frequently used type as the standard record definition and consider to unify the record definition of the file into the standard record definition. Also, by using a pie chart, it becomes easy to grasp how much types other than the standard record definition are used. As a result, the user can estimate the effect of improving the maintainability of the program asset by correcting the record definition of the file, for example. The
図11は、レコード定義分布の第2の可視化例を示す図である。
可視化画面152はディスプレイ111に表示される。可視化画面152は、複数のファイルについての複数のタイプの使用状況を示す。可視化画面152では、各ファイルについての複数のタイプのプログラム数が積み上げ棒グラフによって表されている。図11の例は、接頭辞を無視した場合のプログラム数を示す。プログラム分析装置100は、ユーザ入力に応じて、接頭辞を無視した場合のグラフと無視しない場合のグラフを切り替えて表示してもよい。積み上げ棒グラフを用いることで、図10の場合と同様に、あるファイルについて最も多く使用されているレコード定義のタイプを把握することが容易となる。また、積み上げ棒グラフを用いることで、標準レコード定義以外のタイプがどの程度使用されているか把握することが容易となる。
FIG. 11 is a diagram illustrating a second visualization example of the record definition distribution.
The
図12は、プログラム修正効果の可視化例を示す図である。
可視化画面153はディスプレイ111に表示される。可視化画面153は、複数の実ファイル名それぞれについて、接頭辞を無視せずに試算した削減率と接頭辞を無視して試算した削減率とを表形式で表している。可視化画面153によれば、ソースプログラムのレコード定義を外部参照形式に変換することによる効果を定量的に表現できる。図12では、削減率が1%以上になる場合を強調表示している。
FIG. 12 is a diagram illustrating a visualization example of the program correction effect.
The
次に、プログラム分析装置100の機能について説明する。
図13は、プログラム分析装置の機能例を示すブロック図である。
プログラム分析装置100は、JCLファイル記憶部121、ソースプログラム記憶部122、ファイル参照テーブル記憶部123およびタイプ分類テーブル記憶部124を有する。また、プログラム分析装置100は、JCLファイル分析部125、ソースプログラム分析部126、タイプ判定部127および表示制御部128を有する。
Next, functions of the
FIG. 13 is a block diagram illustrating an example of functions of the program analysis apparatus.
The
JCLファイル記憶部121、ソースプログラム記憶部122、ファイル参照テーブル記憶部123およびタイプ分類テーブル記憶部124は、例えば、RAM102またはHDD103の記憶領域を用いて実装される。JCLファイル分析部125、ソースプログラム分析部126、タイプ判定部127および表示制御部128は、例えば、CPU101が実行するプログラムモジュールを用いて実装される。
The JCL
JCLファイル記憶部121は、JCLファイル134のような1以上のJCLファイルを記憶する。プログラム分析装置100は、JCLファイル記憶部121に記憶されるJCLファイルを他の装置から受信してもよい。また、プログラム分析装置100は、JCLファイルを記録媒体113から読み出してもよい。
The JCL
ソースプログラム記憶部122は、ソースプログラム131,132のような1以上のソースプログラムを記憶する。また、ソースプログラム記憶部122は、ソースプログラムから参照される1以上のレコード定義ファイルを記憶する。プログラム分析装置100は、ソースプログラム記憶部122に記憶されるソースプログラムやレコード定義ファイルを他の装置から受信してもよい。また、プログラム分析装置100は、ソースプログラムやレコード定義ファイルを記録媒体113から読み出してもよい。
The source
ファイル参照テーブル記憶部123は、ファイル参照テーブル135を記憶する。タイプ分類テーブル記憶部124は、タイプ分類テーブル136を記憶する。
JCLファイル分析部125は、JCLファイル記憶部121に記憶されたJCLファイルを分析し、JCLファイル名、ジョブ名、プログラム名、中間ファイル名および実ファイル名を抽出する。JCLファイル分析部125は、ファイル参照テーブル記憶部123に記憶されたファイル参照テーブル135に、プログラム名および中間ファイル名と対応付けて、JCLファイル名、ジョブ名および実ファイル名を登録する。
The file reference
The JCL
ソースプログラム分析部126は、ソースプログラム記憶部122に記憶されたソースプログラムを分析し、プログラム名、中間ファイル名、論理ファイル名およびレコード定義ファイル名を抽出する。ソースプログラム分析部126は、ファイル参照テーブル記憶部123に記憶されたファイル参照テーブル135に、プログラム名、中間ファイル名、論理ファイル名およびレコード定義ファイル名を登録する。
The source
タイプ判定部127は、ファイル参照テーブル記憶部123に記憶されたファイル参照テーブル135を参照して、ソースプログラム記憶部122に記憶されたソースプログラムやレコード定義ファイルからレコード定義を抽出する。タイプ判定部127は、同一のファイルに対するレコード定義を相互に比較して複数のタイプに分類する。
The
タイプ判定部127は、接頭辞を無視しない場合と接頭辞を無視した場合それぞれについて、複数のタイプそれぞれに属するレコード定義を使用するソースプログラムの数をカウントする。タイプ判定部127は、タイプ分類テーブル記憶部124に記憶されたタイプ分類テーブル136に、接頭辞を無視しない場合のプログラム数と接頭辞を無視した場合のプログラム数を登録する。また、タイプ判定部127は、タイプ毎に1つのレコード定義ファイルを生成するシミュレーションを行い、接頭辞を無視しない場合と接頭辞を無視した場合それぞれについて削減率を試算する。タイプ判定部127は、タイプ分類テーブル記憶部124に記憶されたタイプ分類テーブル136に、接頭辞を無視しない場合の削減率と接頭辞を無視した場合の削減率を登録する。
The
表示制御部128は、タイプ分類テーブル記憶部124に記憶されたタイプ分類テーブル136に基づいて、可視化画面151〜153のような可視化画面を生成する。表示制御部128は、生成した可視化画面をディスプレイ111に表示させる。表示制御部128は、ユーザからの入力に応じて、表示する可視化画面を切り替えてもよい。なお、プログラム分析装置100は、タイプ分類テーブル136の情報またはそれに基づいて生成された可視化情報(グラフなど)を他の装置に送信してもよい。また、プログラム分析装置100は、タイプ分類テーブル136の情報またはそれに基づいて生成された可視化情報を、ディスプレイ111以外の出力デバイス(プリンタなど)に出力してもよい。
The
図14は、プログラム分析の手順例を示すフローチャートである。
(S10)ソースプログラム分析部126は、ソースプログラムを1つ選択する。
(S11)ソースプログラム分析部126は、選択したソースプログラムの見出し部からプログラム名を抽出する。また、ソースプログラム分析部126は、選択したソースプログラムの環境部から中間ファイル名と論理ファイル名を抽出する。
FIG. 14 is a flowchart illustrating a procedure example of program analysis.
(S10) The source
(S11) The source
(S12)ソースプログラム分析部126は、選択したソースプログラムのデータ部から、ステップS11で抽出した論理ファイル名についての記述を取得する。そして、ソースプログラム分析部126は、当該論理ファイル名についての記述が、当該ソースプログラム外のレコード定義ファイルを参照するものであるか、すなわち、レコード定義を取り込むCOPY文であるか判断する。COPY文である場合はステップS13に処理が進み、COPY文でない場合はステップS14に処理が進む。
(S12) The source
(S13)ソースプログラム分析部126は、選択したソースプログラムのデータ部から、論理ファイル名と当該論理ファイル名に対応付けられたレコード定義ファイル名を抽出する。そして、ステップS15に処理が進む。
(S13) The source
(S14)ソースプログラム分析部126は、選択したソースプログラムのデータ部から論理ファイル名を抽出する。そして、ステップS15に処理が進む。
(S15)ソースプログラム分析部126は、ファイル参照テーブル135に、抽出したプログラム名、中間ファイル名、論理ファイル名およびレコード定義ファイル名を対応付けて登録する。ただし、レコード定義ファイル名が抽出されなかった場合(ステップS13を実行しなかった場合)には、レコード定義ファイル名の項目は空欄となる。
(S14) The source
(S15) The source
(S16)ソースプログラム分析部126は、未選択の残りのソースプログラムが存在するか判断する。残りのソースプログラムがある場合はステップS10に処理が進み、残りのソースプログラムがない場合はステップS17に処理が進む。
(S16) The source
(S17)JCLファイル分析部125は、JCLファイルに記述されたジョブステップを1つ選択する。1つのジョブステップは、1つのソースプログラムの実行を示す。
(S18)JCLファイル分析部125は、選択したジョブステップが記述されたJCLファイルのJCLファイル名を取得する。また、JCLファイル分析部125は、選択したジョブステップの記述から、ジョブ名、起動するソースプログラムのプログラム名、使用するファイルの1以上の中間ファイル名および1以上の実ファイル名を抽出する。
(S17) The JCL
(S18) The JCL
(S19)JCLファイル分析部125は、ステップS18で抽出したプログラム名と中間ファイル名の組が、ファイル参照テーブル135に登録されているか判断する。プログラム名と中間ファイル名の組が登録されている場合はステップS20に処理が進み、登録されていない場合はステップS21に処理が進む。
(S19) The JCL
(S20)JCLファイル分析部125は、抽出したプログラム名および中間ファイル名と対応付けて、ステップS18で抽出したJCLファイル名、ジョブ名および実ファイル名をファイル参照テーブル135に登録する。
(S20) The JCL
(S21)JCLファイル分析部125は、未選択の残りのジョブステップが存在するか判断する。残りのジョブステップがある場合はステップS17に処理が進み、残りのジョブステップがない場合はステップS22に処理が進む。
(S21) The JCL
図15は、プログラム分析の手順例を示すフローチャート(続き)である。
(S22)タイプ判定部127は、ファイル参照テーブル135に登録された情報を実ファイル名でソートし、同じ実ファイル名の情報を纏める。
FIG. 15 is a flowchart (continued) showing an example of the procedure of program analysis.
(S22) The
(S23)タイプ判定部127は、実ファイル名を1つ選択する。
(S24)タイプ判定部127は、選択した実ファイル名が示すファイルについてのレコード定義を、ソースプログラム記憶部122に記憶されたソースプログラムやレコード定義ファイルから全て抽出する。すなわち、タイプ判定部127は、ファイル参照テーブル135から、選択した実ファイル名を含む情報を抽出する。タイプ判定部127は、レコード定義ファイル名が登録されていない情報に対しては、ソースプログラムからレコード定義を抽出する。一方、タイプ判定部127は、レコード定義ファイル名が登録されている情報に対しては、レコード定義ファイルからレコード定義を抽出する。
(S23) The
(S24) The
(S25)タイプ判定部127は、ステップS24で抽出した複数のレコード定義を比較して、それら複数のレコード定義を複数のタイプに分類する。ここでは、タイプ判定部127は、データ項目名の接頭辞を匿名化せずにレコード定義を比較する。よって、同じタイプに属するレコード定義は、データ項目名とデータ型が完全に一致している。
(S25) The
(S26)タイプ判定部127は、ステップS25で得られた複数のタイプそれぞれについて、当該タイプに属するレコード定義を使用するソースプログラムの数をカウントする。埋め込み形式のソースプログラムについては、当該タイプに属するレコード定義がデータ部に記述されているソースプログラム1つにつき、カウントが+1される。外部参照形式のソースプログラムについては、当該タイプに属するレコード定義を記述したレコード定義ファイルを参照するソースプログラム1つにつき、カウントが+1される。タイプ判定部127は、複数のタイプのプログラム数をタイプ分類テーブル136に登録する。
(S26) For each of the plurality of types obtained in step S25, the
(S27)タイプ判定部127は、現在のプログラム資産に含まれるソースプログラムおよびレコード定義ファイルの総行数を算出する。
(S28)タイプ判定部127は、タイプ毎にレコード定義を外部化すること、すなわち、タイプ毎に1つのレコード定義ファイルを生成して全てのソースプログラムを外部参照形式に変換するシミュレーションを行う。そして、タイプ判定部127は、レコード定義の外部化により減少する行数を試算する。なお、レコード定義の外部化によりソースプログラムの行数が減少する一方、新たに生成したレコード定義ファイルの行数だけ増加することがある。ここで試算される行数は、両者の差分である実質的な減少行数である。
(S27) The
(S28) The
(S29)タイプ判定部127は、ステップS28で試算した減少行数をステップS27で算出した総行数で割った削減率を算出する。タイプ判定部127は、選択した実ファイル名と対応付けて、算出した削減率をタイプ分類テーブル136に登録する。
(S29) The
(S30)タイプ判定部127は、ステップS24で抽出したレコード定義に含まれるデータ項目名から接頭辞の部分を判断し、接頭辞を匿名化する。タイプ判定部127は、データ項目名に含まれる接頭辞を特殊な文字または文字列に置換してもよい。また、タイプ判定部127は、データ項目名から接頭辞を削除してもよい。
(S30) The
(S31)タイプ判定部127は、ステップS30で接頭辞を匿名化したレコード定義を用いて、ステップS25〜S29と同様の処理を行う。これにより、接頭辞の違いを無視した場合の複数のタイプが得られ、複数のタイプそれぞれのプログラム数が算出される。また、接頭辞の違いを無視した場合の削減率が算出される。タイプ判定部127は、算出したプログラム数と削減率をタイプ分類テーブル136に登録する。
(S31) The
(S32)タイプ判定部127は、未選択の残りの実ファイル名が存在するか判断する。残りの実ファイル名がある場合はステップS23に処理が進み、残りの実ファイル名がない場合はステップS33に処理が進む。
(S32) The
(S33)表示制御部128は、タイプ分類テーブル136に基づいて可視化画面を生成し、ディスプレイ111に可視化画面を表示させる。例えば、表示制御部128は、1以上の実ファイル名について、複数のタイプの間のプログラム数の比を算出し、可視化画面151のような円グラフを表示させる。また、例えば、表示制御部128は、1以上の実ファイル名について、可視化画面152のような積み上げ棒グラフを表示させる。また、例えば、表示制御部128は、可視化画面153のような削減率を表示させる。
(S33) The
第2の実施の形態のプログラム分析装置100によれば、ソースプログラムとJCLファイルを分析することで、データが格納された物理的なファイルとソースプログラムとが紐付けられる。この紐付けに基づいて、同一のファイルに対する複数のレコード定義が抽出され、複数のレコード定義の間の比較に基づいてそれら複数のレコード定義が複数のタイプに分類される。そして、複数のタイプそれぞれについてソースプログラムの数がカウントされ、複数のタイプの間のプログラム数の分布が表示される。
According to the
これにより、同一のファイルに対する複数のレコード定義の使用状況を可視化することができる。よって、レコード定義の記述方法を統一する修正作業や、レコード定義の記述をソースプログラムからレコード定義ファイルに移動する修正作業を効率化できる。例えば、レコード定義で使用するデータ項目名を統一するにあたり、複数のタイプのうち最もプログラム数の多いタイプのデータ項目名を標準データ項目名として選択することで、修正作業を効率化することができる。また、例えば、プログラム数の多いタイプのレコード定義を修正対象として優先的に検討することで、限られた時間の中で保守性改善効果の大きい修正作業を優先的に行うことが可能となる。また、削減率の大きいファイルについて優先的に修正作業を行うことで、大きな保守性改善効果を得ることができる。 This makes it possible to visualize the usage status of a plurality of record definitions for the same file. Therefore, it is possible to improve the efficiency of the correction work for unifying the record definition description method and the correction work for moving the record definition description from the source program to the record definition file. For example, when unifying data item names used in the record definition, the data item name of the type with the largest number of programs among a plurality of types can be selected as the standard data item name, so that correction work can be made more efficient. . Further, for example, by preferentially considering a record definition of a type having a large number of programs as a correction target, it becomes possible to preferentially perform a correction operation having a large maintainability improvement effect within a limited time. In addition, by performing correction work preferentially for a file with a large reduction rate, it is possible to obtain a significant improvement in maintainability.
10 プログラム分析装置
11 記憶部
12 演算部
13 プログラム資産
14a,14b,14c,14d,14e,14f データ構造定義文
15a,15b,15c タイプ
16 分布情報
DESCRIPTION OF
Claims (6)
同一のファイルにアクセスする複数のプログラムを含むプログラム資産から、それぞれが前記ファイルに格納されるデータの構造を示す複数のデータ構造定義文を抽出し、
前記複数のデータ構造定義文の間の比較に基づいて前記複数のデータ構造定義文を複数のタイプに分類し、前記複数のタイプそれぞれについて前記複数のプログラムのうち当該タイプに属するデータ構造定義文を使用するプログラムの数をカウントし、
前記複数のタイプの間の前記プログラムの数の分布を示す分布情報を出力する、
プログラム分析方法。 A program analysis method executed by a computer,
From a program asset including a plurality of programs that access the same file, a plurality of data structure definition statements each indicating the structure of data stored in the file are extracted,
The plurality of data structure definition statements are classified into a plurality of types based on a comparison between the plurality of data structure definition statements, and a data structure definition statement belonging to the type among the plurality of programs for each of the plurality of types. Count the number of programs used,
Outputting distribution information indicating a distribution of the number of programs among the plurality of types;
Program analysis method.
異なるデータ型を使用するデータ構造定義文は異なるタイプに分類される、
請求項1記載のプログラム分析方法。 Each of the plurality of data structure definition statements indicates one or more data types corresponding to one or more data items included in data stored in the file,
Data structure definition statements that use different data types are classified into different types,
The program analysis method according to claim 1.
請求項1記載のプログラム分析方法。 The distribution information includes at least one of a first graph indicating the number of the programs of each of the plurality of types and a second graph indicating a ratio of the number of the programs between the plurality of types.
The program analysis method according to claim 1.
請求項1記載のプログラム分析方法。 Further, the modification effect information indicating the change in the scale by calculating the change in the scale of the program asset that occurs when the data structure definition statement belonging to the type is separated from the plurality of programs and aggregated into a common file for each type. Output,
The program analysis method according to claim 1.
前記プログラム資産からそれぞれが前記ファイルに格納されるデータの構造を示す複数のデータ構造定義文を抽出し、前記複数のデータ構造定義文の間の比較に基づいて前記複数のデータ構造定義文を複数のタイプに分類し、前記複数のタイプそれぞれについて前記複数のプログラムのうち当該タイプに属するデータ構造定義文を使用するプログラムの数をカウントし、前記複数のタイプの間の前記プログラムの数の分布を示す分布情報を出力する演算部と、
を有するプログラム分析装置。 A storage unit that stores program assets including a plurality of programs that access the same file;
A plurality of data structure definition statements each indicating the structure of data stored in the file are extracted from the program asset, and the plurality of data structure definition statements are extracted based on a comparison between the plurality of data structure definition statements. The number of programs that use data structure definition statements belonging to the type among the plurality of programs is counted for each of the plurality of types, and the distribution of the number of the programs among the plurality of types is calculated. A calculation unit that outputs distribution information indicating;
A program analysis apparatus.
同一のファイルにアクセスする複数のプログラムを含むプログラム資産から、それぞれが前記ファイルに格納されるデータの構造を示す複数のデータ構造定義文を抽出し、
前記複数のデータ構造定義文の間の比較に基づいて前記複数のデータ構造定義文を複数のタイプに分類し、前記複数のタイプそれぞれについて前記複数のプログラムのうち当該タイプに属するデータ構造定義文を使用するプログラムの数をカウントし、
前記複数のタイプの間の前記プログラムの数の分布を示す分布情報を出力する、
処理を実行させる分析プログラム。 On the computer,
From a program asset including a plurality of programs that access the same file, a plurality of data structure definition statements each indicating the structure of data stored in the file are extracted,
The plurality of data structure definition statements are classified into a plurality of types based on a comparison between the plurality of data structure definition statements, and a data structure definition statement belonging to the type among the plurality of programs for each of the plurality of types. Count the number of programs used,
Outputting distribution information indicating a distribution of the number of programs among the plurality of types;
An analysis program that executes processing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016155457A JP2018025852A (en) | 2016-08-08 | 2016-08-08 | Program analysis method, program analyzer and analysis program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016155457A JP2018025852A (en) | 2016-08-08 | 2016-08-08 | Program analysis method, program analyzer and analysis program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2018025852A true JP2018025852A (en) | 2018-02-15 |
Family
ID=61193863
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2016155457A Pending JP2018025852A (en) | 2016-08-08 | 2016-08-08 | Program analysis method, program analyzer and analysis program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2018025852A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021053373A1 (en) * | 2019-09-19 | 2021-03-25 | Aplas Pty Ltd | Method and system for indexing and mapping software assets of business |
-
2016
- 2016-08-08 JP JP2016155457A patent/JP2018025852A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021053373A1 (en) * | 2019-09-19 | 2021-03-25 | Aplas Pty Ltd | Method and system for indexing and mapping software assets of business |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10776569B2 (en) | Generation of annotated computerized visualizations with explanations for areas of interest | |
CN112036736A (en) | Workflow creating method and device | |
JP7054051B2 (en) | Software robot definition information generation system, software robot definition information generation method, and program | |
US20150052157A1 (en) | Data transfer content selection | |
WO2010058222A2 (en) | Updating data within a business planning tool | |
WO2008147729A1 (en) | Data visualization | |
WO2014054230A1 (en) | Information system construction device, information system construction method, and storage medium | |
US20210326366A1 (en) | Generation of lineage data subset based upon business role | |
JP2017045080A (en) | Business flow specification regeneration method | |
US10678864B2 (en) | Analysis model preparing system, programming apparatus, and analysis model preparing method | |
US8392892B2 (en) | Method and apparatus for analyzing application | |
JP2019219848A (en) | Source code analysis method and source code analysis device | |
JP2014123249A (en) | Information processor, program, and information processing method | |
US10296496B2 (en) | Data editing device and data editing method | |
JP2018025852A (en) | Program analysis method, program analyzer and analysis program | |
JP6966289B2 (en) | Information analyzers, programs and methods | |
US20070179922A1 (en) | Apparatus and method for forecasting control chart data | |
CN106844218B (en) | Evolution influence set prediction method based on evolution slices | |
US20060230080A1 (en) | Apparatus for tracking work process and computer product | |
US10114916B1 (en) | Method and system to accelerate visualization of waveform data | |
JP2019101829A (en) | Software component management system, computor, and method | |
JP7082284B2 (en) | Analysis support method and analysis support program | |
JP2016126532A (en) | Calculation program, information processing apparatus, and calculation method | |
US20230401056A1 (en) | Interactive code visualization system | |
JP2014164336A (en) | Model analysis device, model analysis method and model analysis program |