JP2606608B2 - Sorting method for data with equivalence key - Google Patents

Sorting method for data with equivalence key

Info

Publication number
JP2606608B2
JP2606608B2 JP6290451A JP29045194A JP2606608B2 JP 2606608 B2 JP2606608 B2 JP 2606608B2 JP 6290451 A JP6290451 A JP 6290451A JP 29045194 A JP29045194 A JP 29045194A JP 2606608 B2 JP2606608 B2 JP 2606608B2
Authority
JP
Japan
Prior art keywords
record
match
battle
key
winner
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.)
Expired - Fee Related
Application number
JP6290451A
Other languages
Japanese (ja)
Other versions
JPH08129478A (en
Inventor
洋一 上田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP6290451A priority Critical patent/JP2606608B2/en
Publication of JPH08129478A publication Critical patent/JPH08129478A/en
Application granted granted Critical
Publication of JP2606608B2 publication Critical patent/JP2606608B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明はソート方式に関するもの
であり、特に同値キーレコードが数多く存在する場合に
好適なソート方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a sorting system, and more particularly to a sorting system suitable for a case where a large number of equivalent key records exist.

【0002】[0002]

【従来の技術】メモリに入り切らない大量のレコードを
ソートする場合、レコードを1件ずつメモリに読み込
み、読み込んだレコードを読み込み済みのレコード群と
対戦させ、対戦の優勝者を順次ワークファイルに出力し
ていって中間結果であるストリング(部分的にソート済
みのレコード列)を複数作成していくプリソートフェー
ズを実施し、次いで、ワークファイル内の複数のストリ
ングを繰り返しマージしていって1本のストリングにま
とめて出力するマージフェーズを行うというように、前
半部分のプリソートフェーズと後半部分のマージフェー
ズとに分けてソートを行うソート方式が一般的である。
2. Description of the Related Art When sorting a large number of records that cannot be stored in a memory, the records are read one by one into a memory, the read records are played against a group of read records, and the winner of the battle is sequentially output to a work file. Then, a presort phase is performed to create multiple strings (partially sorted record strings) that are intermediate results, and then multiple strings in the work file are repeatedly merged into one In general, a sort method is used in which sorting is performed separately into a pre-sorting phase of the first half and a merging phase of the second half, such as performing a merge phase of outputting in a single string.

【0003】ところで、このようなソート方式では、レ
コード件数が増加するに伴い、レコードの対戦の回数、
従ってキー比較処理を呼び出す回数が急速に増加し、中
央処理装置を長時間使用するようになり、性能の低下を
招くという問題点がある。そこで、同一のキー値(同値
キー)を持つレコードが多数存在するレコードのソート
において、キー比較の回数を減らし、中央処理装置の使
用時間を短縮して性能の向上を図るため、従来より以下
のようなソート方式が提唱されている。
[0003] By the way, in such a sorting method, as the number of records increases, the number of record competitions,
Therefore, there is a problem that the number of times the key comparison process is called increases rapidly, the central processing unit is used for a long time, and the performance is reduced. In order to improve the performance by reducing the number of key comparisons, shortening the use time of the central processing unit, and improving the performance in sorting records in which many records having the same key value (equivalent key) exist, Such a sorting method has been proposed.

【0004】(1)従来技術1 レコードのキー比較時に同値キーであった場合に、レコ
ードの単一化を行い、同値キーレコードを1つのレコー
ドにまとめるソート方式(例えば特開平2−25982
7号公報)。 (2)従来技術2 同値キーレコード数のカウンタを設け、レコードのキー
比較時に、同値キーであった場合、同値キーレコード数
カウンタの計数処理を行い、出力結果として、レコード
のキー部分と、制御情報として、計数された同値キーレ
コード数を付加するソート方式(例えば特開平1−17
1021号公報)。
(1) Prior art 1 When a record is compared, if the key is an equivalent key, the record is unified and the equivalent key record is sorted into one record (for example, JP-A-2-25982).
No. 7). (2) Prior art 2 A counter for the number of equivalent key records is provided, and when the keys of the records are compared, if the keys are the same, the counting process of the equivalent key record number counter is performed. A sorting method for adding the counted number of equivalent key records as information (for example,
No. 1021).

【0005】[0005]

【発明が解決しようとする課題】上述したように従来の
ソート方式においては、同値キーレコードが多く存在す
るソート処理の高速化のアプローチとして、キー比較処
理のなかで同値キーレコードを削除して、その後の対戦
では同値キーレコードの対戦を少なくすることにより、
キー比較回数を減らしていく技術が採用されている。
As described above, in the conventional sorting method, as an approach for speeding up the sort processing in which many equivalent key records exist, the equivalent key record is deleted in the key comparison processing. In subsequent matches, by reducing the matches of the equivalent key record,
A technology that reduces the number of key comparisons is used.

【0006】しかしながら、ソート結果として同値キー
レコードを削除せずにそのまま出力するような場合は、
上述した従来技術では、単一化した元のレコードまたは
計数された同値キーレコード数分だけレコードを複写す
る処理、キー情報からもとのレコードの形式に復元する
処理等を組み合わせて実行する必要がある。この結果、
キーの比較回数は少なくて済むが、特に同値キーレコー
ドが多数存在する場合には、レコードを複写する処理や
レコードからキー情報を抽出する処理やキー情報からレ
コードを復元する処理等の占める割合が多くなり、却っ
てソート性能の劣化を招くことになる。
However, in the case where the equivalent key record is output as it is without deleting it as a sort result,
In the above-described related art, it is necessary to execute a combination of a process of copying records by the number of unified original records or counted equivalent key records, a process of restoring the original record format from key information, and the like. is there. As a result,
Although the number of key comparisons is small, especially when there are a large number of equivalent key records, the proportion of processes such as copying records, extracting key information from records, and restoring records from key information, etc. This increases the sort performance.

【0007】勿論、同値キーレコードを削除しない通常
のソート処理を行えばそのような問題はないが、前述し
たようにレコード件数が増加するに伴い、キー比較回数
が急激に増加して、中央処理装置を長時間使うようにな
り、性能低下が問題となる。
Of course, such a problem does not occur if ordinary sort processing is performed without deleting the equivalent key record. However, as described above, as the number of records increases, the number of key comparisons sharply increases, and the central processing is performed. The device will be used for a long time, and performance degradation will be a problem.

【0008】本発明は、上記問題点に鑑み、ソート処理
の過程における同値キーレコード同士の対戦を極力抑え
得るようにすることにより、同値キーレコードを削除し
なくてもキー比較回数を削減できるようにし、同値キー
レコードが数多く存在するレコードを高速にソートする
ことができるようにすることを目的とする。
SUMMARY OF THE INVENTION In view of the above problems, the present invention can reduce the number of key comparisons without deleting equivalent key records by minimizing competition between equivalent key records in the sort process. It is an object of the present invention to enable high-speed sorting of records having a large number of equivalent key records.

【0009】[0009]

【課題を解決するための手段ならびにその作用】本発明
の同値キーが存在するデータのソート方式は、上記の目
的を達成するために、レコードを1件ずつメモリに読み
込み、読み込んだレコードを読み込み済みのレコード群
と対戦させ、対戦の優勝者を順次ワークファイルに出力
していって中間結果であるストリングを複数作成してい
くプリソートフェーズを実施し、次いで、ワークファイ
ル内の複数のストリングのレコード同士をストリングの
先頭より順に対戦させ、対戦の優勝者を1本のストリン
グにまとめて出力するマージフェーズを実施するソート
方式において、プリソートフェーズにおいて、各ストリ
ングに出力するレコードに、当該レコードの後続のレコ
ードが同値キーレコードであるか否かを示す同値キーフ
ラグを付加するプリソート手段と、マージフェーズにお
いて、対戦の優勝者レコードをストリングに出力した
後、その優勝者レコードの属するストリングから次のレ
コードを得たときに、前記出力した優勝者レコードに付
加されていた同値キーフラグをチェックし、該同値キー
フラグが後続のレコードが同値キーレコードであること
を示すときは、前記取得した次のレコードは対戦に参加
させることなく直ちにストリングに出力するマージ手段
とを備えている。これにより、プリソートフェーズにお
けるキー比較回数を増加させることなく、マージフェー
ズにおけるキー比較回数を減らすことができ、トータル
なキー比較回数が削減される。
According to the present invention, in order to achieve the above object, the data sorting method according to the present invention reads records one by one into a memory and reads the read records. And a presort phase in which the winners of the battle are sequentially output to a work file to create a plurality of strings as intermediate results, and then a record of a plurality of strings in the work file In the sort method of performing a merge phase in which the two players battle each other in order from the head of the string and collectively output the winners of the battle into one string, a record to be output to each string in the presort phase is followed by a record following the record. Add an equivalence key flag indicating whether the record is an equivalence key record. In the merge means, in the merge phase, after outputting the winner record of the competition to a string, when the next record is obtained from the string to which the winner record belongs, the equivalent key flag added to the output winner record is output. And if the equivalence key flag indicates that the subsequent record is an equivalence key record, merging means for immediately outputting the acquired next record to a string without participating in a match is provided. Thus, the number of key comparisons in the merge phase can be reduced without increasing the number of key comparisons in the presort phase, and the total number of key comparisons is reduced.

【0010】また、マージ手段は、最終マージ以外の場
合のストリングにレコードを出力する際、プリソートフ
ェーズにおける場合と同様に、当該レコードの後続のレ
コードが同値キーレコードであるか否かを示す同値キー
フラグを付加する。これにより、マージされて得られた
ストリングを更に他のストリングとマージする処理にお
いて、前述と同様にしてキー比較回数を減らすことがで
きる。以下、このような本発明のソート方式のより具体
的な構成および作用を説明する。
[0010] When outputting a record to a string other than the final merge, the merging means, as in the presort phase, outputs an equivalent value indicating whether or not a record subsequent to the record is an equivalent key record. Add a key flag. As a result, the number of key comparisons can be reduced in the same manner as described above in the process of merging the merged string with another string. Hereinafter, a more specific configuration and operation of the sorting method of the present invention will be described.

【0011】本発明の同値キーが存在するデータのソー
ト方式は、メモリに入り切らない大量のレコードを、同
値キーレコードについてはそのまま出力するようにして
ソートする方式であり、プリソート手段,対戦手段,キ
ー比較手段,マージ手段,マージ対戦手段,ソートワー
クファイル,プリソート用レコードエリア,対戦管理テ
ーブル,マージ対戦用レコードエリア,マージ対戦管理
テーブルを備え、プリソート手段,対戦手段,キー比較
手段,ソートワークファイル,プリソート用レコードエ
リア,対戦管理テーブルを使ってプリソートフェーズを
実施し、マージ手段,マージ対戦手段,マージ対戦管理
テーブル,キー比較手段,マージ対戦用レコードエリ
ア,ソートワークファイルを使用してマージフェーズを
実施する。
In the data sorting method according to the present invention, a large number of records that cannot be stored in the memory are sorted by outputting the equivalent key records as they are. A key comparison unit, a merge unit, a merge battle unit, a sort work file, a pre-sort record area, a battle management table, a merge battle record area, a merge battle management table, and a pre-sort unit, a battle unit, a key comparison unit, and a sort work file. , Pre-sorting record area, and pre-sorting phase using the battle management table, and merging means, merging battle means, merge battle management table, key comparing means, merge battle record area, and sorting work file using the merge work phase. Is carried out.

【0012】プリソートフェーズでは以下のような動作
が行われる。プリソート手段は、ファイルあるいはアプ
リケーションプログラムから入力したソート対象レコー
ドを1件ずつプリソート用レコードエリアへ読み込みな
がら、対戦手段を呼び出して、読み込んだレコードを、
プリソート用レコードエリア内に既にあるレコード群と
対戦させる。対戦手段は、キー比較手段を用いてレコー
ドの対戦(キーの比較)を行っていき、対戦の優勝者
(キー順で最初に出力すべきレコード)を決定する。プ
リソート手段は、対戦手段が決定した対戦の優勝者を、
ソートワークファイルへ書き込んでいくことにより、ソ
ート中間結果としてストリングと呼ぶ順序付けられたレ
コード列を生成する。
In the presort phase, the following operation is performed. The presorting means calls the battle means while reading the records to be sorted inputted from the file or the application program one by one into the presorting record area, and reads the read record,
Play against a group of records already in the presort record area. The competition means performs a record competition (key comparison) using the key comparison means, and determines the winner of the competition (the record to be output first in key order). The presort means selects the winner of the match determined by the match means,
By writing to the sort work file, an ordered record sequence called a string is generated as a sort intermediate result.

【0013】そして、本発明の特徴として、対戦手段
は、対戦に参加している各レコードのプリソート用レコ
ードエリア内アドレスを示すレコードポインタに加えて
同値キーフラグを含む情報を対戦管理テーブルにより管
理し、レコードの対戦で同値キーであった場合、そのい
ずれか一方を勝者として、そのレコードに対応する対戦
管理テーブルのエントリの同値フラグをONにする。ま
た、プリソート手段は、対戦手段が決定した対戦の優勝
者レコードを、ソートワークファイルへ書き込んでいく
際には、同値キーフラグもレコード制御情報として付加
する。
As a feature of the present invention, the competition means manages information including an equivalent key flag in addition to a record pointer indicating an address in a presort record area of each record participating in the competition by a competition management table, If the match key is the match key in the record match, one of the keys is set as the winner, and the match flag of the entry in the match management table corresponding to the record is turned ON. When writing the winner record of the battle determined by the battle means to the sort work file, the presort means also adds an equivalent key flag as record control information.

【0014】マージフェーズにおいては以下のような動
作が行われる。マージ手段は、ソートワークファイル内
の複数のストリングを繰り返しマージしていき、1本の
ストリングにまとめ、出力する。このマージ手段の1回
のマージ処理おいて以下のような動作が行われる。
In the merge phase, the following operation is performed. The merging means repeatedly merges a plurality of strings in the sort work file, combines them into one string, and outputs it. The following operation is performed in one merge process of the merge means.

【0015】マージ手段は、まず各ストリングの先頭レ
コードを、マージ対戦用レコードエリアに読み込み、マ
ージ対戦手段を呼び出してレコードの対戦を行わせる。
マージ対戦手段は、キー比較手段を用いて、レコードの
対戦(キーの比較)を行っていき、対戦の優勝者(キー
順に最初に出力すべきレコード)を決定する。マージ手
段は、マージ対戦手段が決定した優勝者をマージ結果と
して出力する。即ち、最終マージにおいてはファイル或
いはアプリケーションプログラムに出力し、それ以外の
場合はストリングとしてソートワークファイルへ再度書
き込む。
The merging means first reads the first record of each string into the merge competition record area, calls the merge competition means, and causes the records to compete.
The merge competition means uses the key comparison means to perform record competition (key comparison), and determines the winner of the competition (record to be output first in key order). The merging means outputs the winner determined by the merging competition means as a merging result. That is, in the final merge, the file is output to a file or an application program, and otherwise, it is written again to the sort work file as a string.

【0016】ここで、マージ手段は、優勝者を出力した
後、優勝者の属するストリングから次のレコードをマー
ジ対戦用レコードエリアに読み込み、再度マージ対戦手
段を呼び出し、読み込んだレコードをマージ対戦用レコ
ードエリア内のレコード群と対戦させて優勝者を決定
し、マージ結果として出力する。以上の処理を、マージ
する全ストリングのレコードを読み終わるまで繰り返
し、ストリングのマージを行っていく。
Here, after outputting the winner, the merging means reads the next record from the string to which the winner belongs into the merge competition record area, calls the merge competition means again, and replaces the read record with the merge competition record. Compete against the records in the area to determine the winner, and output as the merge result. The above processing is repeated until the records of all the strings to be merged have been read, and the strings are merged.

【0017】そして本発明の特徴として、プリソートフ
ェーズと同様に、マージ対戦手段は、対戦に参加してい
る各レコードのマージ対戦用レコードエリア内アドレス
を示すレコードポインタに加えて同値キーフラグを含む
情報をマージ対戦管理テーブルにより管理し、マージ手
段は、レコードを対戦に参加させる際に、そのレコード
に対応するマージ対戦管理テーブルのエントリの同値キ
ーフラグをOFFにリセットし、また、マージ対戦用レ
コードエリアへレコードを読み込む際には、制御情報で
ある同値キーフラグも同時に読み込む。ここで、マージ
対戦用レコードエリアに読み込んだ同値キーフラグ(同
値キーレコードフラグと呼ぶこともある)と、マージ対
戦管理テーブルのエントリ内の同値キーフラグとは別の
情報であることに注意されたい。
As a feature of the present invention, similarly to the presort phase, the merge battle means includes information including an equivalent key flag in addition to a record pointer indicating an address in a merge battle record area of each record participating in the battle. The merge means resets the equivalent key flag of the entry of the merge match management table corresponding to the record to OFF when the record participates in the match, and returns to the merge match record area. When reading a record, an equivalent key flag as control information is also read at the same time. Here, it should be noted that the equivalence key flag (also referred to as an equivalence key record flag) read into the merge competition record area is different from the equivalence key flag in the entry of the merge competition management table.

【0018】そして、マージ対戦手段は、レコードの対
戦で同値キーであった場合、そのいずれか一方を勝者と
して、そのレコードに対応するマージ対戦管理テーブル
のエントリの同値キーフラグをONにし、マージ手段
は、マージ対戦手段が優勝者レコードを決定したとき、
その優勝者レコードを出力レコードと決定して、該決定
した出力レコードに付加されている同値キーフラグを参
照し、以下の処理を行う。
If the match key is found in the match of the record, the merge match means sets the equivalent key flag of the entry of the merge match management table corresponding to the record to one of the winners, and sets the merge means to the ON state. , When the Merge opponent determines the winner record,
The winner record is determined as an output record, and the following processing is performed with reference to the equivalent key flag added to the determined output record.

【0019】出力レコードに付加されている同値キーフ
ラグがONであれば、その出力レコードをそれに元々付
加されていた同値キーフラグを付加してストリングに出
力し且つその出力レコードの属するストリングから読み
込んだ次のレコードを対戦に参加させることなく出力レ
コードに決定する処理を、付加されている同値キーフラ
グがOFFの出力レコードを読み込むまで繰り返す。出
力レコードに付加されている同値キーフラグがOFFで
あったとき、および、その同値キーフラグがONであっ
て前記処理が行われて同値キーフラグがOFFの出力レ
コードが読み込まれたときは、前記マージ対戦手段が決
定した優勝者レコードに対応する前記マージ対戦管理テ
ーブルの同値キーフラグを参照し、該同値キーフラグが
ONであれば、ONにした同値キーフラグを付加した出
力レコードをストリングに出力し、OFFであれば、そ
の出力レコードにOFFの同値キーフラグを付加してス
トリングに出力する
If the equivalent key flag added to the output record is ON, the output record is output to a string with the originally added equivalent key flag added, and the next read from the string to which the output record belongs is read. The process of deciding a record as an output record without participating in a match is repeated until an output record with the attached equivalence key flag OFF is read. When the equivalent key flag added to the output record is OFF, and when the equivalent key flag is ON and the above processing is performed and the output record with the equivalent key flag OFF is read, the merge competition means Refers to the equivalent key flag of the merged match management table corresponding to the determined winner record. If the equivalent key flag is ON, an output record with the ON equivalent key flag added is output to a string. , Adds an equivalent key flag of OFF to the output record and outputs it to a string

【0020】対戦手段,マージ対戦手段におけるレコー
ド対戦方式は、トーナメント置換方式,バイナリインサ
ーション方式等の任意の方式を用いることができる。
As a record battle system in the battle unit and the merge battle unit, any system such as a tournament replacement system or a binary insertion system can be used.

【0021】対戦手段にトーナメント置換方式を用いる
場合は、対戦で勝ち上がった方のレコードの情報を一時
的に設定しておくための作業領域である勝ち上がりレコ
ードエントリが備えられ、対戦手段の対戦は2進木構造
で定義される対戦構造の下位から上位に向けて勝ち抜き
戦形式で行っていき、対戦構造の各ノード毎に、前記対
戦管理テーブルのエントリを対応させ、該エントリには
対戦で負けた方のレコードの情報を設定し、対戦の開始
時には、読み込んだレコードの情報を前記勝ち上がりレ
コードエントリに設定し、その後勝ち上がりレコードエ
ントリのレコードと、対戦管理テーブルのレコード群と
を、対戦構造に従って順次対戦させていき、前記対戦管
理テーブル側のレコードが勝った場合は、前記勝ち上が
りレコードエントリと対戦管理テーブル側のレコードの
対戦管理テーブルエントリとを交換し、以下同様に対戦
を続け、対戦終了時に、前記勝ち上がりレコードエント
リに設定されているレコードを対戦の優勝者に決定し、
更に、同値キーレコードの対戦があった場合、前記勝ち
上がりレコードエントリに設定されているレコードを勝
者と決定し、前記勝ち上がりレコードエントリの同値キ
ーフラグをONに設定する。
When the tournament replacement method is used as the competition means, a winning record entry which is a work area for temporarily setting information of a record which has won in the competition is provided. Is performed in a win-winning manner from the lower level to the upper level of the battle structure defined by the binary tree structure, and an entry in the battle management table is made to correspond to each node of the battle structure. The information of the losing record is set, and at the start of the match, the information of the read record is set in the winning record entry. Thereafter, the record of the winning record entry and the record group of the match management table are set in the match. Matches are sequentially made in accordance with the structure, and if the record on the match management table wins, the winning record entry And to exchange and battle management table entry of the competition management table side of the record, it continues in the same manner as in competition following, at the time of the match end, to determine the records that have been set in the win up record entry to the winner of the competition,
Further, when there is a match of the equivalent key record, the record set in the winning record entry is determined as the winner, and the equivalent key flag of the winning record entry is set to ON.

【0022】そして、対戦手段にトーナメント置換方式
を用いた構成における好適な実施例においては、対戦手
段による対戦の優勝者,優勝者の同値キーフラグ,次に
入力したレコードの対戦開始エントリを含む対戦情報を
一時的に記憶しておくための対戦結果保存手段をも備
え、前記対戦手段は1回の対戦が終了して優勝者が決定
した時点で、前記対戦結果保存手段に対戦情報を保存す
ると共に、対戦を行うにあたり、前記対戦結果保存手段
に保存されている前回の対戦での優勝者レコードと今回
入力されたレコードとのキーを比較し、同値キーでなけ
れば、前記対戦結果保存手段に保存されている対戦開始
エントリからトーナメントの対戦を開始し、同値キーで
あれば、トーナメントの対戦はスキップし、入力された
レコードを直ちに今回の対戦の優勝者と決定すると共
に、前記対戦結果保存手段により保存されている前回の
優勝者の同値キーフラグの値を、今回の対戦の優勝者の
同値キーフラグとして引き継いだ後、前記対戦結果保存
手段により保存されている前回の優勝者の同値キーフラ
グはONに設定し、前記プリソート手段は、前記対戦手
段による1回の対戦を行って優勝者を決定した時点で、
前記対戦結果保存手段により保存されている前回の対戦
での優勝者およびその同値キーフラグを出力するように
している。
In a preferred embodiment in a configuration using the tournament replacement system as the battle means, the battle information including the winner of the battle by the battle means, the equivalent key flag of the winner, and the battle start entry of the next input record. And a battle result storage unit for temporarily storing the battle information, and the battle unit saves battle information in the battle result storage unit when a single battle is completed and a winner is determined. In conducting the match, the key of the winner record of the previous match stored in the match result storing means and the key of the record input this time are compared, and if the key is not the same value key, the key is stored in the match result storing means. Starts the tournament match from the match start entry specified, and if the key is the same, skips the tournament match and immediately replaces the entered record with the Is determined as the winner of the match, and the value of the equivalent key flag of the previous winner saved by the match result storage is inherited as the equivalent key flag of the winner of the current match. The pre-sorting means sets the equivalency key flag of the last winner stored in the above to ON, and the pre-sorting means performs one battle by the competition means to determine the winner,
The champion and the equivalent key flag of the previous match saved by the match result storage means are output.

【0023】対戦手段にバイナリインサーション方式を
用いる場合は、前記対戦手段による対戦は、前記プリソ
ート用レコードエリアに新たに読み込んだレコードを、
既に読み込み済みでキー順に並んでいるレコード群内の
どの位置に挿入すべきかを、バイナリインサーション方
式により決定して、決定した位置にレコードを挿入する
方式で行い、且つ、挿入位置の決定は、レコード群を半
分ずつの2つのグループに分割し、分割した境界に位置
するレコードと挿入するレコードとを対戦させることに
より、挿入するレコードがどちらのグループに属するか
を判定することで行い、且つ、挿入するレコードとの対
戦相手は、分割した下位のグループの最上位レコードを
採用し、同値キーレコードの対戦においては、挿入する
レコードの方を勝ちとし、挿入するレコードに対応する
前記対戦管理テーブルの同値キーフラグをONにする。
When the binary insertion method is used as the battle means, the battle by the battle means is performed by newly reading a record newly read into the presort record area.
Which position in the record group that has already been read and arranged in the key order is determined by the binary insertion method, and the record is inserted at the determined position, and the insertion position is determined. The record group is divided into two groups of half, and the record located at the divided boundary and the record to be inserted are played against each other to determine which group the record to be inserted belongs to, and The opponent with the record to be inserted adopts the uppermost record of the divided lower group, and in the match of the equivalent key record, the record to be inserted wins, and the match management table corresponding to the record to be inserted corresponds to the record to be inserted. Turn on the equivalence key flag.

【0024】マージ対戦手段にトーナメント置換方式を
用いる場合は、マージ対戦手段による対戦で勝ち上がっ
た方のレコードの情報を一時的に設定しておくための作
業領域である勝ち上がりレコードエントリを備え、前記
マージ対戦手段による対戦は2進木構造で定義される対
戦構造の下位から上位に向けて勝ち抜き戦形式で行って
いき、対戦構造の各ノード毎に、前記マージ対戦管理テ
ーブルのエントリを対応させ、該エントリには対戦で負
けた方のレコードの情報を設定し、対戦の開始時には、
読み込んだレコードの情報を前記勝ち上がりレコードエ
ントリに設定し、その後勝ち上がりレコードエントリの
レコードとマージ対戦管理テーブルのレコード群とを、
対戦構造に従って順次対戦させていき、前記マージ対戦
管理テーブル側のレコードが勝った場合は、前記勝ち上
がりレコードエントリとマージ対戦管理テーブル側のレ
コードのマージ対戦管理テーブルエントリとを交換し、
以下同様に対戦を続け、対戦終了時に、前記勝ち上がり
レコードエントリに設定されているレコードを対戦の優
勝者に決定し、更に、同値キーレコードの対戦があった
場合、前記勝ち上がりレコードエントリに設定されてい
るレコードを勝者と決定し、前記勝ち上がりレコードエ
ントリの同値キーフラグをONに設定する。
In the case where the tournament replacement method is used for the merge battle means, a winning record entry which is a work area for temporarily setting information of a record which has won in the battle by the merge battle means is provided. The battle by the merge battle means is performed in a win-win battle format from the lower level to the upper level of the battle structure defined by the binary tree structure, and an entry of the merge battle management table is made to correspond to each node of the battle structure. In the entry, the information of the record that lost the match is set, and at the start of the match,
The information of the read record is set in the winning record entry, and thereafter, the record of the winning record entry and the record group of the merge battle management table are
Matches are sequentially made in accordance with the match structure, and when the record in the merge match management table wins, the winning record entry is exchanged with the merge match management table entry of the record in the merge match management table,
Thereafter, the match is continued in the same manner, and at the end of the match, the record set in the winning record entry is determined to be the winner of the match, and further, if there is a match of the same key record, the record is set in the winning record entry. Is determined as the winner, and the equivalent key flag of the winning record entry is set to ON.

【0025】そして、マージ対戦手段にトーナメント置
換方式を用いた構成における好適な実施例においては、
マージ対戦手段による対戦の優勝者,優勝者の同値キー
フラグ,次に入力したレコードの対戦開始エントリを含
む対戦情報を一時的に記憶しておくための対戦結果保存
手段をも備え、前記マージ対戦手段は1回の対戦が終了
して優勝者が決定した時点で、前記対戦結果保存手段に
対戦情報を保存すると共に、対戦を行うにあたり、前記
対戦結果保存手段に保存されている前回の対戦での優勝
者レコードと今回入力されたレコードとのキーを比較
し、同値キーでなければ、前記対戦結果保存手段に保存
されている対戦開始エントリからトーナメントの対戦を
開始し、同値キーであれば、トーナメントの対戦はスキ
ップし、入力されたレコードを直ちに今回の対戦の優勝
者と決定するとともに、前記対戦結果保存手段により保
存されている前回の優勝者の同値キーフラグの値を、今
回の対戦の優勝者の同値キーフラグとして引き継いだ
後、前記対戦結果保存手段により保存されている前回の
優勝者の同値キーフラグはONに設定し、前記マージ手
段は、前記マージ対戦手段による1回の対戦を行って優
勝者を決定した時点で、前記対戦結果保存手段により保
存されている前回の対戦での優勝者およびその同値キー
フラグとを出力するようにしている。
In a preferred embodiment in a configuration using the tournament replacement system as the merge battle means,
Competition result storage means for temporarily storing competition information including a winner of the competition by the merge competition means, an equivalent key flag of the winner, and a competition start entry of the next input record; When the winner is determined after one match is completed, the match information is stored in the match result storing means, and when the match is performed, the match information of the previous match stored in the match result storing means is stored. The key of the winner record is compared with the key of the record entered this time. If the key is not the same key, the match of the tournament is started from the match start entry stored in the match result storage means. Is skipped, the input record is immediately determined as the winner of the current match, and the previous record stored by the match result storage means is stored. After taking over the value of the equivalent key flag of the winner as the equivalent key flag of the winner of the current match, the equivalent key flag of the previous winner saved by the match result saving means is set to ON, and the merging means When a winner is determined by performing one battle by the merge battle means, the winner of the previous battle and its equivalent key flag stored by the battle result storage means are output.

【0026】マージ対戦手段にバイナリインサーション
方式を用いる場合は、前記マージ対戦手段の対戦は、前
記マージ対戦用レコードエリアに新たに読み込んだレコ
ードを、既に読み込み済みでキー順に並んでいるレコー
ド群内のどの位置に挿入すべきかを、バイナリインサー
ション方式により決定して、決定した位置にレコードを
挿入する方式で行い、且つ、挿入位置の決定は、レコー
ド群を半分ずつの2つのグループに分割し、分割した境
界に位置するレコードと挿入するレコードとを対戦させ
ることにより、挿入するレコードがどちらのグループに
属するかを判定することで行い、且つ、挿入するレコー
ドとの対戦相手は、分割した下位のグループの最上位レ
コードを採用し、同値キーレコードの対戦においては、
挿入するレコードの方を勝ちとし、挿入するレコードに
対応する前記対戦管理テーブルの同値キーフラグをON
にする。
In the case where the binary insertion method is used for the merge competition means, the competition of the merge competition means is performed by re-recording a record newly read in the merge competition record area in a record group which has already been read and arranged in key order. The position to be inserted is determined by the binary insertion method, and a record is inserted at the determined position. The insertion position is determined by dividing the record group into two groups of half each. By comparing the record located at the divided boundary with the record to be inserted, it is determined by which group the record to be inserted belongs to, and the opponent with the record to be inserted is the lower Group's top-level record, and in the match against the equivalent key record,
The record to be inserted wins, and the equivalent key flag in the battle management table corresponding to the record to be inserted is turned ON.
To

【0027】[0027]

【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, embodiments of the present invention will be described in detail with reference to the drawings.

【0028】図1は本発明の一実施例のブロック図であ
る。同図に示すように、本実施例のソート方式は、プリ
ソート手段1と、対戦手段2と、キー比較手段3と、マ
ージ手段4と、マージ対戦手段5と、ソートワークファ
イル7と、プリソート用レコードエリア9と、対戦管理
テーブル10と、マージ対戦用レコードエリア11と、
マージ対戦管理テーブル12と、勝ち上がりレコードエ
ントリ13と、対戦結果保存手段14とを備え、磁気デ
ィスクや磁気テープ中のファイルFIあるいはアプリケ
ーションプログラムAPから入力データ(ソート対象レ
コード)6を入力してソート処理を行い、出力データ
(ソート済レコード)8を、磁気ディスクや磁気テープ
中のファイルFOあるいはアプリケーションプログラム
APに出力するものである。
FIG. 1 is a block diagram of one embodiment of the present invention. As shown in the figure, the sorting method of the present embodiment includes a pre-sorting unit 1, a competition unit 2, a key comparison unit 3, a merge unit 4, a merge competition unit 5, a sort work file 7, a pre-sort A record area 9, a match management table 10, a merge match record area 11,
It has a merge battle management table 12, a winning record entry 13, and a battle result storage means 14, and inputs and sorts input data (sort target records) 6 from a file FI on a magnetic disk or a magnetic tape or from an application program AP. Processing is performed, and output data (sorted records) 8 are output to a file FO or an application program AP in a magnetic disk or a magnetic tape.

【0029】本実施例のソート方式における処理は大き
く分けて、入力データ6をプリソート用レコードエリア
9に読み込みながらソートしていって中間結果である幾
つかのストリングをソートワークファイル7へ出力して
いくプリソート処理と、このプリソート処理で作成した
幾つかのストリングを、マージ対戦用レコードエリア1
1に読み込みながら繰り返しマージしていき、最終的に
1本のストリングにまとめ、出力データ8として出力す
るマージ処理の2つ分けられ、プリソート処理はプリソ
ート手段1が制御を司り、マージ処理はマージ手段4が
制御を司る。
The processing in the sorting method according to the present embodiment is roughly divided into the following steps. The input data 6 is sorted into the pre-sorting record area 9 while being read, and some strings as intermediate results are output to the sort work file 7. The pre-sorting process and some strings created by the pre-sorting process are merged into the record area 1 for the battle.
1 is repeatedly merged while being read into 1, and finally merged into one string and output as output data 8. The merge processing is divided into two. The presort processing is controlled by the presort means 1, and the merge processing is performed by the merge means. 4 controls the control.

【0030】本実施例のソート方式が従来のソート方式
と大きく相違する点の1つは、プリソートフェーズにお
いてソートワークファイル7内に作成する各ストリング
中のレコードに、当該レコードの後続のレコードが同値
キーレコードであるか否かを示す同値キーフラグを付加
した点にある。このために、対戦に参加している各レコ
ードの情報を保持する対戦管理テーブル10および勝ち
上がりレコードエントリ13には、各レコード対応の同
値キーフラグを設定し、プリソートフェーズ中における
処理でこの同値キーフラグを操作するようにしている。
なお、対戦管理テーブル10および勝ち上がりレコード
エントリ13には、同値キーフラグ以外に、対戦に参加
している各レコードが格納されているプリソート用レコ
ードエリア9のアドレスを示すレコードポインタや、用
いるソート手法に応じて必要となる種々の情報も格納さ
れている。
One of the major differences between the sorting method of the present embodiment and the conventional sorting method is that a record in each string created in the sort work file 7 in the presort phase includes a record subsequent to the record. The point is that an equivalent key flag indicating whether or not the record is an equivalent key record is added. For this purpose, an equivalence key flag corresponding to each record is set in the battle management table 10 holding information on each record participating in the competition and the winning record entry 13, and the equivalence key flag is set in the processing during the presort phase. To operate.
The match management table 10 and the winning record entry 13 include, in addition to the equivalence key flag, a record pointer indicating the address of the presort record area 9 in which each record participating in the match is stored, and a sort method used. Various information required in accordance with the information is also stored.

【0031】本実施例のソート方式が従来のソート方式
と大きく相違する他の点は、マージフェーズにおいて、
マージ対象となるソートワークファイル7内のストリン
グ中のレコードイメージをそれに付加された同値キーフ
ラグと共にマージ対戦用レコードエリア11に読み込
み、また、マージ対戦に参加している各レコードの情報
を保持するマージ対戦管理テーブル12および勝ち上が
りレコードエントリ13に各レコード対応の同値キーフ
ラグ(この同値キーフラグはマージ対戦用レコードエリ
ア11に設定された同値キーフラグとは別のものであ
る)を設定し、これら2つの同値キーフラグを用いてマ
ージ処理を進めるようにした点にある。なお、マージ対
戦管理テーブル12には、同値キーフラグ以外に、マー
ジ対戦に参加している各レコードが格納されているマー
ジ対戦用レコードエリア11のアドレスを示すレコード
ポインタや、用いるソート手法に応じて必要となる種々
の情報も格納されている。
Another difference between the sorting method of this embodiment and the conventional sorting method is that in the merge phase,
The record image in the string in the sort work file 7 to be merged is read into the merge competition record area 11 together with the equivalent key flag added thereto, and a merge competition that retains information of each record participating in the merge competition An equivalent key flag corresponding to each record (this equivalent key flag is different from the equivalent key flag set in the merge battle record area 11) is set in the management table 12 and the winning record entry 13, and these two equivalent key flags are set. The point is that the merging process is advanced by using. In addition, in addition to the equivalence key flag, the merge match management table 12 requires a record pointer indicating the address of the merge match record area 11 in which each record participating in the merge match is stored, and a sort method used. Are also stored.

【0032】以下、本実施例について詳しく説明してい
く。まずプリソート処理の流れの概略を説明する。プリ
ソート手段1は、入力データ6中のレコードをプリソー
ト用レコードエリア9へ1件ずつ読み込んでいき、レコ
ードを1件読み込む毎に対戦手段2を呼び出し、読み込
んだレコードと、プリソート用レコードエリア9に読み
込み済みのレコード群との対戦を行わせる。
Hereinafter, this embodiment will be described in detail. First, an outline of the flow of the presort processing will be described. The presort unit 1 reads records in the input data 6 one by one into the presort record area 9, calls the battle unit 2 each time one record is read, reads the read record and the presort record area 9. Play against already completed records.

【0033】対戦手段2は、キー比較手段3を用いて、
レコードのキーを比較していき、優勝者(キー順で最初
に出力すべきレコード)を決定し、決定した優勝者レコ
ードの情報を、勝ち上がりレコードエントリ13に設定
するとともに、優勝者レコードの後続レコードに同値キ
ーのレコードがあるか否かを示す同値キーフラグも同時
に勝ち上がりレコードエントリ13に設定する。
The competition means 2 uses the key comparison means 3 to
By comparing the record keys, the winner (the record to be output first in the key order) is determined, the information of the determined winner record is set in the winning record entry 13, and the succeeding record of the winner record is set. An equivalent key flag indicating whether or not there is an equivalent key record in the record is also set in the winning record entry 13 at the same time.

【0034】本実施例では、対戦手段2における対戦
は、対戦管理テーブル10と対戦結果保存手段14とを
用いて、トーナメント置換方式により行われるが、処理
の詳細については、図2を参照して後述する。
In the present embodiment, the battle in the battle means 2 is performed by the tournament replacement system using the battle management table 10 and the battle result storage means 14. For details of the processing, see FIG. It will be described later.

【0035】なお、対戦手段2におけるソート方式とし
てバイナリインサーション方式を用いることも可能であ
り、対戦手段2にバイナリインサーション方式を適用し
た実施例の処理の詳細については、図3を参照して後述
する。
It is also possible to use a binary insertion method as a sorting method in the battle means 2. For details of the processing in the embodiment in which the binary insertion method is applied to the battle means 2, see FIG. It will be described later.

【0036】さて、プリソート手段1は、対戦手段2が
決定した対戦の優勝者レコードを、順次ソートワークフ
ァイル7へ出力していき、ストリングを作成していく
が、その際に同値キーフラグも制御情報として優勝者レ
コードに付加する。
The pre-sorting means 1 sequentially outputs the winner record of the battle determined by the fighting means 2 to the sort work file 7 and creates a string. At this time, the equivalent key flag is also stored in the control information. To the winner record.

【0037】プリソート手段1は入力データ6の全レコ
ードを幾つかのストリングとしてソートワークファイル
7に出力し終わると、マージ手段4に制御を渡し、プリ
ソート処理を終了する。以後、マージ処理が以下のよう
に行われる。
When the presort unit 1 finishes outputting all the records of the input data 6 to the sort work file 7 as some strings, it passes control to the merge unit 4 and ends the presort processing. Thereafter, the merging process is performed as follows.

【0038】マージ手段4は、ソートワークファイル7
の各ストリングからマージ対戦用レコードエリア11
に、レコードを1件ずつ読み込んでいき、レコードを1
件読み込む毎にマージ対戦手段5を呼び出し、読み込ん
だレコードと、マージ対戦用レコードエリア11に読み
込み済みのレコード群との対戦を行わせる。
The merging means 4 includes a sort work file 7
Match record area 11 from each string of
Then, the records are read one by one,
Each time the record is read, the merge battle means 5 is called, and the read record and the merged record group 11 are played against each other.

【0039】マージ対戦手段5は、対戦手段2と同様
に、キー比較手段3を用いてレコードのキーを比較して
いき、優勝者レコード(キー順で最初に出力すべきレコ
ード)を決定し、決定した優勝者レコードの情報を、勝
ち上がりレコードエントリ13に設定するとともに、優
勝者レコードの後続レコードに同値キーレコードがある
か否かを示す同値キーフラグも同時に勝ち上がりレコー
ドエントリ13に設定する。
As in the case of the competition means 2, the merge competition means 5 compares the keys of the records by using the key comparison means 3 to determine the winner record (the record to be output first in key order). The information of the determined winner record is set in the winning record entry 13, and an equivalent key flag indicating whether or not there is an equivalent key record in a record following the winner record is also set in the winning record entry 13 at the same time.

【0040】このマージ対戦手段5における対戦は、本
実施例では、対戦手段2と同様に、マージ対戦管理テー
ブル12と対戦結果保存手段14とを用いてトーナメン
ト置換方式により行われる。勿論、対戦手段2がバイナ
リインサーション方式を採用し得ると同様に、マージ対
戦手段5もバイナリインサーション方式を採用すること
ができる。
In the present embodiment, the battle in the merge battle means 5 is performed by the tournament replacement method using the merge battle management table 12 and the battle result storage means 14 as in the battle means 2. Of course, just as the competition means 2 can employ the binary insertion method, the merge competition means 5 can also employ the binary insertion method.

【0041】マージ手段4は、最終マージの場合は、マ
ージ対戦手段5が決定した対戦の優勝者レコードを出力
データ8として順次出力していき、最終マージでない場
合は、マージ対戦手段5が決定した対戦の優勝者レコー
ドをソートワークファイル7へ順次出力していき、マー
ジ結果としての新たなストリングを作成していく。この
とき、マージ手段4は、ソートワークファイル7内のス
トリングの各レコードに制御情報として付加されている
同値キーフラグと、マージ対戦手段5により決定した対
戦の優勝者レコードのマージ対戦管理テーブル12の同
値キーフラグとの2つのフラグ情報を参照して、ストリ
ングとして出力するレコードに同値キーフラグを付加す
る。また、各レコードに付加されている同値キーフラグ
はキー比較回数の削減(対戦回数の削減)にも利用され
る。このようなマージ手段4の処理の詳細は、同値キー
フラグの扱いを含め、図4を参照して後に詳細に説明す
る。
The merging means 4 sequentially outputs the winner record of the battle determined by the merging competition means 5 as the output data 8 in the case of the final merging, and determines the merging competition means 5 in the case of not the final merging. The winner record of the battle is sequentially output to the sort work file 7, and a new string is created as a merge result. At this time, the merging means 4 sets the equivalence key flag added as control information to each record of the string in the sort work file 7 and the equivalent value in the merge competition management table 12 of the winner record of the competition determined by the merge competition means 5. An equivalent key flag is added to a record output as a string with reference to two pieces of flag information including a key flag. The equivalent key flag added to each record is also used for reducing the number of key comparisons (reducing the number of battles). The details of the processing of the merging means 4 will be described later in detail with reference to FIG. 4, including the handling of the equivalent key flag.

【0042】以下、対戦手段2およびマージ手段4の処
理手順について、本発明の特徴部分である同値キーフラ
グの扱いを中心にして、図2から図4のフローチャート
を参照して詳細に説明する。
Hereinafter, the processing procedure of the battle means 2 and the merging means 4 will be described in detail with reference to the flowcharts of FIGS. 2 to 4, focusing on the handling of the equivalent key flag which is a characteristic part of the present invention.

【0043】先ず、トーナメント置換方式を用いた対戦
手段2の処理手順の詳細を説明する。
First, the processing procedure of the battle means 2 using the tournament replacement method will be described in detail.

【0044】周知のように、トーナメント置換方式は、
2進木構造で定義される対戦構造の下位から上位に向け
て勝ち抜き戦形式で対戦を行っていく方式であり、対戦
構造の各ノード毎に、対戦管理テーブル10のエントリ
を対応させ、該エントリには対戦で負けた方のレコード
の情報を設定する。他方、対戦で勝ち上がった方のレコ
ードの情報は勝ち上がりレコードエントリ13に一時的
に保持される。この勝ち上がりレコードエントリ13の
形式は対戦管理テーブル10のエントリと同じである。
As is well known, the tournament replacement method is as follows.
This is a system in which a battle is played in a win-win battle format from the lower order to the upper position of the battle structure defined by the binary tree structure. An entry of the battle management table 10 is made to correspond to each node of the battle structure. Is set to the information of the record that lost the match. On the other hand, the information of the record that has won in the battle is temporarily stored in the winning record entry 13. The format of the winning record entry 13 is the same as the entry of the battle management table 10.

【0045】対戦は、勝ち上がりレコードエントリのレ
コードと、対戦管理テーブル10のレコード群とを、対
戦構造に従って順次対戦させていく形式で行い、そして
各対戦においては、対戦管理テーブル10の対戦相手が
勝ち上がりレコードエントリ13のレコードに勝った場
合には、勝ったレコードと負けたレコードとを対戦管理
テーブル10と勝ち上がりレコードエントリ13との間
で入れ換え、対戦終了時に勝ち上がりレコードエントリ
13に設定されているレコードが対戦の優勝者となる。
The battle is performed in such a manner that the record of the winning record entry and the record group of the battle management table 10 are sequentially battled according to the battle structure, and in each battle, the opponent of the battle management table 10 When the record of the winning record entry 13 is won, the winning record and the losing record are exchanged between the battle management table 10 and the winning record entry 13 and are set in the winning record entry 13 at the end of the battle. That record will be the winner of the match.

【0046】以下、図2を参照して、トーナメント置換
方式を用いた対戦手段2の処理手順の詳細を説明する。
Hereinafter, the processing procedure of the battle means 2 using the tournament replacement method will be described in detail with reference to FIG.

【0047】対戦手段2は、対戦を開始するにあたり、
ステップ201において、プリソート手段1から受け取
ったレコードの、プリソート用レコードエリア9内アド
レス(レコードポインタ)を、勝ち上がりレコードエン
トリ13に設定し、ステップ202において、勝ち上が
りレコードエントリ13の同値キーフラグをOFFに初
期設定する。
At the start of the battle, the battle means 2
In step 201, the address (record pointer) in the presort record area 9 of the record received from the presort unit 1 is set in the winning record entry 13, and in step 202, the equivalent key flag of the winning record entry 13 is turned off. Initialize.

【0048】ステップ203では、プリソート用レコー
ドエリア9内にレコードが満杯になった後かを判定し、
満杯になった後でなければステップ211へ進み、満杯
になった後ならばステップ204に進む。従って、ソー
ト開始直後は未だプリソート用レコードエリア9はレコ
ードで満杯になっていないので、ステップ211へ進む
ことになる。
In step 203, it is determined whether or not the record in the pre-sort record area 9 is full.
If it is not full, the process proceeds to step 211, and if it is full, the process proceeds to step 204. Therefore, immediately after the start of sorting, the pre-sorting record area 9 is not yet full of records, and the process proceeds to step 211.

【0049】ステップ211では、対戦管理テーブル1
0で管理されるレコード群の中から最初に(次に)対戦
するレコードを選択する。
At step 211, the battle management table 1
The record to be played first (next) is selected from the record group managed by 0.

【0050】ステップ212では、ステップ211での
選択の結果、対戦するレコードが存在したか否かを判定
し、存在した場合は、ステップ213で、勝ち上がりレ
コードエントリ13のレコードと対戦相手のレコードと
を対戦させる。トーナメント置換方式の手順として周知
のように、対戦はまずストリング番号の比較で行い、ス
トリング番号の小さい方を勝ちと決定し、ストリング番
号が同一の場合にのみキーの比較で判定する。
At step 212, it is determined whether or not there is a record to be played as a result of the selection at step 211. If there is, at step 213, the record of the winning record entry 13 and the record of the opponent are compared. To play. As is well known as a procedure of the tournament replacement method, a match is first performed by comparing string numbers, the smaller string number is determined to be won, and only when the string numbers are the same is determined by comparing keys.

【0051】ステップ214では、対戦の結果、同値キ
ーであったか否かを判定し、同値キーならば、勝ち上が
りレコードエントリ13のレコードを勝者と見做し、勝
ち上がりレコードエントリ13の同値キーフラグをON
に設定した後、ステップ211へ戻り、対戦を続行す
る。
In step 214, it is determined whether or not the result of the match is the equivalent key. If the key is the equivalent key, the record of the winning record entry 13 is regarded as a winner, and the equivalent key flag of the winning record entry 13 is turned on.
Then, the process returns to step 211 to continue the battle.

【0052】対戦の結果、同値キーでなければ、ステッ
プ216で、どちらのレコードが勝ちかを判定する。
As a result of the battle, if the key is not the same key, at step 216, it is determined which record wins.

【0053】ステップ216の判定の結果、対戦相手
(対戦管理テーブル10側のレコード)の勝ちであれ
ば、ステップ217において、対戦相手のレコードの対
戦管理テーブル10のエントリと、勝ち上がりレコード
エントリ13とを交換することにより、対戦相手を新た
な勝ち上がりレコードに設定した後、ステップ211へ
戻り、対戦を続行する。また、ステップ216での判定
の結果、勝ち上がりレコードが勝ちならば、そのままス
テップ211へ戻り、対戦を続行する。
If the result of determination in step 216 is that the opponent (the record on the opponent management table 10) has won, then in step 217, the entry of the opponent's record in the opponent management table 10 and the winning record entry 13 , The opponent is set to a new winning record, and the process returns to step 211 to continue the opponent. If the result of the determination in step 216 is that the winning record has won, the process returns to step 211 and the battle is continued.

【0054】このような対戦が続けられ、ステップ21
2で次に対戦するレコードが存在しないと判定される
と、今回のレコードの入力時点での対戦が終了したこと
になり、ステップ218へ移行し、勝ち上がりレコード
エントリ13に設定されているレコードを対戦の優勝者
と決定し、ステップ219において、優勝者レコード,
優勝者レコードの同値キーフラグ,次の入力レコードの
対戦開始エントリ等の対戦結果を、対戦結果保存手段1
4に保存して、今回のレコード入力時点における対戦処
理を終了する。
Such a battle is continued, and step 21
If it is determined in step 2 that there is no record to be played next, it means that the match at the time of input of the current record has been completed, and the process proceeds to step 218, where the record set in the winning record entry 13 is deleted. The winner of the match is determined, and in step 219, the winner record,
The match result, such as the equivalent key flag of the winner record and the match start entry of the next input record, is stored in the match result storage means 1.
4 and the battle process at the time of this record input is ended.

【0055】以上のような対戦がレコード入力毎に行わ
れ、プリソート用レコードエリア9内にレコードが満杯
になった後に次のレコードが入力されると、ステップ2
03からステップ204へ移行する。ステップ204で
は、対戦結果保存手段14により保存されている前回の
対戦の優勝者レコードと、勝ち上がりレコードエントリ
13のレコード(今回の入力レコード)とのキーを比較
し、ステップ205で同値キーかを判定する。
The above-mentioned battle is performed every time a record is input, and when the next record is input after the record is filled in the presort record area 9, step 2 is executed.
The process proceeds from step 03 to step 204. In step 204, the key of the winner record of the previous battle stored by the battle result storage unit 14 is compared with the key of the record of the winning record entry 13 (the current input record). judge.

【0056】ステップ205の判定の結果、同値キーで
あれば、ステップ206において、勝ち上がりレコード
エントリ13の同値キーフラグとして、対戦結果保存手
段14が保存している、前回の対戦での優勝者レコード
の同値キーフラグの値をそのまま引き継ぎ、ステップ2
07において、対戦結果保存手段14が保存している、
前回の対戦での優勝者レコードの同値キーフラグをON
に設定し直した後、トーナメントによる対戦を行うこと
なくステップ218へ移行し、勝ち上がりレコードエン
トリ13のレコード(今回の入力レコード)を対戦の優
勝者と決定する。
If the result of the determination in step 205 is that the key is an equivalent key, then in step 206, the match record flag of the winning record entry 13 is stored in the match result storage means 14 and the winner record of the previous match is saved. Step 2 inherits the value of the equivalence key flag
At 07, the battle result storage means 14 stores
Turn on the equivalent key flag of the winner record in the previous match
Then, the process proceeds to step 218 without performing the battle by the tournament, and the record of the winning record entry 13 (the current input record) is determined as the winner of the battle.

【0057】また、ステップ205の判定の結果、同値
キーでなければ、ステップ208において、どちらのレ
コードの勝ちかを判定し、勝ち上がりレコードエントリ
13のレコード(今回の入力レコード)の勝ちならば、
トーナメント置換方式の手順として周知のように、ステ
ップ209において、今回の入力レコードのストリング
番号に1を加算する。そして、ステップ210におい
て、対戦結果保存手段14により保存されている対戦開
始エントリを得て、ステップ211以降の対戦処理を開
始する。
If the result of the determination in step 205 is that the key is not an equivalent key, it is determined in step 208 which record has been won, and if the record of the winning record entry 13 (the current input record) has been won,
In step 209, 1 is added to the string number of the current input record, as is well known as a tournament replacement method. Then, in step 210, the battle start entry stored by the battle result storage means 14 is obtained, and the battle process from step 211 onward is started.

【0058】以上が、トーナメント置換方式を用いた対
戦手段2の処理手順の詳細であり、次にその理解を容易
にするために、実際の入力データを使用して対戦手段2
の処理の流れを再度説明する。
The above is the details of the processing procedure of the battle means 2 using the tournament replacement method. Next, in order to facilitate understanding thereof, actual battle data is used using the actual input data.
Will be described again.

【0059】図5乃至図9は、対戦手段2の処理の流れ
について、実際の入力データを使用して例示したものも
のである。各図において、501〜520は各ステップ
を示し、1つのステップが1回の対戦の状態を示すもの
であり、入力データは小文字の英字1文字で示し、下線
を引いた部分がカレント入力データである。また、△は
カレント入力データの対戦開始エントリ、↑は次の入力
データの対戦開始エントリを示し、太線は対戦の優勝者
の対戦経緯を示す。さらにトーナメントツリーの各ノー
ドにおける記号は、最初の1文字がストリング番号、2
文字目がキー、3文字目に”−”を付加した場合は、対
応する対戦管理テーブル10の同値キーフラグがONで
あることを示す。但し、ストリングのデータに”−”を
付加した場合は付加データとしての同値キーフラグがO
Nであること示す。また、( )で囲んである場合は、そ
のノードにおける対戦で勝者となったことを示し、実際
のエントリは上位のノードにあることを意味する。な
お、ソートは昇順で行われるものと仮定している。
FIGS. 5 to 9 illustrate the processing flow of the battle means 2 using actual input data. In each figure, 501 to 520 indicate each step, one step indicates the state of one battle, input data is indicated by one lowercase alphabetic character, and the underlined portion is the current input data. is there. In addition, △ indicates the match start entry of the current input data, ↑ indicates the match start entry of the next input data, and the bold line indicates the history of the match winner. Furthermore, the symbol at each node of the tournament tree is such that the first character is a string number, 2
When the character is a key and the third character is “-”, it indicates that the equivalent key flag of the corresponding battle management table 10 is ON. However, when "-" is added to the string data, the equivalent key flag as additional data is set to O.
N. In addition, when enclosed in parentheses (), it indicates that the player has won the battle in that node, and that the actual entry is in the upper node. It is assumed that sorting is performed in ascending order.

【0060】以下処理を順に追って説明していく。処理
は大きくわけて3つに分けられる。最初の部分は図5の
ステップ501から504までで、トーナメントツリー
で示されるレコードエントリが満杯になるまでの処理、
つまり入力データとして、c,d,d,cの4つが処理
されるまでである。図2のフローチャートで言えば、ス
テップ203でYESと判定されるまでの処理である。
この部分では、入力レコードの対戦開始エントリは左か
ら順番に進められる。この段階における本発明の特徴に
関する処理はステップ504であり、図2のステップ2
14で同値キー(c)が検出されることにより、勝ち上
がりレコードエントリ13の同値キーがONにされてい
る。
The processing will be described below in order. Processing is roughly divided into three. The first part is steps 501 to 504 in FIG. 5, which are processing until the record entry indicated by the tournament tree becomes full.
That is, it is until four of c, d, d, and c are processed as input data. In the flowchart of FIG. 2, the processing is performed until YES is determined in step 203.
In this part, the match start entry of the input record is advanced in order from the left. The processing relating to the features of the present invention at this stage is step 504, and step 2 in FIG.
When the equivalent key (c) is detected at 14, the equivalent key of the winning record entry 13 is turned ON.

【0061】処理の第2の部分は、図6のステップ50
5から図8のステップ516までで、トーナメントツリ
ーで示されるレコードエントリが満杯になってから、入
力データが終了するまでの処理である。この部分では、
入力レコードの対戦開始エントリは、前回の対戦での優
勝者の対戦開始エントリとなる。またストリング番号の
決定はトーナメント置換方式の手順として知られている
ように以下のように行う。即ち、レコード入力時に入力
レコードと前回の優勝者(各ステップで一番右上に記し
たレコード。例えばステップ505で言えば1c−)を
対戦させ(図2のステップ204)、入力レコードが勝
ったならば、入力レコードのストリング番号を1増し、
以降の対戦ではストリング番号の小さい方が、キーの大
小によらずに勝ちとなるようにする。今の例では、ステ
ップ506における入力データ(a)が前回の優勝者
(c)に勝ったため、aのストリング番号を2にしてい
る。またステップ515における入力データ(a)が前
回の優勝者(b)に勝ったため、aのストリング番号を
3にしている。また、優勝者のストリング番号が切り替
わった時点で、出力するストリングの切り換えを行う。
今の例では、ステップ512で優勝者のストリング番号
が1から2に切り替わったので、出力するストリングを
今までのストリング1からストリング2に切り替えてい
る。なお、図9のステップ518でも、優勝者のストリ
ング番号が2から3に切り替わったので、出力するスト
リングを今までのストリング2からストリング3に切り
替えている。
The second part of the process consists of step 50 in FIG.
The processing from step 5 to step 516 in FIG. 8 is performed from when the record entry indicated by the tournament tree becomes full until the input data ends. In this part,
The match start entry of the input record is the match start entry of the winner in the previous match. The determination of the string number is performed as follows, as is known as a tournament replacement system procedure. That is, at the time of record input, the input record and the previous winner (the record described at the top right in each step; for example, 1c- in step 505) are played (step 204 in FIG. 2). For example, increment the string number of the input record by 1,
In subsequent matches, the smaller string number wins regardless of the size of the key. In this example, the string number of a is set to 2 because the input data (a) in step 506 has won the previous winner (c). Since the input data (a) in step 515 has won the previous winner (b), the string number of a is set to 3. When the string number of the winner changes, the output string is switched.
In this example, since the string number of the winner has been switched from 1 to 2 in step 512, the string to be output is switched from string 1 to string 2 so far. At step 518 in FIG. 9 as well, the string number of the winner has been switched from 2 to 3, so that the string to be output is switched from string 2 to string 3 so far.

【0062】この第2の部分における同値キーフラグの
扱いは第1の部分と同様であり、今の例では、ステップ
506,509,510,511,513,514にお
ける対戦で同値キーを検出している。特にステップ50
9では、入力レコードと前回の優勝者が同値キー(e)
であるため、実際にはトーナメントによる対戦はスキッ
プして、入力レコードをそのまま優勝者と決定してお
り、前回の優勝者の同値キーフラグをONに変更して出
力している。同様に、ステップ514でも、入力レコー
ドと前回の優勝者が同値キー(b)であり、トーナメン
トによる対戦はスキップして、入力レコードをそのまま
優勝者と決定している。
The handling of the equivalent key flag in the second part is the same as that in the first part. In this example, the equivalent key is detected in the battle in steps 506, 509, 510, 511, 513, and 514. . Especially step 50
In 9, the input record and the previous winner are the same key (e)
Therefore, the battle in the tournament is actually skipped, the input record is determined as it is as the winner, and the equivalent key flag of the previous winner is changed to ON and output. Similarly, in step 514, the input record and the previous winner are the same value key (b), the match in the tournament is skipped, and the input record is determined as the winner as it is.

【0063】第3の部分は図9のスキップ517以降
で、入力レコードが終了してから、残っているレコード
を順次追い出していく処理である。本例では、残ってい
るレコードを順次追い出していくために、ダミーレコー
ド(図中の”Z”で示す)を対戦に参加させ、通常のレ
コードとダミーレコードとの対戦では必ず通常のレコー
ドの勝ちと決定するように定めている。そして、対戦を
行っていき、ダミーレコードが優勝者となった時点で処
理は終了する。
The third part is a process after skip 517 in FIG. 9 where the remaining records are sequentially expelled after the input record is completed. In this example, in order to sequentially drive out the remaining records, a dummy record (indicated by "Z" in the figure) is participated in the match, and in the match between the normal record and the dummy record, the normal record always wins. It is determined to be determined. Then, the battle is performed, and the process ends when the dummy record becomes the winner.

【0064】以上、トーナメント置換方式を用いた対戦
手段2の処理手順について説明した。トーナメント置換
方式を用いたマージ対戦手段5の処理手順についても全
く同様であり、上述の説明において、対戦手段2をマー
ジ対戦手段5に、対戦管理テーブル10をマージ対戦管
理テーブル12に、プリソート用レコードエリア9をマ
ージ対戦用レコードエリア11に、それぞれ読み換えれ
ば、トーナメント置換方式を用いたマージ対戦手段5の
処理手順の詳細は容易に理解されるであろう。
The processing procedure of the battle means 2 using the tournament replacement method has been described above. The same applies to the processing procedure of the merge battle means 5 using the tournament replacement method. In the above description, the battle means 2 is replaced with the merge battle means 5, the battle management table 10 is stored in the merge battle management table 12, the presort record is stored. If the area 9 is replaced with the merge competition record area 11, the details of the processing procedure of the merge competition means 5 using the tournament replacement method will be easily understood.

【0065】次に、バイナリインサーション方式を用い
た対戦手段2の処理手順の詳細ついて説明する。
Next, the processing procedure of the battle means 2 using the binary insertion method will be described in detail.

【0066】周知のように、バイナリインサーション方
式は、ソート済みのレコード列と、そのレコード列に挿
入したいレコードとが与えられたときに、レコード列を
半分ずつの2つのグループに分割し、分割した境界に位
置するレコードと、挿入するレコードとを対戦させるこ
とにより、挿入するレコードがどちらのグループに属す
るかを判定し、以下同様に、レコード列を半分ずつに区
切って、属するグループを特定する処理を、分割したグ
ループのレコード数が1になるまで繰り返して挿入位置
を決定する(但し、レコードの対戦で同値キーとなった
場合は、その時点で挿入位置が決定する)方式である。
As is well known, the binary insertion method divides a record sequence into two groups of two halves when given a sorted record sequence and a record to be inserted into the record sequence. By determining which group the record to be inserted belongs to by comparing the record located at the boundary with the inserted record and the record to be inserted, the record sequence is similarly divided into halves to identify the group to which the record belongs. The processing is repeated until the number of records in the divided group becomes one, and the insertion position is determined (however, if an equivalent key is used in a record competition, the insertion position is determined at that time).

【0067】バイナリインサーション方式を適用する場
合、図1の実施例のソート処理においては、プリソート
用レコードエリア9に読み込み済みで且つ既にソート済
みのレコード群(これらは対戦管理テーブル10により
管理され、対戦管理テーブル10のエントリはキー順に
線形に並んでいる)と、新たに読み込んだレコードとを
対戦させ、挿入位置を決定する処理を繰り返していき、
最上位に位置付けられたレコードを、ストリングとして
ソートワークファイル7へ順次出力していく方法で処理
が進められる。
When the binary insertion method is applied, in the sorting process of the embodiment of FIG. 1, a group of records that have been read into the presort record area 9 and have already been sorted (these are managed by the battle management table 10; The entries of the battle management table 10 are arranged linearly in key order), and the newly read record is played, and the process of determining the insertion position is repeated.
The process proceeds by a method of sequentially outputting the record positioned at the highest position as a string to the sort work file 7.

【0068】以下、図3を参照して、対戦管理テーブル
10により管理されたソート済みのレコード群に、新た
に読み込んだレコードを挿入する処理手順の詳細を説明
する。
The details of the processing procedure for inserting a newly read record into the sorted record group managed by the battle management table 10 will be described below with reference to FIG.

【0069】対戦手段2は、まずステップ301にて、
対戦管理テーブル10で管理されるレコード群を、比較
対象レコード群(挿入するレコードが属するレコード
群)と設定し、ステップ302では、挿入するレコード
の対戦管理テーブル10のエントリの同値キーフラグを
OFFに初期設定する。
First, in step 301, the competition means 2
The record group managed in the battle management table 10 is set as a comparison target record group (record group to which the record to be inserted belongs), and in step 302, the equivalent key flag of the entry of the battle management table 10 of the record to be inserted is initialized to OFF. Set.

【0070】次に、ステップ303では、比較対象レコ
ード群を、キーの大小で2つのグループに分割する。な
お、以下の説明において、分割した上位グループとは、
キーの順序で先に出力すべきグループを意味し、同様に
下位グループとは、キーの順序で後から出力すべきグル
ープを意味するものとする。またステップ303の処理
において、比較対象グループの要素数が1である場合
は、便宜上下位グループに入れ、上位グループは空集合
とする。
Next, in step 303, the record group to be compared is divided into two groups according to the size of the key. In the following description, the divided upper group is
In the order of keys, a group to be output first is meant, and similarly, a lower group means a group to be output later in the order of keys. In the process of step 303, when the number of elements of the comparison target group is 1, it is put into a lower group for convenience, and the upper group is an empty set.

【0071】ステップ304では、挿入するレコード
と、ステップ303で分割した下位グループ内の最上位
(キー順で最初に出力すべき)レコードとのキーを比較
し、ステップ305では、キー比較の結果、同値キーで
あったか否かを判定する。
At step 304, the key of the record to be inserted is compared with the key of the highest-order record (to be output first in key order) in the lower group divided at step 303. At step 305, the result of the key comparison is It is determined whether the key is the same key.

【0072】判定の結果、同値キーならば、ステップ3
06で、挿入するレコードの同値キーフラグをONに設
定し、ステップ307では、下位グループの最上位レコ
ードの直前に、挿入するレコードの対戦管理テーブル1
0のエントリを挿入して処理を終了する。
If the result of determination is that the key is an equivalent key, step 3
In step 06, the equivalent key flag of the record to be inserted is set to ON, and in step 307, the match management table 1 for the record to be inserted immediately before the top record of the lower group.
The processing is terminated after the entry of 0 is inserted.

【0073】他方、ステップ305の判定の結果、同値
キーでなければ、ステップ308において、どちらのレ
コードが勝ち(キー順で先に出力すべき)かを判定す
る。
On the other hand, if the result of determination in step 305 is that it is not an equivalent key, in step 308 it is determined which record has won (to be output first in key order).

【0074】ステップ308の判定の結果、挿入するレ
コードの勝ちであれば、ステップ309で、下位グルー
プの要素数をチェックし、要素数が1であれば、ステッ
プ310において、下位グループの(唯一の)レコード
の直前に、挿入するレコードの対戦管理テーブル10の
エントリを挿入して、今回の処理を終了し、要素数が2
以上ならば、ステップ311において、上位グループを
新たな比較対象グループとして設定して、ステップ30
3に戻り、比較を続行する。
If the result of determination in step 308 is that the record to be inserted wins, the number of elements in the lower group is checked in step 309, and if the number of elements is 1, in step 310 the (only ) Just before the record, the entry of the match management table 10 of the record to be inserted is inserted, and the current processing ends, and the number of elements is 2
If so, in step 311, the upper group is set as a new comparison target group, and
Return to 3 and continue the comparison.

【0075】また、ステップ308の判定の結果、比較
した相手(下位グループの最上位レコード)が勝ちであ
れば、ステップ312で、下位グループの要素数をチェ
ックし、要素数が1であれば、ステップ313におい
て、下位グループの(唯一の)レコードの直後に、挿入
するレコードの対戦管理テーブル10のエントリを挿入
して、今回の処理を終了し、要素数が2以上ならば、ス
テップ314において、下位グループを新たな比較対象
グループとして設定して、ステップ303に戻り、比較
を続行する。
If the result of the determination in step 308 indicates that the compared partner (the highest-order record in the lower group) has won, the number of elements in the lower group is checked in step 312; In step 313, an entry of the match management table 10 of the record to be inserted is inserted immediately after the (single) record of the lower group, and the current processing ends. If the number of elements is 2 or more, in step 314, The lower group is set as a new comparison target group, the process returns to step 303, and the comparison is continued.

【0076】以上がバイナリインサーション方式を用い
た対戦手段2の処理手順の詳細である。なお、バイナリ
インサーション方式を用いたマージ対戦手段5について
も全く同様であり、上述の説明において、対戦手段2を
マージ対戦手段5に、対戦管理テーブル10をマージ対
戦管理テーブル12に、プリソート用レコードエリア9
をマージ対戦用レコードエリア11に、それぞれ読み換
えれば、バイナリインサーション方式を用いたマージ対
戦手段5の処理手順の詳細は容易に理解されるであろ
う。
The above is the details of the processing procedure of the battle means 2 using the binary insertion method. It is to be noted that the same applies to the merge match means 5 using the binary insertion method. In the above description, the match means 2 is set to the merge match means 5, the match management table 10 is set to the merge match management table 12, the presort record is set. Area 9
Into the merge battle record area 11, the details of the processing procedure of the merge battle means 5 using the binary insertion method will be easily understood.

【0077】次に、マージ手段4における1回のマージ
処理の処理手順の詳細について、図4を参照して説明す
る。なお、以下では、ソートワークファイル7内のスト
リングをマージして、新たなストリングとして再度ソー
トワークファイル7に書き込む場合(即ち最終マージで
ない場合)の処理について説明する。
Next, the details of the procedure of one merge process in the merge means 4 will be described with reference to FIG. In the following, a description will be given of a case where the strings in the sort work file 7 are merged and written again as a new string in the sort work file 7 (that is, when the merge is not the final merge).

【0078】マージ手段4は、まずステップ401にお
いて、マージする各ストリングの先頭レコードを、マー
ジ対戦用レコードエリア11に読み込みながら、マージ
対戦手段5による対戦を行っていく。このとき、プリソ
ート処理において既に制御データとしてレコードに付加
されている同値キーフラグも、レコードイメージと同時
にマージ対戦用レコードエリア11に読み込む。ここ
で、マージ対戦用レコードエリア11に読み込んだ同値
キーフラグと、マージ対戦管理テーブル12の同値キー
フラグとは別のものであることに注意されたい。また、
プリソート時と同様に、レコードを対戦に参加させる際
には、該当レコードのマージ対戦管理テーブル12の同
値キーフラグはOFFに設定する。
First, in step 401, the merging means 4 competes with the merging means 5 while reading the first record of each string to be merged into the merging record area 11. At this time, the equivalent key flag already added to the record as control data in the presort processing is also read into the merge battle record area 11 at the same time as the record image. Here, it should be noted that the equivalent key flag read into the merge battle record area 11 is different from the equivalent key flag in the merge battle management table 12. Also,
As with pre-sorting, when a record is to participate in a match, the equivalent key flag in the merged match management table 12 of the record is set to OFF.

【0079】次に、ステップ402では、対戦の優勝者
を出力レコードと決定する。即ち、全ストリングの先頭
レコードを読み終わった時点での優勝者を最初に出力す
べきレコードとする。
Next, in step 402, the winner of the battle is determined as the output record. That is, the winner at the time when the first record of all strings has been read is set as the record to be output first.

【0080】ステップ403では、出力レコードに付加
されている同値キーフラグがONであるか否かをチェッ
クし、ONであれば、ステップ404で、出力レコード
をソートファイル7へ出力(付加されている同値キーフ
ラグもそのまま付加して出力する)し、ステップ405
で、出力レコードの属するストリングから次のレコード
(これは先に出力したレコードと同値キーを持つレコー
ドである)を読み込み、新たな出力レコードに決定し
て、ステップ403に戻る。
At step 403, it is checked whether or not the equivalent key flag added to the output record is ON. If it is ON, at step 404, the output record is output to the sort file 7 (added equivalent value). The key flag is added as it is and output), and step 405 is performed.
Then, the next record (this is a record having the same key as the previously output record) is read from the string to which the output record belongs, a new output record is determined, and the process returns to step 403.

【0081】ステップ403〜405の処理を、同値キ
ーフラグがOFFのレコードを読み込むまで繰り返した
後、ステップ406に移行する。
After the processes of steps 403 to 405 are repeated until a record whose equivalence key flag is OFF is read, the process proceeds to step 406.

【0082】ステップ406では、直前の対戦での優勝
者の、マージ対戦管理テーブル12のエントリの同値キ
ーフラグをチェックし、ONであれば、マージ時の対戦
で新たに同値キーレコードが見つかったということなの
で、ステップ407において、出力レコードとそれに付
加する同値キーフラグ(ONに設定)とを、ソートワー
クファイル7へ出力する。他方、チェックの結果、同値
キーフラグがOFFであれば、ステップ408におい
て、出力レコードとそれに付加する同値キーフラグ(O
FFに設定)とを、ソートワークファイル7へ出力す
る。
At step 406, the equivalent key flag of the entry in the merged battle management table 12 of the winner of the immediately preceding battle is checked. If the flag is ON, a new equivalent key record is found in the battle at the time of the merge. Therefore, in step 407, the output record and the equivalent key flag (set to ON) added thereto are output to the sort work file 7. On the other hand, as a result of the check, if the equivalent key flag is OFF, in step 408, the output record and the equivalent key flag (O
Is output to the sort work file 7).

【0083】出力レコードをソートワークファイル7へ
出力した後、ステップ409において、出力レコードの
属するストリングから次のレコードを読み込み、ステッ
プ410では、読み込みの結果、出力レコードが属する
ストリングのレコードが終了していたか否かを判定す
る。
After the output record is output to the sort work file 7, at step 409, the next record is read from the string to which the output record belongs. At step 410, as a result of the reading, the record of the string to which the output record belongs is completed. Is determined.

【0084】出力レコードが属するストリングのレコー
ドが終了していたならば、ステップ411で、マージ対
戦用レコードエリア11内のレコードで、まだ出力して
いないレコードが残っているか否かを判定し、残ってい
なければ処理(1回のマージ処理)を終了し、残ってい
れば、ステップ412にて、残っているレコードで対戦
を行って新たな優勝者を決定し、ステップ402に戻
り、処理を続行する。
If the record of the string to which the output record belongs has been completed, it is determined in step 411 whether or not there is a record in the merge competition record area 11 that has not been output yet. If not, the process (one merge process) is terminated. If there is any remaining, in step 412, a match is performed with the remaining records to determine a new winner, and the process returns to step 402 to continue the process. I do.

【0085】ステップ410の判定の結果、出力レコー
ドが属するストリングのレコードが終了していなけれ
ば、即ちステップ409で次のレコードが読み込まれた
ならば、ステップ413にて、読み込んだレコードを対
戦に参加させて新たな優勝者を決定し、ステップ402
に戻って処理を続行する。
If the result of determination in step 410 is that the record of the string to which the output record belongs has not been completed, that is, if the next record has been read in step 409, the read record participates in the match in step 413. To determine a new winner, step 402
Return to and continue the processing.

【0086】以上がマージ手段4における1回のマージ
処理の手順の詳細であるが、より理解を容易にするため
に、実際の入力データを使用して更に説明する。
The above is the details of the procedure of a single merge process in the merge means 4, but in order to make it easier to understand, further description will be made using actual input data.

【0087】図10および図11は、マージ手段4にお
ける1回のマージ処理の流れについて、実際の入力デー
タを使用して例示したものである。この例では3本のス
トリング1〜3をマージして、再度ソートワークファイ
ル7へ出力する例である。各図において、601〜61
1は各ステップを示し、1つのステップが1回の対戦の
状態を示すものであり、入力データは小文字の英字1文
字で示す。各ストリングのデータは、その時点でメモリ
に読み込まれている(最左端のデータ)か、または、こ
れから読み込むデータを示しており、出力済みのデータ
については記述していない。また、図5〜図9と同様
に、”−”は同値キーフラグを示し、ストリングのデー
タの後ろに”−”を付記した場合は、制御データとして
レコードに付加されている同値キーフラグがONである
ことを意味し、対戦の勝者に”−”を付記した場合は、
対戦の勝者レコードの、マージ対戦管理テーブル12の
同値キーフラグがONであることを意味する。なお、対
戦はトーナメント置換方式により行うものと仮定してい
る。
FIGS. 10 and 11 show an example of the flow of a single merge process in the merge means 4 using actual input data. In this example, three strings 1 to 3 are merged and output to the sort work file 7 again. In each figure, 601 to 61
1 indicates each step, and one step indicates the state of one battle, and the input data is represented by one lowercase alphabetic character. The data of each string indicates the data that has been read into the memory (the leftmost data) at that time or the data to be read from now on, and does not describe the data that has already been output. Similarly to FIGS. 5 to 9, "-" indicates an equivalent key flag, and when "-" is added after the string data, the equivalent key flag added to the record as control data is ON. Means that the winner of the match is marked with a "-"
This means that the equivalent key flag of the merged battle management table 12 of the battle winner record is ON. It is assumed that the match is performed by the tournament replacement method.

【0088】以下処理の順を追って説明していく。ステ
ップ601では、ストリングの先頭レコードの対戦を行
う。本例では、同値キーの場合、ストリング番号が小さ
い方を勝者とするので、この対戦の結果の優勝者は、ス
トリング2に所属するレコードaであり、優勝者のレコ
ードaの同値キーフラグはマージ対戦手段5によってO
Nにされている(図2のステップ215相当の処理によ
る)ため、図4のステップ403の結果はYESとな
り、出力レコードaに付加する同値キーフラグもONと
なる。
The processing will be described below in order. In step 601, a match is made for the first record of the string. In this example, in the case of an equivalence key, the winner of the match is the record a belonging to string 2 because the smaller string number is the winner, and the equivalence key flag of the winner record a is the merge match. O by means 5
Since it is set to N (by the process corresponding to step 215 in FIG. 2), the result of step 403 in FIG. 4 is YES, and the equivalent key flag added to the output record a is also turned ON.

【0089】ステップ602では、ステップ601での
優勝者の属するストリング2から次のレコードbを読み
込んで対戦を行い、ストリング3に所属するレコードa
が優勝者となり、出力される。このとき、対戦相手は同
値キーでなかったので、図4のステップ403の判定結
果はNOとなり、且つ、優勝者レコードbに対応するマ
ージ対戦管理テーブル12の同値キーフラグはOFFな
ので、図4のステップ406の判定結果はNOとなり、
その結果、出力レコードaの同値キーフラグはOFFの
ままである。
At step 602, the next record b is read from the string 2 to which the winner of step 601 belongs, and a match is made.
Becomes the winner and is output. At this time, since the opponent was not the equivalent key, the determination result in step 403 of FIG. 4 is NO, and the equivalent key flag of the merged competition management table 12 corresponding to the winner record b is OFF, so that the step of FIG. The determination result at 406 is NO,
As a result, the equivalent key flag of the output record a remains OFF.

【0090】ステップ603では、ステップ602での
優勝者の属するストリング3から次のレコードを読み込
み(図4のステップ409)、対戦を行い、ストリング
2に所属するレコードbが優勝者となり、出力される。
In step 603, the next record is read from the string 3 to which the winner in step 602 belongs (step 409 in FIG. 4), a match is made, and the record b belonging to string 2 becomes the winner and is output. .

【0091】ステップ604では、ステップ603での
優勝者の属するストリング2から次のレコードcを読み
込んで対戦を行い、ストリング3に所属するレコードb
が優勝者となり、出力される。
At step 604, the next record c is read from the string 2 to which the winner of step 603 belongs, and a match is made.
Becomes the winner and is output.

【0092】ストリング605では、ストリング604
での優勝者の属するストリング3から次のレコードを読
み込むが、ストリング3内のレコードが終了しているた
め、ストリング1と2のレコードで対戦を行い、ストリ
ング1に所属するレコードcが優勝者となり、出力され
る。このとき、出力レコードcに付加されている同値キ
ーフラグがONであるため、後続の同値キーレコードc
も対戦させることなく直ちに出力する。さらに、マージ
対戦管理テーブル12の該当同値キーフラグもON(ス
トリング2のレコードcと同値キーであったため)であ
るため、後続の同値キーレコードcに付加する同値キー
フラグをONにして出力する。
In the string 605, the string 604
The next record is read from the string 3 to which the winner belongs, but since the record in the string 3 has been completed, a match is played between the records of the strings 1 and 2, and the record c belonging to the string 1 becomes the winner. Is output. At this time, since the equivalence key flag added to the output record c is ON, the subsequent equivalence key record c
Is also output immediately without a match. Further, since the corresponding equivalence key flag in the merge battle management table 12 is also ON (because the key is the same as the record c of the string 2), the equivalent key flag to be added to the subsequent equivalence key record c is turned ON and output.

【0093】ステップ606では、ステップ605での
優勝者の属するストリング1から次のレコードdを読み
込んで対戦を行い、ストリング2に所属するレコードc
が優勝者となり、出力される。このとき、出力レコード
cに付加されている同値キーフラグがONであり、後続
に2個の同値キーレコードcが存在するため、それらの
同値キーレコードも対戦させることなく直ちに出力す
る。
In step 606, the next record d is read from the string 1 to which the winner in step 605 belongs, and a match is made.
Becomes the winner and is output. At this time, since the equivalence key flag added to the output record c is ON, and there are two subsequent equivalence key records c, those equivalence key records are also output immediately without being played.

【0094】以上のようにして、ストリング1における
2個の連続する同値キーレコード(c−c)と、ストリ
ング2における3個の連続する同値キーレコード(c−
c−c)とがマージされて、5個の連続する同値キーレ
コード(c−c−c−c−c)にまとめられる。
As described above, two consecutive equivalent key records (c-c) in string 1 and three consecutive equivalent key records (c-c) in string 2
cc) are merged into five consecutive equivalent key records (cccccc).

【0095】以下、ステップ607以降についても同様
である。
The same applies to step 607 and subsequent steps.

【0096】[0096]

【発明の効果】以上説明したように、本発明は、プリソ
ートフェーズにおいて、各ストリングに出力するレコー
ドに、当該レコードの後続のレコードが同値キーレコー
ドであるか否かを示す同値キーフラグを付加し、マージ
フェーズにおいて、対戦の優勝者レコードをストリング
に出力した後、その優勝者レコードの属するストリング
から次のレコードを得たときに、前記出力した優勝者レ
コードに付加されていた同値キーフラグをチェックし、
該同値キーフラグが後続のレコードが同値キーレコード
であるこを示すときは、前記取得した次のレコードは対
戦に参加させることなくそのままストリングに出力する
ようにしたので、マージフェーズにおける同値キーレコ
ード同士の対戦が極力抑えられ、同値キーレコードの削
除を行う従来技術の場合と同様にキー比較回数を削減す
ることができ、しかも、従来技術のように出力時に(ソ
ート時にカウントした)同値キーレコード数分だけレコ
ードを複写したり、キー情報を元にレコードイメージを
復元したりする処理を行う必要もないので、その分、ソ
ート処理時間を短縮することができる効果がある。
As described above, according to the present invention, in the presort phase, an equivalent key flag indicating whether or not a record subsequent to the record is an equivalent key record is added to a record to be output to each string. In the merge phase, after outputting the winner record of the match as a string, when the next record is obtained from the string to which the winner record belongs, the equivalent key flag added to the output winner record is checked. ,
When the equivalence key flag indicates that the subsequent record is an equivalence key record, the acquired next record is output as it is to the string without participating in the competition, so that the competition between the equivalence key records in the merge phase is performed. Is reduced as much as possible, and the number of key comparisons can be reduced in the same manner as in the prior art in which equivalent key records are deleted. In addition, as in the prior art, only the number of equivalent key records at the time of output (counted during sorting) is used. There is no need to copy the records or restore the record image based on the key information, so that the sorting processing time can be shortened accordingly.

【0097】また、マージフェーズにおいて、最終マー
ジ以外の場合のストリングにレコードを出力する際、プ
リソートフェーズにおける場合と同様に、当該レコード
の後続のレコードが同値キーレコードであるか否かを示
す同値キーフラグを付加したことにより、これらのスト
リングのマージ時に前述と同様の原理でキー比較回数を
減らすことができる。
Also, in the merge phase, when a record is output to a string other than the final merge, as in the presort phase, an equivalent value indicating whether the record subsequent to the record is an equivalent key record is used. By adding the key flag, the number of key comparisons can be reduced by the same principle as described above when these strings are merged.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の一実施例のブロック図である。FIG. 1 is a block diagram of one embodiment of the present invention.

【図2】トーナメント置換方式を用いた対戦手段の処理
手順を示すフローチャートである。
FIG. 2 is a flowchart showing a processing procedure of a battle means using a tournament replacement method.

【図3】バイナリインサーション方式を用いた対戦手段
の処理手順を示すフローチャートである。
FIG. 3 is a flowchart showing a processing procedure of a battle means using a binary insertion method.

【図4】マージ手段における1回のマージ処理の手順を
示すフローチャートである。
FIG. 4 is a flowchart showing a procedure of a single merge process in a merge unit.

【図5】対戦手段の処理の流れについて実際の入力デー
タを使用して例示した図である。
FIG. 5 is a diagram exemplifying a processing flow of a battle means using actual input data.

【図6】対戦手段の処理の流れについて実際の入力デー
タを使用して例示した図である。
FIG. 6 is a diagram exemplifying a processing flow of a battle means using actual input data.

【図7】対戦手段の処理の流れについて実際の入力デー
タを使用して例示した図である。
FIG. 7 is a diagram exemplifying a processing flow of a battle means using actual input data.

【図8】対戦手段の処理の流れについて実際の入力デー
タを使用して例示した図である。
FIG. 8 is a diagram exemplifying a processing flow of a battle means using actual input data.

【図9】対戦手段の処理の流れについて実際の入力デー
タを使用して例示した図である。
FIG. 9 is a diagram exemplifying a processing flow of a battle means using actual input data.

【図10】マージ手段における1回のマージ処理の流れ
について実際の入力データを使用して例示した図であ
る。
FIG. 10 is a diagram exemplifying a flow of one merge process in a merge unit using actual input data.

【図11】マージ手段における1回のマージ処理の流れ
について実際の入力データを使用して例示した図であ
る。
FIG. 11 is a diagram exemplifying a flow of a single merge process in a merge unit using actual input data.

【符号の説明】[Explanation of symbols]

1…プリソート手段 2…対戦手段 3…キー比較手段 4…マージ手段 5…マージ対戦手段 6…入力データ 7…ソートワークファイル 8…出力データ 9…プリソート用レコードエリア 10…対戦管理テーブル 11…マージ対戦用レコードエリア 12…マージ対戦管理テーブル 13…勝ち上がりレコードエントリ 14…対戦結果保存手段 DESCRIPTION OF SYMBOLS 1 ... Presort means 2 ... Competition means 3 ... Key comparison means 4 ... Merge means 5 ... Merge competition means 6 ... Input data 7 ... Sort work file 8 ... Output data 9 ... Presort record area 10 ... Competition management table 11 ... Merge competition Record area 12: Merge battle management table 13: Winning record entry 14: Battle result storage means

Claims (7)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 メモリに入り切らない大量のレコード
を、プリソートフェーズとマージフェーズとに分けてソ
ートする方式において、 ソート対象レコードを格納するプリソート用レコードエ
リアと、 該プリソート用レコードエリアに格納されたソート対象
レコードのレコードポインタおよび同値キーフラグを、
各レコード対応に格納する対戦管理テーブルと、 キー比較手段と、 対戦に参加している各レコードの前記プリソート用レコ
ードエリア内アドレスであるレコードポインタとOFF
状態に初期化した同値キーフラグとを前記対戦管理テー
ブルに設定し、前記キー比較手段を用いてレコードの対
戦を行って優勝者レコードを決定すると共に、同値キー
レコード同士の対戦があった場合には、その何れか一方
を勝者にしてその勝者に対応する前記対戦管理テーブル
の同値キーフラグをONにする対戦手段と、 外部より入力されたソート対象レコードを1件ずつ前記
プリソート用レコードエリアへ読み込みながら前記対戦
手段を呼び出して、前記読み込んだレコードを、前記プ
リソート用レコードエリア内に既に存在するレコード群
と対戦させ、前記対戦手段が決定した対戦の優勝者レコ
ードを、そのレコードに対応する前記対戦管理テーブル
の同値キーフラグを付加して、前記ソートワークファイ
ルへ順次出力していくことにより、ソート中間結果とし
てストリングと呼ぶ順序付けられたレコード列を作成す
るプリソート手段と、 マージ対戦対象のレコードをそれに付加された同値キー
フラグとともに格納するマージ対戦用レコードエリア
と、 マージ対戦対象のレコードの前記マージ対戦用レコード
エリア内アドレスであるレコードポインタおよび同値キ
ーフラグを、各レコード対応に格納するマージ対戦管理
テーブルと、 マージ対戦に参加している各レコードの前記マージ対戦
用レコードエリア内アドレスであるレコードポインタと
OFF状態に初期化した同値キーフラグとを前記マージ
対戦管理テーブルに設定し、前記キー比較手段を用いて
レコードの対戦を行って優勝者レコードを決定すると共
に、同値キーレコード同士の対戦があった場合には、そ
の何れか一方を勝者にしてその勝者に対応する前記マー
ジ対戦管理テーブルの同値キーフラグをONにするマー
ジ対戦手段と、 前記ソートワークファイル内の複数のストリングを繰り
返しマージしていって1本のストリングにまとめるソー
ト処理を制御する手段であって、幾つかのストリングか
ら1本のストリングを生成する1回のマージ処理におい
て、今回のマージ対象のストリングの先頭レコードを順
次前記マージ対戦用レコードエリアに読み込んで前記マ
ージ対戦手段を呼び出してレコードの対戦を行わせ、前
記マージ対戦手段が優勝者レコードを決定したとき、そ
の優勝者レコードを出力レコードと決定して、該決定し
た出力レコードに付加されている同値キーフラグを参照
し、 出力レコードに付加されている同値キーフラグがONで
あれば、その出力レコードをそれに元々付加されていた
同値キーフラグを付加してストリングに出力し且つその
出力レコードの属するストリングから読み込んだ次のレ
コードを対戦に参加させることなく出力レコードに決定
する処理を、付加されている同値キーフラグがOFFの
出力レコードを読み込むまで繰り返し、 出力レコードに付加されている同値キーフラグがOFF
であったとき、および、その同値キーフラグがONであ
って前記処理が行われて同値キーフラグがOFFの出力
レコードが読み込まれたときは、前記マージ対戦手段が
決定した優勝者レコードに対応する前記マージ対戦管理
テーブルの同値キーフラグを参照し、該同値キーフラグ
がONであれば、ONにした同値キーフラグを付加した
出力レコードをストリングに出力し、OFFであれば、
その出力レコードにOFFの同値キーフラグを付加して
ストリングに出力するマージ手段とを備えることを特徴
とする同値キーが存在するデータのソート方式。
1. A method for sorting a large number of records that cannot be stored in a memory into a presort phase and a merge phase, wherein a presort record area for storing records to be sorted and a presort record area for storing the records to be sorted are stored in the presort record area. The record pointer and the equivalent key flag of the sorted records
A match management table stored for each record, a key comparison unit, and a record pointer, which is an address in the presort record area of each record participating in the match, and OFF.
When an equivalent key flag initialized to a state is set in the match management table, a record match is performed using the key comparison means to determine a winner record, and when there is a match between equivalent key records, A competition means for setting one of them as a winner and turning on an equivalent key flag of the competition management table corresponding to the winner, and reading the sort target records inputted from the outside one by one into the pre-sort record area. The competition means is called, and the read record is played against a record group already existing in the pre-sorting record area, and the winner record of the battle determined by the competition means is stored in the battle management table corresponding to the record. To be output sequentially to the sort work file. Pre-sorting means for creating an ordered record sequence called a string as a sort intermediate result, a merge competition record area storing the merge competition target record together with the equivalent key flag added thereto, and a merge competition record record A record management table that stores a record pointer and an equivalent key flag that are addresses in a record area for merge competition, and a record pointer that is an address in the record area for merge competition of each record participating in the merge competition. And an equivalence key flag initialized to the OFF state are set in the merge competition management table, a record competition is performed using the key comparison means to determine a winner record, and there is a competition between equivalence key records. If any A merge battle means for turning on an equivalent key flag of the merge battle management table corresponding to the winner with one as a winner, and a sort in which a plurality of strings in the sort work file are repeatedly merged into one string Means for controlling processing, wherein in a single merge process for generating one string from several strings, the first record of the string to be merged this time is sequentially read into the merge competition record area, and When the match-up means determines a winner record, the match-up means is determined as an output record, and the equivalent key flag added to the determined output record is determined. Refer to, if the equivalence key flag added to the output record is ON For example, a process of outputting the output record to a string by adding an equivalent key flag originally added thereto, and determining the next record read from the string to which the output record belongs as an output record without participating in the match, Repeat until the output record with the attached equivalence key flag OFF is read, and the equivalence key flag attached to the output record is OFF
And when the equivalent key flag is ON and the above processing is performed and the output record with the equivalent key flag OFF is read, the merging corresponding to the winner record determined by the merging competition means is performed. With reference to the equivalence key flag in the battle management table, if the equivalence key flag is ON, an output record with the ON equivalence key flag added is output to a string.
And a merging means for adding an OFF equivalence key flag to the output record and outputting the result as a string.
【請求項2】 請求項記載の同値キーが存在するデー
タのソート方式において、 対戦で勝ち上がった方のレコードの情報を一時的に設定
しておくための作業領域である勝ち上がりレコードエン
トリを備え、 前記対戦手段はレコード対戦方式としてトーナメント置
換方式を用い、対戦は2進木構造で定義される対戦構造
の下位から上位に向けて勝ち抜き戦形式で行っていき、
対戦構造の各ノード毎に、前記対戦管理テーブルのエン
トリを対応させ、該エントリには対戦で負けた方のレコ
ードの情報を設定し、対戦の開始時には、読み込んだレ
コードの情報を前記勝ち上がりレコードエントリに設定
し、その後勝ち上がりレコードエントリのレコードと対
戦管理テーブルのレコード群とを、対戦構造に従って順
次対戦させていき、前記対戦管理テーブル側のレコード
が勝った場合は、前記勝ち上がりレコードエントリと対
戦管理テーブル側のレコードの対戦管理テーブルエント
リとを交換し、以下同様に対戦を続け、対戦終了時に、
前記勝ち上がりレコードエントリに設定されているレコ
ードを対戦の優勝者に決定し、更に、同値キーレコード
の対戦があった場合、前記勝ち上がりレコードエントリ
に設定されているレコードを勝者と決定し、前記勝ち上
がりレコードエントリの同値キーフラグをONに設定す
ることを特徴とする同値キーが存在するデータのソート
方式。
2. The data sorting method according to claim 1 , wherein the winning record entry which is a work area for temporarily setting information of a record which has won in the battle is set. The battle means uses a tournament replacement system as a record battle system, and battles are performed in a win-win battle format from the bottom to the top of the battle structure defined by a binary tree structure,
Each node of the battle structure is associated with an entry in the battle management table, and the entry is set with information on the record that has lost the battle. At the start of the battle, the information on the read record is replaced with the winning record. After that, the record of the winning record entry and the record group of the battle management table are successively battled in accordance with the battle structure. If the record on the battle management table side wins, the record of the winning record entry and Exchange the battle management table entry of the record on the battle management table side, continue the battle in the same manner, and at the end of the battle,
The record set in the winning record entry is determined to be the winner of the match, and if there is a match of the equivalent key record, the record set in the winning record entry is determined to be the winner. A sorting method for data having an equivalent key, wherein an equivalent key flag of a winning record entry is set to ON.
【請求項3】 請求項記載の同値キーが存在するデー
タのソート方式において、 前記対戦手段による対戦の優勝者,優勝者の同値キーフ
ラグ,次に入力したレコードの対戦開始エントリを含む
対戦情報を一時的に記憶しておくための対戦結果保存手
段を備え、 前記対戦手段は1回の対戦が終了して優勝者が決定した
時点で、前記対戦結果保存手段に対戦情報を保存すると
共に、対戦を行うにあたり、前記対戦結果保存手段に保
存されている前回の対戦での優勝者レコードと今回入力
されたレコードとのキーを比較し、同値キーでなけれ
ば、前記対戦結果保存手段に保存されている対戦開始エ
ントリからトーナメントの対戦を開始し、同値キーであ
れば、トーナメントの対戦はスキップし、入力されたレ
コードを直ちに今回の対戦の優勝者と決定すると共に、
前記対戦結果保存手段により保存されている前回の優勝
者の同値キーフラグの値を、今回の対戦の優勝者の同値
キーフラグとして引き継いだ後、前記対戦結果保存手段
により保存されている前回の優勝者の同値キーフラグは
ONに設定し、 前記プリソート手段は、前記対戦手段による1回の対戦
を行って優勝者を決定した時点で、前記対戦結果保存手
段により保存されている前回の対戦での優勝者およびそ
の同値キーフラグを出力することを特徴とする同値キー
が存在するデータのソート方式。
3. The data sorting method according to claim 2 , wherein the match information includes a winner of the match by the match means, an equal key flag of the winner, and a match start entry of the next input record. A battle result storage unit for temporarily storing the battle information, wherein the battle unit saves battle information in the battle result storage unit when a single battle is completed and a winner is determined; In performing the above, the key of the winner record of the previous match stored in the match result storage means and the key of the record input this time are compared, and if not the same key, the key is stored in the match result storage means. The tournament match starts with the match start entry, and if the key is the same, the tournament match will be skipped and the entered record will be immediately replaced with the winner of this match. Together with a constant,
After taking over the value of the equivalent key flag of the previous winner saved by the match result storage means as the equivalent key flag of the winner of the current match, the value of the previous winner saved by the match result storage means is taken over. The equivalence key flag is set to ON, and the presort unit determines the winner by performing one battle by the battle unit and determining the winner in the previous battle saved by the battle result storage unit. A method for sorting data having an equivalent key, wherein the equivalent key flag is output.
【請求項4】 請求項記載の同値キーが存在するデー
タのソート方式において、 前記マージ対戦手段による対戦で勝ち上がった方のレコ
ードの情報を一時的に設定しておくための作業領域であ
る勝ち上がりレコードエントリを備え、 前記マージ対戦手段はレコード対戦方式としてトーナメ
ント置換方式を用い、対戦は2進木構造で定義される対
戦構造の下位から上位に向けて勝ち抜き戦形式で行って
いき、対戦構造の各ノード毎に、前記マージ対戦管理テ
ーブルのエントリを対応させ、該エントリには対戦で負
けた方のレコードの情報を設定し、対戦の開始時には、
読み込んだレコードの情報を前記勝ち上がりレコードエ
ントリに設定し、その後勝ち上がりレコードエントリの
レコードとマージ対戦管理テーブルのレコード群とを、
対戦構造に従って順次対戦させていき、前記マージ対戦
管理テーブル側のレコードが勝った場合は、前記勝ち上
がりレコードエントリとマージ対戦管理テーブル側のレ
コードのマージ対戦管理テーブルエントリとを交換し、
以下同様に対戦を続け、対戦終了時に、前記勝ち上がり
レコードエントリに設定されているレコードを対戦の優
勝者に決定し、更に、同値キーレコードの対戦があった
場合、前記勝ち上がりレコードエントリに設定されてい
るレコードを勝者と決定し、前記勝ち上がりレコードエ
ントリの同値キーフラグをONに設定することを特徴と
する同値キーが存在するデータのソート方式。
4. A work area for temporarily setting information of a record which has been won in a battle by the merge battle means in the data sorting method according to claim 1 , wherein The merge match means uses a tournament replacement method as a record match method, and the match is performed in a win-win manner from the lower order to the upper position of the match structure defined by a binary tree structure. For each node of the structure, an entry in the merge match management table is made to correspond, and the information of the record that lost the match is set in the entry.
The information of the read record is set in the winning record entry, and thereafter, the record of the winning record entry and the record group of the merge battle management table are
Matches are sequentially made in accordance with the match structure, and when the record in the merge match management table wins, the winning record entry is exchanged with the merge match management table entry of the record in the merge match management table,
Thereafter, the match is continued in the same manner, and at the end of the match, the record set in the winning record entry is determined to be the winner of the match, and further, if there is a match of the same key record, the record is set in the winning record entry. A record in which an equivalent key is present, wherein the determined record is determined as a winner, and an equivalent key flag of the winning record entry is set to ON.
【請求項5】 請求項記載の同値キーが存在するデー
タのソート方式において、 前記マージ対戦手段による対戦の優勝者,優勝者の同値
キーフラグ,次に入力したレコードの対戦開始エントリ
を含む対戦情報を一時的に記憶しておくための対戦結果
保存手段を備え、 前記マージ対戦手段は1回の対戦が終了して優勝者が決
定した時点で、前記対戦結果保存手段に対戦情報を保存
すると共に、対戦を行うにあたり、前記対戦結果保存手
段に保存されている前回の対戦での優勝者レコードと今
回入力されたレコードとのキーを比較し、同値キーでな
ければ、前記対戦結果保存手段に保存されている対戦開
始エントリからトーナメントの対戦を開始し、同値キー
であれば、トーナメントの対戦はスキップし、入力され
たレコードを直ちに今回の対戦の優勝者と決定するとと
もに、前記対戦結果保存手段により保存されている前回
の優勝者の同値キーフラグの値を、今回の対戦の優勝者
の同値キーフラグとして引き継いだ後、前記対戦結果保
存手段により保存されている前回の優勝者の同値キーフ
ラグはONに設定し、 前記マージ手段は、前記マージ対戦手段による1回の対
戦を行って優勝者を決定した時点で、前記対戦結果保存
手段により保存されている前回の対戦での優勝者および
その同値キーフラグとを出力することを特徴とする同値
キーが存在するデータのソート方式。
5. A method for sorting data having an equivalent key according to claim 4 , wherein the competition information includes a winner of the competition by the merge competition means, an equivalent key flag of the winner, and a competition start entry of the next input record. And a merge result storing means for temporarily storing battle information in the battle result storing means at the time when one battle is completed and a winner is determined. In conducting the match, the key of the winner record of the previous match stored in the match result storing means and the key of the record input this time are compared, and if the key is not the same value key, the key is stored in the match result storing means. The tournament match is started from the match start entry specified, and if the key is the same, the tournament match is skipped and the entered record is immediately replaced with the current match. Is determined, and the value of the equivalency key flag of the previous winner saved by the competition result storage means is taken over as the equivalence key flag of the winner of the current competition, and then saved by the competition result storage means. The same-equivalent key flag of the previous winner is set to ON, and the merging means is stored by the battle result storing means at a point in time when a single battle is performed by the merged fighting means to determine a winner. A method for sorting data having an equivalent key, wherein a winner of the previous match and its equivalent key flag are output.
【請求項6】 請求項記載の同値キーが存在するデー
タのソート方式において、 前記対戦手段はレコード対戦方式としてバイナリインサ
ーション方式を用い、対戦は、前記プリソート用レコー
ドエリアに新たに読み込んだレコードを、既に読み込み
済みでキー順に並んでいるレコード群内のどの位置に挿
入すべきかを、バイナリインサーション方式により決定
して、決定した位置にレコードを挿入する方式で行い、
且つ、 挿入位置の決定は、レコード群を半分ずつの2つのグル
ープに分割し、分割した境界に位置するレコードと、挿
入するレコードとを対戦させることにより、挿入するレ
コードがどちらのグループに属するかを判定することで
行い、且つ、挿入するレコードとの対戦相手は、分割し
た下位のグループの最上位レコードを採用し、同値キー
レコードの対戦においては、挿入するレコードの方を勝
ちとし、挿入するレコードに対応する前記対戦管理テー
ブルの同値キーフラグをONにすることを特徴とする同
値キーが存在するデータのソート方式。
6. The data sorting method according to claim 1 , wherein the match means uses a binary insertion method as a record match method, and the match is a record newly read into the presort record area. Is determined by using the binary insertion method to determine at which position in the group of records that have already been read and arranged in key order, and by inserting the record at the determined position,
In addition, the insertion position is determined by dividing the record group into two groups of halves, and comparing the record located at the divided boundary with the record to be inserted to determine which group the record to be inserted belongs to. And the opponent with the record to be inserted adopts the uppermost record of the divided lower group, and in the match of the equivalent key record, the record to be inserted wins and is inserted. A method for sorting data in which an equivalent key exists, wherein an equivalent key flag of the battle management table corresponding to a record is turned ON.
【請求項7】 請求項記載の同値キーが存在するデー
タのソート方式において、 前記マージ対戦手段はレコード対戦方式としてバイナリ
インサーション方式を用い、対戦は、前記マージ対戦用
レコードエリアに新たに読み込んだレコードを、既に読
み込み済みでキー順に並んでいるレコード群内のどの位
置に挿入すべきかを、バイナリインサーション方式によ
り決定して、決定した位置にレコードを挿入する方式で
行い、且つ、 挿入位置の決定は、レコード群を半分ずつの2つのグル
ープに分割し、分割した境界に位置するレコードと、挿
入するレコードとを対戦させることにより、挿入するレ
コードがどちらのグループに属するかを判定することで
行い、且つ、挿入するレコードとの対戦相手は、分割し
た下位のグループの最上位レコードを採用し、同値キー
レコードの対戦においては、挿入するレコードの方を勝
ちとし、挿入するレコードに対応する前記マージ対戦管
理テーブルの同値キーフラグをONにすることを特徴と
する同値キーが存在するデータのソート方式。
7. The data sorting method according to claim 1 , wherein the merging match means uses a binary insertion method as a record match method, and the match is newly read into the merge match record area. The position where the record should be inserted in the group of records that have already been read and arranged in key order is determined by the binary insertion method, the record is inserted at the determined position, and the insertion position is determined. Is determined by dividing the record group into two groups of two halves, and comparing the record located at the divided boundary with the record to be inserted to determine which group the record to be inserted belongs to. And the opponent with the record to be inserted is the top-level record of the divided lower group. In the match of the equivalent key record, the data to be inserted has a win, and the equivalent key flag of the merged match management table corresponding to the record to be inserted is set to ON. Sort method.
JP6290451A 1994-10-31 1994-10-31 Sorting method for data with equivalence key Expired - Fee Related JP2606608B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6290451A JP2606608B2 (en) 1994-10-31 1994-10-31 Sorting method for data with equivalence key

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6290451A JP2606608B2 (en) 1994-10-31 1994-10-31 Sorting method for data with equivalence key

Publications (2)

Publication Number Publication Date
JPH08129478A JPH08129478A (en) 1996-05-21
JP2606608B2 true JP2606608B2 (en) 1997-05-07

Family

ID=17756204

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6290451A Expired - Fee Related JP2606608B2 (en) 1994-10-31 1994-10-31 Sorting method for data with equivalence key

Country Status (1)

Country Link
JP (1) JP2606608B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3344559B2 (en) 1998-06-19 2002-11-11 三菱電機株式会社 Merge sort processor
KR100292662B1 (en) * 1999-08-23 2001-06-15 이경봉 Method for providing order-type martial harmony in the internet

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0782429B2 (en) * 1984-09-15 1995-09-06 カシオ計算機株式会社 How to merge multiple files
JPH0667843A (en) * 1992-08-14 1994-03-11 Nec Corp Sorting processor

Also Published As

Publication number Publication date
JPH08129478A (en) 1996-05-21

Similar Documents

Publication Publication Date Title
US6310971B1 (en) Information processing method and apparatus, and storage medium storing medium storing program for practicing this method
EP0250705B1 (en) Method and apparatus for retrieval of symbol strings from data
US5027305A (en) Interrogating device for changing the priority of the inference rules
JP3630057B2 (en) Data structure construction method for search, apparatus thereof, and machine-readable program recording medium
JP2606608B2 (en) Sorting method for data with equivalence key
US20040044683A1 (en) Data compiling method
US6678229B1 (en) Methods for optimizing recording order of data files to optical media
JP3183205B2 (en) Presort processing method
CN114297193A (en) HASH-based data comparison method and device
JP3534471B2 (en) Merge sort method and merge sort device
CN114372176B (en) Chess manual correction method and equipment
JP3387470B2 (en) Sort processing method and sort processing device
JPH0451320A (en) Presort processing system
JPH11513160A (en) Execution method of iterative search
JPH1139344A (en) Character string retrieval method using two-dimensional array code
JP3293551B2 (en) Sorting method
JP2001318783A (en) Sorting processor and recording medium
JPH1021066A (en) Automatic program generating method
JPS61275934A (en) Disc sort system
JP2673085B2 (en) Relational database join processing method
JPH04141726A (en) Sort processing system
JPH09222909A (en) Automatic sequence program preparing device
JPH048816B2 (en)
JPH05120338A (en) Index retrieving system
JPH07101393B2 (en) Reorganization method

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees