JP2012198829A - Computer system - Google Patents
Computer system Download PDFInfo
- Publication number
- JP2012198829A JP2012198829A JP2011063474A JP2011063474A JP2012198829A JP 2012198829 A JP2012198829 A JP 2012198829A JP 2011063474 A JP2011063474 A JP 2011063474A JP 2011063474 A JP2011063474 A JP 2011063474A JP 2012198829 A JP2012198829 A JP 2012198829A
- Authority
- JP
- Japan
- Prior art keywords
- control means
- instruction
- relational database
- cobol program
- read
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 claims description 21
- 238000013500 data storage Methods 0.000 claims description 12
- 230000006870 function Effects 0.000 abstract description 12
- 238000007726 management method Methods 0.000 description 27
- 238000006243 chemical reaction Methods 0.000 description 25
- 238000013523 data management Methods 0.000 description 20
- 238000012546 transfer Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 9
- 238000012545 processing Methods 0.000 description 6
- 238000012790 confirmation Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 3
- 238000001028 reflection method Methods 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は計算機システムに関し、特にCOBOLプログラムからリレーショナルデータベースのテーブルに対して出されたREAD命令をSQL文による命令に変換して発行する機能を有する計算機システムに関する。 The present invention relates to a computer system, and more particularly to a computer system having a function of converting a READ instruction issued from a COBOL program to a relational database table into an instruction using an SQL statement and issuing it.
メインフレームからデータベースアクセスを行うCOBOLプログラムの動作に、データの入出力を行うための命令としてREAD/WRITE命令でファイルアクセスする方法がある。オープンサーバ上で動作するDBMSが提供するアクセス方法は主にSQLであり、READ/WRITE命令でのアクセス方法は提供していない。このため、マイグレーションとして、メインフレームのデータベースからオープンサーバ環境にあるデータベースに移行する場合、SQLを使用するように改修するか、READ/WRITE命令をエミュレーションしアクセスできる方法を提供する必要がある。前者の方法については、例えば特許文献1に記載される技術が知られている。後者については、例えば特許文献2〜4に記載される技術が知られている。本発明は後者の方法の改良に関する。
There is a method of accessing a file with READ / WRITE instruction as an instruction to input / output data in the operation of the COBOL program that accesses the database from the mainframe. Access methods provided by DBMS running on an open server are mainly SQL, and access methods using READ / WRITE instructions are not provided. For this reason, when migrating from a mainframe database to a database in an open server environment, it is necessary to provide a method that can be modified to use SQL or emulate and access a READ / WRITE instruction. As for the former method, for example, a technique described in
特許文献2〜4に記載される技術は何れも、COBOLプログラムからデータベースにREAD命令が出されると、そのREAD命令をSQL文に変換してデータベースに発行し、該当するテーブルの1レコードを取得してCOBOLプログラムに返却する。
In any of the technologies described in
しかしながら、COBOLプログラムからREAD命令が出される毎にREAD命令からSQL文への変換およびデータベースへの発行を行うと、COBOLプログラムがREAD命令を出してから結果を受け取るまでの時間が長くなり、性能が低下する。 However, every time a READ instruction is issued from a COBOL program, conversion from a READ instruction to an SQL statement and issuance to the database increases the time from when the COBOL program issues a READ instruction until the result is received, resulting in improved performance. descend.
本発明の目的は、上述した課題、すなわち、COBOLプログラムからREAD命令が出される毎にSQL文に変換してデータベースをアクセスすると性能が低下する、という課題を解決する計算機システムを提供することにある。 An object of the present invention is to provide a computer system that solves the above-described problem, that is, the performance is deteriorated when a database is accessed by converting to a SQL statement every time a READ instruction is issued from a COBOL program. .
本発明の一形態にかかる計算機システムは、
リレーショナルデータベースのテーブルに対して出されたREAD命令を、上記テーブルを参照するSQL文による命令に変換して上記リレーショナルデータベースに発行する第1の制御手段と、
上記テーブルを一時的に記憶するキャッシュ記憶手段を有し、COBOLプログラムから上記リレーショナルデータベースの上記テーブルに対してREAD命令が出されたとき、上記テーブルに対する1回目のREAD命令であれば、上記第1の制御手段を通じて上記テーブルを取得して上記キャッシュ記憶手段に記憶すると共に上記テーブルの1つ目のレコードを上記COBOLプログラムに返却し、2回目以降のREAD命令であれば、上記キャッシュ記憶手段から上記テーブルの2つ目以降のレコードを読み出して上記COBOLプログラムに返却する第2の制御手段と
を有する、といった構成を採る。
A computer system according to an aspect of the present invention is:
A first control means for converting a READ instruction issued to a relational database table into an instruction by an SQL statement that refers to the table and issuing the instruction to the relational database;
The cache storage means for temporarily storing the table, and when a READ instruction is issued from the COBOL program to the table of the relational database, if the first READ instruction for the table is used, the first The above table is acquired through the control means and stored in the cache storage means, and the first record of the table is returned to the COBOL program. The second control means for reading the second and subsequent records in the table and returning them to the COBOL program is adopted.
本発明は上述したような構成を有するため、2つ目以降のREAD命令より、COBOLプログラムがREAD命令を出してから結果を受け取るまでの時間を短縮でき、性能が向上する。 Since the present invention has the above-described configuration, the time from when the COBOL program issues a READ instruction until the result is received can be shortened from the second and subsequent READ instructions, and the performance is improved.
次に本発明の実施の形態について図面を参照して詳細に説明する。
[第1の実施形態]
図1を参照すると、本発明の第1の実施形態にかかる計算機システムは、相互に通信可能は第1の計算機100と第2の計算機200とから構成される。
Next, embodiments of the present invention will be described in detail with reference to the drawings.
[First embodiment]
Referring to FIG. 1, the computer system according to the first embodiment of the present invention includes a
第1の計算機100は、リレーショナルデータベース(RDB)110と第1の制御手段120とを有する。また、第2の計算機200は、第2の制御手段220を有し、COBOLプログラム210が動作する。
The
第1の制御手段120は、第2の制御手段220からリレーショナルデータベース110のテーブルに対して出されたREAD命令を、そのテーブルを参照するSQL文による命令に変換してリレーショナルデータベース110に発行し、取得したテーブルを第2の制御手段220に返却する機能を有する。また、第1の制御手段120は、リレーショナルデータベース110のテーブルに対して出されたWRITE命令を、そのテーブルを更新するSQL文による命令に変換してリレーショナルデータベース110に発行する機能を有していてもよい。
The
第2の制御手段220は、リレーショナルデータベース110から取得したテーブルを一時的に記憶するキャッシュ記憶手段230を有する。また、第2の制御手段220は、COBOLプログラム210からリレーショナルデータベース110のテーブルに対してREAD命令が出されたとき、そのテーブルに対する1回目のREAD命令であれば、第1の制御手段120を通じて上記テーブルを取得してキャッシュ記憶手段230に記憶すると共に、そのテーブルの1つ目のレコードをCOBOLプログラム210に返却する機能を有する。また、2回目以降のREAD命令であれば、キャッシュ記憶手段230に記憶されている上記テーブルの2つ目以降のレコードを読み出し、COBOLプログラムに返却する機能を有する。ここで、何回目のREAD命令であるかは、例えば、COBOLプログラム210の動作開始後あるいはテーブルのオープン後、何回目のREAD命令であるかによってカウントする。また、第2の制御手段220は、COBOLプログラム210からリレーショナルデータベース110のテーブルに対してWRITE命令が出されたとき、そのWRITE命令を第1の制御手段120に送信して処理させるようにしてもよい。
The
次に本実施形態の動作を説明する。 Next, the operation of this embodiment will be described.
第2の計算機200でCOBOLプログラム210が動作を開始し、リレーショナルデータベース110に対して最初のREAD命令を出力すると、第2の制御手段220は、そのREAD命令を第1の計算機100の第1の制御手段120へ送信する。
When the COBOL
第1の制御手段120は、受信したREAD命令を、リード対象となるテーブルを参照するSQL文による命令に変換してリレーショナルデータベース110に発行する。そして、取得したテーブルを第2の計算機200の第2の制御手段220に返却する。
The first control means 120 converts the received READ command into an SQL statement command that references a table to be read and issues it to the
第2の制御手段220は、受信したテーブルをキャッシュ記憶手段230に記憶すると共に、そのテーブルの1つ目のレコードをCOBOLプログラム210に返却する。
The second control means 220 stores the received table in the cache storage means 230 and returns the first record of the table to the COBOL
続いてCOBOLプログラム210が、同じテーブルに対して2回目のREAD命令を出すと、第2の制御手段220は、キャッシュ記憶手段230に記憶されているテーブルの2つ目のレコードを読み出し、COBOLプログラム210に返却する。COBOLプログラム210が、同じテーブルに対して3回目以降のREAD命令を出した場合も同様に、第2の制御手段220は、キャッシュ記憶手段230に記憶されているテーブルの3つ目以降のレコードを読み出し、COBOLプログラム210に返却する。
Subsequently, when the COBOL
このように本実施形態によれば、2つ目以降のREAD命令より、SQL文への変換およびリレーショナルデータベース110へのSQL文の発行の処理を省くことができ、COBOLプログラム210がREAD命令を出してから結果を受け取るまでの時間を大幅に短縮することができる。また、第1および第2の計算機間の通信の頻度を少なくすることができる。
As described above, according to this embodiment, it is possible to omit the conversion to the SQL statement and the issue of the SQL statement to the
[第2の実施形態]
上記の第1の実施形態では、COBOLプログラムが参照しているリレーショナルデータベースは、そのCOBOLプログラムや他のプログラムから更新されないような動作環境を想定した。これに対して、本実施形態は、参照中のテーブルが同じCOBOLプログラムや他のプログラムから更新される動作環境を前提とする。
[Second Embodiment]
In the first embodiment, the relational database referred to by the COBOL program is assumed to be an operating environment in which the COBOL program and other programs are not updated. On the other hand, this embodiment is based on an operating environment in which the table being referenced is updated from the same COBOL program or another program.
図2を参照すると、本発明の第2の実施形態にかかる計算機システムは、相互に通信可能は第1の計算機300と第2の計算機400とから構成される。
Referring to FIG. 2, the computer system according to the second embodiment of the present invention includes a
第1の計算機300は、リレーショナルデータベース310と第1の制御手段320とを有する。また、第2の計算機400は、第2の制御手段420を有し、COBOLプログラム410が動作する。
The
第1の制御手段320は、第2の制御手段420からリレーショナルデータベース310のテーブルに対して出されたREAD命令を、そのテーブルを参照するSQL文による命令に変換してリレーショナルデータベース310に発行し、取得したテーブルを第2の制御手段420に返却する機能を有する。また、第1の制御手段320は、リレーショナルデータベース310のテーブルに対して出されたWRITE命令を、そのテーブルを更新するSQL文による命令に変換してリレーショナルデータベース310に発行する機能を有していてもよい。
The first control means 320 converts the READ instruction issued to the table of the
さらに第1の制御手段320は、第2の制御手段420に返却したテーブルを記憶する返却データ記憶手段330を有する。また第1の制御手段320は、返却データ記憶手段330に記憶されているテーブルのオリジナルがリレーショナルデータベース310上で更新されたときに、返却データ記憶手段330に記憶されているテーブルを更新すると共に、第2の計算機400の第2の制御手段420に更新通知を送信する機能を有する。ここで、「更新されたとき」は、COMMITにより更新が確定したときであってもよいし、COMMIT前の更新時であってもよい。
Further, the first control means 320 has return data storage means 330 for storing the table returned to the second control means 420. The first control means 320 updates the table stored in the return data storage means 330 when the original of the table stored in the return data storage means 330 is updated on the
また第1の制御手段320は、第2の制御手段420から更新後のデータが要求された際に、返却データ記憶手段330に記憶されているテーブルから更新後のデータを読み出して返却する機能を有する。第1の制御手段320は、レコード単位で更新の有無を管理し、第2の制御手段420から更新後のデータが要求されたときに、更新されたレコードだけを更新後のデータとして返却する。あるいは、第1の制御手段320は、テーブル単位で更新の有無を管理し、第2の制御手段420から更新後のデータが要求されたときは、更新されたテーブルを更新後のデータとして返却してもよい。
The
第2の制御手段420は、リレーショナルデータベース310から取得したテーブルを一時的に記憶するキャッシュ記憶手段430を有する。また、第2の制御手段420は、COBOLプログラム410からリレーショナルデータベース310のテーブルに対してREAD命令が出されたとき、そのテーブルに対する1回目のREAD命令であれば、第1の制御手段320を通じて上記テーブルを取得してキャッシュ記憶手段430に記憶すると共に、そのテーブルの1つ目のレコードをCOBOLプログラム410に返却する機能を有する。また、2回目以降のREAD命令であれば、キャッシュ記憶手段430に記憶されている上記テーブルの2つ目以降のレコードを読み出し、COBOLプログラム410に返却する機能を有する。また、第2の制御手段420は、COBOLプログラム410からリレーショナルデータベース310のテーブルに対してWRITE命令が出されたとき、そのWRITE命令を第1の制御手段320に送信して処理させるようにしてもよい。
The
さらに第2の制御手段420は、キャッシュ記憶手段430に記憶されているテーブルのうち第1の制御手段320から更新通知のあったテーブルを更新中状態として管理し、更新中状態のテーブルに対してCOBOLプログラム410からREAD命令が出されたときは、第1の制御手段320に対して要求を出して取得した更新後のデータをキャッシュ記憶手段430のテーブルに反映した後に読み出しを行う機能を有する。
Further, the
次に本実施形態の動作を説明する。 Next, the operation of this embodiment will be described.
第2の計算機400でCOBOLプログラム410が動作を開始し、リレーショナルデータベース310に対して最初のREAD命令を出力すると、第2の制御手段420は、そのREAD命令を第1の計算機300の第1の制御手段320へ送信する。
When the
第1の制御手段320は、受信したREAD命令を、リード対象となるテーブルを参照するSQL文による命令に変換してリレーショナルデータベース310に発行する。そして、取得したテーブルを返却データ記憶手段330に記憶すると共に、第2の計算機400の第2の制御手段420に返却する。
The first control means 320 converts the received READ command into an SQL statement command that references a table to be read and issues it to the
第2の制御手段420は、受信したテーブルをキャッシュ記憶手段430に記憶すると共に、そのテーブルの1つ目のレコードをCOBOLプログラム410に返却する。
The
続いてCOBOLプログラム410が、同じテーブルに対して2回目のREAD命令を出すと、第2の制御手段420は、キャッシュ記憶手段430に記憶されているテーブルの2つ目のレコードを読み出し、COBOLプログラム410に返却する。
Subsequently, when the
次に、COBOLプログラム410がREADしている上記テーブルのオリジナルがリレーショナルデータベース310上で更新されたとする。このとき、第1の制御手段320は、返却データ記憶手段330に記憶されているテーブルを更新すると共に、第2の制御手段420に更新通知を送信する。第2の制御手段420は、この更新通知を受信すると、キャッシュ記憶手段430に記憶されているテーブルのうち更新通知のあったテーブルを更新中状態として管理する。更新中状態か否かは、例えばテーブルに対応するフラグを設け、フラグを点灯する等の任意の方法でよい。
Next, it is assumed that the original of the table read by the
続いてCOBOLプログラム410が上記テーブルに対して3回目のREAD命令を出すと、第2の制御手段420は、上記テーブルが更新中状態として管理されているので、当該READ命令の処理を一時保留する。そして、第2の制御手段420は、第1の制御手段320に対して、上記テーブルを特定する情報を添えて更新後データを要求する。
Subsequently, when the
第1の制御手段320は、上記の要求を受信すると、返却データ記憶手段330から更新後のデータを読み出し、第2の制御手段420へ返却する。 When receiving the above request, the first control means 320 reads the updated data from the return data storage means 330 and returns it to the second control means 420.
第2の制御手段420は、第1の制御手段320から更新後データを受信すると、受信した更新後のデータをキャッシュ記憶手段430の上記テーブルに反映する。また、更新中状態を解除する。そして、上記保留したREAD命令の処理を再開し、上記テーブルの3つ目のレコードを読み出してCOBOLプログラム410へ返却する。
When receiving the updated data from the first control means 320, the second control means 420 reflects the received updated data in the table of the cache storage means 430. Also, the updating state is released. Then, the processing of the held READ instruction is resumed, and the third record in the table is read and returned to the
このように本実施形態によれば、2つ目以降のREAD命令より、SQL文への変換およびリレーショナルデータベース310へのSQL文の発行の処理を省くことができ、COBOLプログラム410がREAD命令を出してから結果を受け取るまでの時間を大幅に短縮することができる。また、第1および第2の計算機間の通信の頻度を少なくすることができる。
As described above, according to the present embodiment, it is possible to omit the conversion to the SQL statement and the issue of the SQL statement to the
さらに、READしているテーブルが更新された際には、更新前のテーブルでなく更新後のテーブルをREAD対象とすることができる。 Further, when the table being read is updated, the updated table can be set as the READ target instead of the table before the update.
なお、以上の第1および第2の実施形態は、COBOLプログラムが動作する計算機とリレーショナルデータベースが存在する計算機とが異なる計算機システムに本発明を適用した。しかし、本発明は、同じ計算機上にCOBOLプログラムとリレーショナルデータベースが存在する場合にも適用可能である。 In the first and second embodiments described above, the present invention is applied to a computer system in which a computer in which a COBOL program operates and a computer in which a relational database exists are different. However, the present invention is also applicable when a COBOL program and a relational database exist on the same computer.
[第3の実施形態]
[概要]
本実施形態は、メインフレーム上で動作するCOBOLプログラムにおいて、既存のアクセス方法であるREAD/WRITE命令を使って、オープンサーバ上のデータベースに対して効率的にアクセスする方法を提供する。また本実施形態は、データベースのテーブルに更新があったとき、更新レコードの更新項目について、更新前と更新後の内容を管理し、メインフレーム側が必要とする値のみ転送することで、転送回数と転送量を抑え、処理を効率化する。また本実施形態は、上記のシステムにおいて、メインフレーム上のCOBOLプログラムのREAD/WRITE命令とオープンサーバ上で作成されるSQL文の対応関係をR/W・SQL管理テーブルに記憶しておき、同じREAD、WRITE命令が実行された場合は再変換せずSQLを再利用することを可能にする。
[Third embodiment]
[Overview]
The present embodiment provides a method for efficiently accessing a database on an open server using a READ / WRITE instruction, which is an existing access method, in a COBOL program operating on a mainframe. Also, in this embodiment, when the database table is updated, the update items of the update record are managed before and after the update, and only the values required by the mainframe are transferred, so that the number of transfers Reduce the amount of transfer and improve processing efficiency. In this embodiment, in the above system, the correspondence between the READ / WRITE instruction of the COBOL program on the mainframe and the SQL statement created on the open server is stored in the R / W / SQL management table. When READ and WRITE commands are executed, SQL can be reused without re-conversion.
[構成]
図3は本実施形態の構成を示している。メインフレーム1は、COBOL言語で作成したプログラム11、12を動作させることができ、COBOLプログラム11、12は共有データベース(DB)27へのアクセスをREAD/WRITE命令で行う。
[Constitution]
FIG. 3 shows the configuration of this embodiment. The
メインフレーム1には、データアクセス位置管理手段13、結果データ管理手段14、COBOLプログラム1の結果データ15、COBOLプログラム2の結果データ16が含まれている。
The
結果データは、COBOLプログラムがオープンサーバ上のデータベースにアクセスを行った結果のデータを格納し、COBOLプログラム別にプログラム実行開始時に作成され、プログラムの実行終了時に消滅する。結果データは、第1および第2の実施形態におけるキャッシュ記憶手段に相当する。 The result data stores the data of the result of the COBOL program accessing the database on the open server, created for each COBOL program at the start of program execution, and disappears at the end of program execution. The result data corresponds to the cache storage means in the first and second embodiments.
データアクセス位置管理手段13は、COBOLプログラムが読み込み中のレコードの現在位置を管理し、読み込みの中断や再読み込みが発生した時、適切な位置から処理を再開することができる。 The data access position management means 13 manages the current position of the record being read by the COBOL program, and can resume processing from an appropriate position when reading is interrupted or reread.
結果データ管理手段14は、各COBOLプログラムの結果データを管理し、該当するデータの格納や取り出しを行う。また、オープンサーバから更新通知を受信したときは、対象となる結果データを更新中状態とし、次のREAD要求で古いデータを読み込まないように動作を中断させる。次のREAD要求があったときには、オープンサーバ2の返却データ管理手段28に更新データの転送を要求し、データの転送完了後(反映完了後)に、読込を再開させる。
The result data management means 14 manages the result data of each COBOL program, and stores and retrieves the corresponding data. When the update notification is received from the open server, the target result data is set to the updating state, and the operation is interrupted so that the old data is not read by the next READ request. When there is a next READ request, the return data management means 28 of the
メインフレーム1は、オープンサーバ上のR/W・SQL管理手段21に含まれるRW-SQL変換手段22と返却データ管理手段28に含まれる結果データ転送手段30と、更新管理手段31に含まれる更新通知手段34と通信が可能となっている。
COBOLプログラムが動作するメインフレーム1と、READ/WRITE命令とSQLの変換を行うR/W-SQL管理手段21は、全て同一マシン上でも、別マシン上でも、または一部が別マシン上であってもよい。
The
オープンサーバ2のR/W-SQL管理手段21は、R/W-SQL変換手段22、R/W-SQL変換保存手段23、SQL発行手段24、結果保存手段25、R/W命令SQL管理テーブル26から構成される。
The R / W-SQL management means 21 of the
R/W-SQL変換手段22は、メインフレーム1のCOBOLプログラムからのREAD、WRITE命令を受信し、SQL文に変換する手段である。変換前のR/W命令とSQL文の対応は、R/W-SQL変換保存手段23によってR/W命令SQL管理テーブル26に記憶する。2回目以降の要求の場合、R/W-SQL変換手段22は、R/W命令SQL管理テーブル26に記憶されている変換結果を取得する。
The R / W-SQL conversion means 22 is means for receiving READ and WRITE instructions from the COBOL program of the
SQL発行手段24は、R/W-SQL変換手段22で変換した結果のSQL文を共有DB27に対して発行し、結果を受け取る。共有DB27はメインフレーム1以外からのアクセも受け付ける、オープンサーバ上で動作するリレーショナルデータベースである。
The SQL issuing means 24 issues the SQL statement resulting from the conversion by the R / W-SQL conversion means 22 to the shared
結果保存手段25は、共有DB27にSQLアクセスした結果をSQL発行手段24から受け取り、結果データ29に保存する。結果保存手段25は、READ命令の結果のみ結果データに保存する。
The result storage means 25 receives the result of SQL access to the shared
返却データ管理手段28は、結果データ29、結果データ転送手段30から構成される。
The return data management means 28 includes
結果データ29は、R/W・SQL管理手段21の結果保存手段25によって、共有DB27のアクセス結果が保存される。結果データ29は、図5に示される管理テーブルでレコード単位に状態管理を行う。結果データ29における、管理テーブル内の状態管理フラグの種類と意味を図4に示す。
In the
図5に示されるように、レコードには主キーとしてレコードの登録順に値が振られている。また、結果データの状態を管理するフラグは、メインフレーム1の結果データと返却データ管理手段28の結果データ29を比較したときのデータの状態を表している。図4に示されるように、管理フラグは、ACTIVE/INACTIVE状態のどちらかになる。ACTIVEの場合、メインフレームの結果データは返却データ管理手段28で管理している結果データ29と同じ内容であり、最新の状態となっている。INACTIVEの場合、メインフレームの結果データと返却データ管理手段の結果データは異なり、メインフレームの結果データは、更新結果転送前の状態のデータになっている。INACTIVEは、どの手段でデータが更新されたかを表すUPDATE/INSERT/DELETEの3種類に分けられる。返却データ管理手段28の結果データはレコード単位に状態管理フラグで管理する。結果データ転送手段30は、メインフレーム1の結果データ管理手段14に対して、結果データ29に保存されたデータのうち、更新状態のレコードのみ転送する。
As shown in FIG. 5, values are assigned to records in the order of record registration as primary keys. The flag for managing the state of the result data represents the state of the data when the result data of the
更新管理手段31は、更新結果記憶手段32、更新確定手段33、更新通知手段34から構成される。
The
更新結果記憶手段32は、共有DB27のテーブルの行が更新された場合(すなわち、DBから行の更新が通知された場合)、共有DB27から更新されたレコードの主キーと更新後の値を受け取り、更新レコードの情報を自手段32内の更新結果一時記憶領域に一時的に記憶しておく。更新されたテーブルが、メインフレームのCOBOLプログラムが使用していないテーブルの場合、何も記憶しない。COBOLプログラムから使用しているテーブルの場合は、更新が完了するまで、レコード内容を更新する。更新が連続で起こる場合は、全ての更新処理が完了するまで値を上書きする。
The update result storage means 32 receives the primary key of the record updated from the shared
更新確定手段33は、全ての更新完了時(すなわち、DBからCOMMITが通知された場合)、図9に示すように、上記更新結果一時記憶領域に一時的に記憶している更新内容を結果データ29に反映する。このとき、更新結果記憶手段32の主キーから、結果データ29の更新前の値と比較し、既にあるレコードの場合はUPDATE、追加されたレコードの場合はINSERT、削除されたレコードの場合はDELETEの状態管理フラグを設定する。なお、更新が破棄された場合(すなわち、DBからROLLBACKが通知された場合)は、更新結果一時記憶領域を消去し、結果データ29の更新は行わない。
The update confirmation means 33, when all the updates are completed (that is, when COMMIT is notified from the DB), as shown in FIG. 9, the update contents temporarily stored in the update result temporary storage area as result data Reflect in 29. At this time, from the primary key of the update result storage means 32, it compares with the value before update of the
更新通知手段34は、共有DBからの更新を受信した後、その更新レコードが結果データ29に該当するレコードの場合は、メインフレーム1の結果データ管理手段14に更新通知を送信する。更新通知は、結果データ単位で送信され、結果データ管理手段14は対象となる結果データ15、16に対してデータ更新状態フラグをセットする。
After receiving the update from the shared DB, the
<結果データ29の保存項目>
オープンサーバ上の結果データ29に保存する項目として、結果保存手段25から受信するSQL発行結果であるレコードデータ、結果データ状態管理フラグがある。これらは図5に示すように、主キーによってデータベースのレコードと対応づけられている。
<Items to save
Items to be stored in the
<更新結果記憶手段32の保存項目>
更新結果記憶手段32に保存する項目として、テーブル名、主キー、レコード情報(列名、値)がある。これらの項目から、更新すべき結果データ29のレコードを特定する。
<Items stored in the update result storage means 32>
Items stored in the update result storage means 32 include a table name, primary key, and record information (column name, value). From these items, the record of the
<COBOLプログラム11、12の結果データの保存項目>
COBOLプログラム11、12単位に結果データ15、16が作成され、各結果データに含まれる項目は、オープンサーバ2上でのSQLアクセスの結果であるレコード、データ更新状態フラグとなる。データ更新状態フラグは、オープンサーバで管理しているレコード単位のフラグとは異なり、テーブル単位で管理する。データ更新状態フラグは、オープンサーバ上の共有DB27で更新が発生した場合、即座に更新通知手段34から通知され、更新状態となる。COBOLプログラムから更新状態の結果データに読み込みが発生した場合は、新しい結果データをオープンサーバ上の結果データ29から取得する。読み込み中に更新状態になった場合は、読み込みを一時中断し、更新処理が完了した後、更新後の結果データを結果データ転送手段30から転送する。
<Items to save result data of
[動作]
メインフレーム1が、オープンサーバ上のデータベースにREADアクセスを行う場合の動作を図6に示す。
[Operation]
FIG. 6 shows the operation when the
メインフレーム1上のCOBOLプログラム11から1回目のREAD命令が発行されたとき、データアクセス位置管理手段13はオープンサーバ2上のR/W-SQL変換手段22にREAD要求を出す。
When the first READ instruction is issued from the
R/W-SQL変換手段22は、受け取ったREAD命令と同じデータ(テーブル)が取得できるSQL文を生成する。以前に同じREAD命令を実行している場合、変換は実行せず、R/W命令SQL管理テーブル26からREAD命令に該当するSQL文を取得する。新規に変換を行った場合は、R/W-SQL変換保存手段23がR/W命令SQL管理テーブルに変換内容としてREAD命令とSQL文の組み合わせを保存する。SQL発行手段24は、READ命令の変換結果であるSQL文を、共有DB27に発行し、結果を受け取る。受け取った結果は、結果保存手段25によって、結果データ29に保存される。結果データ29に格納されたデータは、結果データ転送手段30によってメインフレーム1の結果データ管理手段14に転送される。
The R / W-SQL conversion means 22 generates an SQL statement that can acquire the same data (table) as the received READ instruction. If the same READ instruction has been executed before, the conversion is not executed, and the SQL statement corresponding to the READ instruction is acquired from the R / W instruction SQL management table 26. When a new conversion is performed, the R / W-SQL
結果データ管理手段14は、該当するCOBOLプログラムの結果データ15にデータを格納し、COBOLプログラムに先頭レコードを返却する。READ命令で次のレコードを読み込むときは、COBOLプログラム11は、自分の結果データ15に対してREAD命令を発行し、データを読み込む。データアクセス位置管理手段13は、読み込み位置を判断し、前回読み込んだ次のレコードから読み込めるよう管理する。
The result data management means 14 stores the data in the
メインフレーム1が、オープンサーバ上のデータベースにWRITEアクセスを行う場合の動作を図7に示す。
FIG. 7 shows the operation when the
COBOLプログラム11からWRITE命令があったとき、WRITE命令はデータアクセス位置管理手段13を経由し、オープンサーバ2のR/W-SQL変換手段22で、SQL文に変換される。初回の変換時には、R/W-SQL変換保存手段23によって変換後のSQL文とWRITE命令の対応が保存される。SQL発行手段24は、共有DB27に対して、SQLを発行し、更新結果をメインフレームに返却する。
When there is a WRITE instruction from the
メインフレーム1のCOBOLプログラムの結果データ15に存在するデータに対応する、共有DBのレコードが更新された場合の動作を図8、図9、図10に示す。
The operation when the shared DB record corresponding to the data existing in the
図8は、共有DBが更新された後の動作についての説明図である。既にCOBOLプログラムがREAD命令で共有DBにアクセスしたことがあり、結果データ管理手段14の結果データにREAD命令のデータが保存されている状態であるとする。この状態で、共有DBに対して更新が行われた場合(前記のCOBOLプログラム11からのWRITE要求により共有DBが更新された場合も含む)、更新管理手段31は更新されたレコードの属するテーブルや主キー、新旧値の情報を受信し、そのレコードが結果データ管理手段の結果データに含まれているテーブルとレコードかどうかを判断する。
FIG. 8 is an explanatory diagram of the operation after the shared DB is updated. Assume that the COBOL program has already accessed the shared DB with the READ instruction, and the READ instruction data is stored in the result data of the result data management means 14. In this state, when the shared DB is updated (including the case where the shared DB is updated by the WRITE request from the COBOL program 11), the
含まれている場合、更新結果記憶手段32が、行の更新を契機として、共有DBから受け取った更新されたレコード情報を更新結果一時記憶領域に保存する。次に、DBから更新確定が通知されると、更新確定手段33が、更新結果一時記憶領域の中の新旧レコードの値を参照し、結果データ29を更新後の値で更新する。更新対象のレコードの判別は、レコードの生成順に設定された主キーで行い、該当する結果データのレコードの値の更新やレコードの追加、削除を行い、各レコードの更新状態フラグに対して、UPDATE、INSERT、DELETEのどれによって更新されたかを設定する。どのフラグを設定するかは、新旧の値を比較した結果で決定する。新旧両方の値が存在する場合はUPDATE、新しい値だけ存在する場合はINSERT、新しい値が存在しない場合はDELETEを設定する。続いて、結果データ29の更新後、更新通知手段34はメインフレームに更新通知を行い、該当するCOBOLプログラムの結果データに対して、結果データの内容が最新状態ではないことを通知する。
If it is included, the update
メインフレームは通知を受け取った後、対象となるメインフレームの結果データのデータ更新状態フラグを設定する。このフラグが設定されているときは、プログラムはデータの読み込みを一時中断する。 After receiving the notification, the main frame sets a data update state flag of the result data of the target main frame. When this flag is set, the program temporarily stops reading data.
更新レコードの確定方法と転送の動作を図9を参照して説明する。 An update record determination method and transfer operation will be described with reference to FIG.
更新結果としてオープンサーバの結果データ29に反映されたレコードは、メインフレームで次のREADが実行されたとき、メインフレームの結果データ管理手段14からの要求によりメインフレームに送信される。このとき、状態管理フラグの種類によって、メインフレーム側結果データの反映方法が異なる。UPDATEフラグのレコードの場合、既存レコードに値を上書きする。INSERTフラグのレコードの場合、新規レコードとして後ろに追加する。DELETEフラグのレコードの場合、既存レコードを削除する。この反映方法により、メインフレームのデータベースに対するREAD命令でのアクセス方法と同様の結果が得られる。
The record reflected in the
更新開始から終了までの流れを図10、図11のフローチャートに示す。図10は、共有DBから更新されたレコードを受け取り、更新結果記憶手段の一時記憶領域に保存するまでの流れである。図11は、一時記憶領域に記憶されたレコードの、結果データへの反映処理の流れである。 The flow from the start to the end of the update is shown in the flowcharts of FIGS. FIG. 10 is a flow from receiving the updated record from the shared DB to storing it in the temporary storage area of the update result storage means. FIG. 11 is a flow of a process for reflecting the record stored in the temporary storage area to the result data.
[効果]
本実施形態によれば、必要なデータのみメインフレームに転送することができるため、データの転送量や転送回数を削減することができ、効率的なデータ転送を行うことができる。また、SQLアクセスを最小限にすることで、冗長なデータベースアクセスを防ぐことができ、データベースに対する負担を軽減する効果がある。
[effect]
According to the present embodiment, since only necessary data can be transferred to the mainframe, the amount of data transfer and the number of transfers can be reduced, and efficient data transfer can be performed. In addition, by minimizing SQL access, redundant database access can be prevented, and the burden on the database can be reduced.
[第4の実施形態]
本実施形態では、更新をレコード単位で管理せず、再度SQL文を発行してデータを更新する。図12は本実施形態のブロック図である。
[Fourth embodiment]
In this embodiment, the update is not managed in units of records, but the SQL statement is issued again to update the data. FIG. 12 is a block diagram of the present embodiment.
データベースの更新時に、レコード単位ではなく、テーブル単位で更新を検出し、再度SQLを発行しデータベースからデータを取得する。共有DB27は、テーブル単位で更新を検出し、結果データ更新手段35に更新されたテーブルを通知する。結果データ更新手段35は、更新されたテーブルが、結果データ29に格納されているかどうかを調べ、格納されている場合はSQL発行手段24にSQL文の再発行要求を出す。SQL発行手段24は、共有DB27にアクセスし、受信したデータを結果データ29に格納する。結果データ転送手段30は、結果データ管理手段14から更新後データが要求されると、更新されたテーブルを返却する。
When updating the database, update is detected in table units, not in record units, and SQL is issued again to acquire data from the database. The shared
本実施形態によれば、レコード単位で更新内容を管理する必要がなく、結果の反映が簡略化できる。 According to this embodiment, it is not necessary to manage the update contents in units of records, and the reflection of the results can be simplified.
以上本発明の実施の形態について説明したが、本発明は以上の実施の形態にのみ限定されず、その他各種の付加変更が可能である。また、本発明は、その有する機能をハードウェア的に実現することは勿論、コンピュータとプログラムとで実現することができる。プログラムは、磁気ディスクや半導体メモリ等のコンピュータ可読記録媒体に記録されて提供され、コンピュータの立ち上げ時などにコンピュータに読み取られ、そのコンピュータの動作を制御することにより、そのコンピュータを前述した各実施の形態における第1および第2の制御手段として機能させる。 Although the embodiment of the present invention has been described above, the present invention is not limited to the above embodiment, and various other additions and modifications can be made. In addition, the present invention can be realized by a computer and a program as well as by realizing the functions of the hardware. The program is provided by being recorded on a computer-readable recording medium such as a magnetic disk or a semiconductor memory, and is read by the computer at the time of starting up the computer, etc. It functions as the first and second control means in the embodiment.
本発明は、リレーショナルデータベース等のデータベースにアクセスするCOBOLプログラムが稼働する計算機に利用できる。 The present invention can be used for a computer that runs a COBOL program that accesses a database such as a relational database.
100、300…第1の計算機
110、310…リレーショナルデータベース
120、320…第1の制御手段
200、400…第2の計算機
210、410…COBOLプログラム
220、420…第2の制御手段
230、430…キャッシュ記憶手段
330…返却データ記憶手段
100, 300 ... 1st calculator
110, 310 ... Relational database
120, 320 ... first control means
200, 400 ... second calculator
210, 410 ... COBOL program
220, 420 ... second control means
230, 430 ... Cache storage means
330 ... Return data storage means
Claims (7)
前記テーブルを一時的に記憶するキャッシュ記憶手段を有し、COBOLプログラムから前記リレーショナルデータベースの前記テーブルに対してREAD命令が出されたとき、前記テーブルに対する1回目のREAD命令であれば、前記第1の制御手段を通じて前記テーブルを取得して前記キャッシュ記憶手段に記憶すると共に前記テーブルの1つ目のレコードを前記COBOLプログラムに返却し、2回目以降のREAD命令であれば、前記キャッシュ記憶手段から前記テーブルの2つ目以降のレコードを読み出して前記COBOLプログラムに返却する第2の制御手段と
を有する計算機システム。 A first control means for converting a READ instruction issued to a table of the relational database into an instruction by an SQL statement referring to the table and issuing the instruction to the relational database;
The cache storage means for temporarily storing the table, and when a READ instruction is issued from the COBOL program to the table of the relational database, if the first READ instruction for the table, the first The table is acquired through the control means and stored in the cache storage means, and the first record of the table is returned to the COBOL program. A computer system having a second control means for reading the second and subsequent records of the table and returning them to the COBOL program.
前記第1の計算機と通信可能に接続され、前記第2の制御手段を有し、前記COBOLプログラムが動作する第2の計算機と
から構成される
ことを特徴とする請求項1に記載の計算機システム。 A first computer having the relational database and the first control means;
2. The computer system according to claim 1, wherein the computer system is configured to be connected to the first computer so as to be communicable, includes the second control unit, and includes a second computer on which the COBOL program operates. .
前記第2の制御手段は、前記キャッシュ記憶手段に記憶されている前記テーブルのうち前記更新通知のあったテーブルを更新中状態として管理し、更新中状態のテーブルに対して前記COBOLプログラムからREAD命令が出されたときは、前記第1の制御手段に対して要求を出して取得した更新後のデータを前記キャッシュ記憶手段の前記テーブルに反映した後に読み出しを行う
ことを特徴とする請求項2に記載の計算機システム。 The first control means has return data storage means for storing the table returned to the second control means, and the original of the table stored in the return data storage means is stored on the relational database. When updated, the table stored in the return data storage means is updated and an update notification is sent to the first computer, and updated data is requested from the second control means. Read and return the updated data from the table stored in the return data storage means,
The second control unit manages the table notified of the update among the tables stored in the cache storage unit as an updating state, and reads a READ instruction from the COBOL program on the table in the updating state. 3. The method according to claim 2, wherein when the data is issued, the updated data acquired by issuing a request to the first control unit is reflected in the table of the cache storage unit, and then read out. The computer system described.
ことを特徴とする請求項3に記載の計算機システム。 The first control means manages the presence or absence of update in units of records, and when updated data is requested from the second control means, only the updated record is returned as the updated data. The computer system according to claim 3.
ことを特徴とする請求項3に記載の計算機システム。 The first control means manages the presence / absence of update in units of tables, and when updated data is requested from the second control means, the updated table is returned as the updated data. The computer system according to claim 3.
前記第1の制御手段が、リレーショナルデータベースのテーブルに対して出されたREAD命令を、前記テーブルを参照するSQL文による命令に変換して前記リレーショナルデータベースに発行し、
前記第2に制御手段が、COBOLプログラムから前記リレーショナルデータベースの前記テーブルに対してREAD命令が出されたとき、前記テーブルに対する1回目のREAD命令であれば、前記第1の制御手段を通じて前記テーブルを取得して前記キャッシュ記憶手段に記憶すると共に前記テーブルの1つ目のレコードを前記COBOLプログラムに返却し、2回目以降のREAD命令であれば、前記キャッシュ記憶手段から前記テーブルの2つ目以降のレコードを読み出して前記COBOLプログラムに返却する
ことを特徴とする計算機システムの制御方法。 A control method executed by a computer system having a first control means, a cache storage means, and a second control means,
The first control means converts the READ instruction issued to the table of the relational database into an instruction by an SQL statement that refers to the table, and issues the instruction to the relational database.
The second control means, when a READ command is issued to the table of the relational database from a COBOL program, if the first READ instruction for the table, the table is stored through the first control means. Acquire and store in the cache storage means and return the first record of the table to the COBOL program, and if it is the second or later READ instruction, the cache storage means from the second or later of the table A computer system control method characterized by reading a record and returning it to the COBOL program.
前記リレーショナルデータベースのテーブルに対して出されたREAD命令を、前記テーブルを参照するSQL文による命令に変換して前記リレーショナルデータベースに発行する第1の制御手段と、
前記テーブルを一時的に記憶するキャッシュ記憶手段を有し、前記COBOLプログラムから前記リレーショナルデータベースの前記テーブルに対してREAD命令が出されたとき、前記テーブルに対する1回目のREAD命令であれば、前記第1の制御手段を通じて前記テーブルを取得して前記キャッシュ記憶手段に記憶すると共に前記テーブルの1つ目のレコードを前記COBOLプログラムに返却し、2回目以降のREAD命令であれば、前記キャッシュ記憶手段から前記テーブルの2つ目以降のレコードを読み出して前記COBOLプログラムに返却する第2の制御手段と
して機能させるためのプログラム。 A computer that has a relational database and storage means and runs COBOL programs.
First control means for converting a READ instruction issued to the table of the relational database into an instruction by an SQL statement referring to the table and issuing the instruction to the relational database;
A cache storage means for temporarily storing the table, and when a READ instruction is issued from the COBOL program to the table of the relational database, the first instruction is the first READ instruction for the table; The table is acquired through the control means 1 and stored in the cache storage means, and the first record of the table is returned to the COBOL program, and if it is a second or subsequent READ instruction, the cache storage means A program for functioning as a second control means for reading the second and subsequent records of the table and returning them to the COBOL program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011063474A JP5664389B2 (en) | 2011-03-23 | 2011-03-23 | Computer system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011063474A JP5664389B2 (en) | 2011-03-23 | 2011-03-23 | Computer system |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2012198829A true JP2012198829A (en) | 2012-10-18 |
JP5664389B2 JP5664389B2 (en) | 2015-02-04 |
Family
ID=47180959
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011063474A Expired - Fee Related JP5664389B2 (en) | 2011-03-23 | 2011-03-23 | Computer system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5664389B2 (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5640550A (en) * | 1994-04-15 | 1997-06-17 | Coker; Drake | Computer system for generating SQL statements from COBOL code |
JPH10289133A (en) * | 1997-04-11 | 1998-10-27 | Mitsubishi Electric Corp | Data base access method |
JP2004094289A (en) * | 2002-08-29 | 2004-03-25 | Toshiba Tec Corp | Heterogeneous database access method and office computer using the method |
-
2011
- 2011-03-23 JP JP2011063474A patent/JP5664389B2/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5640550A (en) * | 1994-04-15 | 1997-06-17 | Coker; Drake | Computer system for generating SQL statements from COBOL code |
JPH10289133A (en) * | 1997-04-11 | 1998-10-27 | Mitsubishi Electric Corp | Data base access method |
JP2004094289A (en) * | 2002-08-29 | 2004-03-25 | Toshiba Tec Corp | Heterogeneous database access method and office computer using the method |
Non-Patent Citations (2)
Title |
---|
CSND199800540002; 千田淳: '重要性増す性能問題の解決策' 日経コンピュータ 第338号, 19940530, 日経BP社 * |
JPN6014033250; 千田淳: '重要性増す性能問題の解決策' 日経コンピュータ 第338号, 19940530, 日経BP社 * |
Also Published As
Publication number | Publication date |
---|---|
JP5664389B2 (en) | 2015-02-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101046821B (en) | Generic database manipulator | |
JP6181290B2 (en) | Transaction ordering | |
US8589361B2 (en) | Reduced disk space standby | |
CN101364217B (en) | Data maintenance method, device and system in database | |
KR102119258B1 (en) | Technique for implementing change data capture in database management system | |
JP4282030B2 (en) | Data duplex control method and duplex storage subsystem | |
US7457921B2 (en) | Write barrier for data storage integrity | |
CN109992628B (en) | Data synchronization method, device, server and computer readable storage medium | |
US7698319B2 (en) | Database system management method, database system, database device, and backup program | |
JP2010134522A (en) | Method, program and device for management of database | |
KR20200056357A (en) | Technique for implementing change data capture in database management system | |
WO2016192496A1 (en) | Data migration processing method and device | |
CN111538463A (en) | A Method for Realizing In-Memory Database Persistence | |
EP4170509A1 (en) | Method for playing back log on data node, data node, and system | |
WO2022127866A1 (en) | Data processing method and apparatus, and electronic device and storage medium | |
CN102945251A (en) | Method for optimizing performance of disk database by memory database technology | |
CN102521028B (en) | Transactional memory system under distributed environment | |
WO2023197404A1 (en) | Object storage method and apparatus based on distributed database | |
US9002796B2 (en) | Database management method, database management system and database management program | |
US8140493B2 (en) | Changing metadata without invalidating cursors | |
CN108280123B (en) | HBase column polymerization method | |
US20110106760A1 (en) | Synchronizing database and non-database resources without a commit coordinator | |
JP5664389B2 (en) | Computer system | |
US7251660B2 (en) | Providing mappings between logical time values and real time values in a multinode system | |
CN116226128A (en) | An optimization method for cold and hot separation of OLAP engine using object storage as cold storage |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD07 | Notification of extinguishment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7427 Effective date: 20120719 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20140207 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140728 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140812 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20141002 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20141111 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20141124 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5664389 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |