JPH03216730A - Electronic computer - Google Patents

Electronic computer

Info

Publication number
JPH03216730A
JPH03216730A JP1210790A JP1210790A JPH03216730A JP H03216730 A JPH03216730 A JP H03216730A JP 1210790 A JP1210790 A JP 1210790A JP 1210790 A JP1210790 A JP 1210790A JP H03216730 A JPH03216730 A JP H03216730A
Authority
JP
Japan
Prior art keywords
key
sorting
data
keys
key information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP1210790A
Other languages
Japanese (ja)
Inventor
Hitomi Ogata
緒方 ひとみ
Hiroyuki Miyasaka
宮坂 博之
Kazuo Kobayashi
一夫 小林
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.)
Seiko Epson Corp
Original Assignee
Seiko Epson 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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP1210790A priority Critical patent/JPH03216730A/en
Publication of JPH03216730A publication Critical patent/JPH03216730A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To execute successive processing of keys and to execute sorting even when plural kinds of key information are simultaneously designated by preparing a key for sorting plural kinds of designation from an input data, storing it and executing the sorting based on this key. CONSTITUTION:This computer is provided with a data input device 11, a data output device 12, a data storage device 13, a key storage device 14, a key designating means 15 for plural designation of keys, a key preparing means 16 for preparing different kinds of keys, and a sorting means 17 for executing the sorting. Plural kinds of means to convert from the data to the key is prepared, and when plural kinds of keys are designated, the kind of designated sorting is confirmed every time one key information is processed, and th key is prepared from a designated conversion method. The set of data record is stored based on that key. Thus, the sorting can be executed even when sorting methods with different key information is designated by applying the sorting of different methods in order.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、電子計算機において、データをソートする場
合に、複数種類のソート条件(以降キーと呼ぶ)によっ
てソートするための方法に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a method for sorting data using a plurality of types of sorting conditions (hereinafter referred to as keys) when sorting data in an electronic computer.

〔従来の技術〕[Conventional technology]

第6図は、従来のソート方法を示すフローチャートであ
る。まず最初に、データ入力装置からデータを入力する
61。入力されたデータを固定長、または可変長の1レ
コード毎に分割する62。最も優先順位の高いキー情報
をキー作成のためのキー情報とする63。そのキー情報
に基づいて、全てのデータレコードに対してキーを作成
する64。
FIG. 6 is a flowchart showing a conventional sorting method. First, data is input 61 from a data input device. Divide the input data into fixed-length or variable-length records 62. The key information with the highest priority is set as the key information for key creation 63. A key is created 64 for all data records based on the key information.

ソート処理を実行する65。ソート終了後、次に優先順
位の高いキーを、キー作成のためのキー情報とする66
。そして、そのキー情報に基づいて、再び、キーを作成
し、これまでのソートによって順番が確定していない部
分のデータレコードのソートを行う。キーの作成とソー
トを、指定されたキー情報すべてが参照されるか、デー
タが完全にソートされるまで繰り返し、終了した時点で
、ソートした結果を出力装置へ出力する67。
65. Sort processing is executed. After sorting is completed, the key with the next highest priority is used as key information for key creation 66
. Then, a key is created again based on the key information, and data records whose order has not been determined by the previous sorting are sorted. The creation and sorting of keys is repeated until all of the specified key information is referenced or the data is completely sorted, and when finished, the sorted results are output to the output device 67.

[発明が解決しようとする課題] しかし、前記の従来技術では、複数個のキー情報が指定
されていても、それらのキー情報をソートする種類は1
種類に限られていた。また、数種類のソート種類があっ
たとしても、1回のソートに複数種類のソートを適用し
て、データをソートすることはなかった.その結果、様
々なデータから構成される、複雑なデータ構造を持った
データレコードを、いくつかの異なった種類のキーを指
定してソートするといったことを、一回の操作で実行す
ることは不可能であった。そのため、あるキー情報を指
定してデータをソートし、その結果、得られたデータで
、さらに別のキー情報を指定してソートするなどして、
処理する必要があった。
[Problems to be Solved by the Invention] However, in the above-mentioned conventional technology, even if a plurality of pieces of key information are specified, the types of sorting of the key information are only one.
were limited in type. Also, even if there were several types of sorting, data was never sorted by applying multiple types of sorting in a single sort. As a result, it is impossible to sort data records with a complex data structure consisting of various data by specifying several different types of keys in a single operation. It was possible. Therefore, you can sort data by specifying certain key information, and then use the resulting data to specify another key information and sort.
It needed to be processed.

このような問題に鑑み、複数種類のキー情報によるソー
トを、高速かつ効率的に実現するための手段を提供する
ことを目的とする。
In view of such problems, it is an object of the present invention to provide a means for quickly and efficiently realizing sorting using multiple types of key information.

[課題を解決するための手段コ 本発明は、データ入力装置と、データ出力装置と、デー
タ記憶装置と、ソートのためのキーを複数種類指定する
手段と、ソートのための前記キーを前記入力データから
作成する複数種類の作成手段と、ソートのために作成さ
れた前記キーの記憶装置と、前記キーに基づいてソート
を行う手段とを備えたことを特徴とする。
[Means for Solving the Problems] The present invention includes a data input device, a data output device, a data storage device, means for specifying a plurality of types of keys for sorting, and a method for inputting the keys for sorting. The present invention is characterized by comprising a plurality of types of creation means for creating from data, a storage device for the keys created for sorting, and means for sorting based on the keys.

[作用コ 本発明においては、データからキーに変換する手段を複
数種類用意しておき、複数種類のキーが指定された場合
に、1つのキー情報を処理する度に、指定されたソート
の種類を確認し、指よされた変換方法によりキーを作成
する。そして、それぞれのキー情報で指定された方法で
、データレコードをソートできるようにする。この方法
により、複数種類のキー情報を同時に指定された場合も
、キーを順次処理することにより、ソートが可能となる
という利点がある。
[Operation] In the present invention, multiple types of means for converting data into keys are prepared, and when multiple types of keys are specified, the specified sort type is changed every time one key information is processed. Check and create a key using the specified conversion method. Then, data records can be sorted in the manner specified by each key information. This method has the advantage that even if multiple types of key information are specified at the same time, sorting is possible by sequentially processing the keys.

[実施例コ 以下に、本発明の実施例を図面に基づいて説明する。[Example code] Embodiments of the present invention will be described below based on the drawings.

(実施例1) 第1図は本発明のブロック図であり、データ記憶装置1
3と、ソートのために作成されたキーの記憶装置14と
、データを入力する装置11と、ソートされたデータを
出力する装置12から構成され、さらに、ソートのため
のキーを指定する手段i5と、種類の異なるキーを作成
するための手段16と、ソートを実行する手段17を備
えている. 第3図は、本発明のフローチャートである・ 3種類の
キー情報が指定されたものとし、優先順位の高い方から
キー情報1、キー情報2、キー情報3とする。これらの
キー情報は、すべて異なる方法でソートすることが要求
されているものとし、例えば、キー情報lは数字順、キ
ー情報2は漢字コード順、キー情報3はアルファベット
順とする。
(Embodiment 1) FIG. 1 is a block diagram of the present invention, in which a data storage device 1
3, a storage device 14 for keys created for sorting, a device 11 for inputting data, and a device 12 for outputting sorted data, and means i5 for specifying keys for sorting. , means 16 for creating keys of different types, and means 17 for performing sorting. FIG. 3 is a flowchart of the present invention. It is assumed that three types of key information are specified, and key information 1, key information 2, and key information 3 are designated in order of priority. It is assumed that all of these key information are required to be sorted in different ways, for example, key information 1 is ordered in numerical order, key information 2 is ordered in kanji code order, and key information 3 is arranged in alphabetical order.

また、データは、ある一定の長さで区切られる固定長の
レコードの集まりとする。最初に、入力装置からデータ
を読み込む31。続いて、固定長のデータの集まりなの
で、一定の長さ毎にデータを分け、データレコードに分
割する32。データレコードへの分割が終了した後、キ
ー情報に基づいたキー作成手段を選択し33、キーを作
成して34、キーレコードに設定する35。それぞれの
データレコードに対して、複数種類のキーをまとめて、
第2図のようなキーレコードを作成する。キーレコード
を作成する場合、複数種類のソート方法により作られた
キーを1つの大きなキーにする必要があるので、全ての
キーの作成基準を、昇順のためのキーか降順のためのキ
ーのいずれかに統一する必要がある。ここでは、各ソー
ト方法によるキー変換は、昇順を基準・とすることにす
る。まず、優先順位の高いキー情報1に基づいて、キー
情報1で指定されている数字順で、データからキーに変
換してキー1を得、キー1をキーレコードエリアに登録
する。この時、キー情報1は降順ソートが指定されてい
た場合には、昇順用に作成してあるキーなので、それぞ
れの大小が逆になるようにキーを変換し、その結果得た
キーを登録する。
Furthermore, the data is a collection of fixed-length records separated by a certain length. First, data is read 31 from the input device. Next, since it is a collection of fixed length data, the data is divided into data records by a certain length 32. After the division into data records is completed, a key creation means based on the key information is selected 33, a key is created 34, and a key record is set 35. For each data record, combine multiple types of keys,
Create a key record as shown in Figure 2. When creating a key record, it is necessary to combine keys created by multiple types of sorting methods into one large key, so the creation criteria for all keys must be set to either an ascending order key or a descending order key. There is a need to unify. Here, key conversion by each sorting method is based on ascending order. First, based on key information 1 having a high priority, data is converted into a key in the numerical order specified by key information 1 to obtain key 1, and key 1 is registered in the key record area. At this time, key information 1 is a key created for ascending order if descending order sorting is specified, so convert the keys so that their sizes are reversed, and register the resulting key. .

続いて、キー情報2に移り、漢字コード順でデータから
キー2を作成する。キー2についてもキーlと同様に降
順のための処理が必要ならば行う。
Next, the process moves to key information 2, and key 2 is created from the data in the order of the kanji code. As with key 1, processing for descending order is also performed for key 2 if necessary.

得られたキー2をキーレコード内のキー1の後ろ−に続
けて設定する。また、キー情報3は、アルファベット順
でキーへの変換を行い、キー3を作成してキーレコード
に登録する。キー1、キー2、キー3をまとめた形で、
第2図のように1つのキーレコードとする。全てのデー
タレコードに対してキーレコードを作成し、データレコ
ードとキーレコードを1対1に対応させる。キーレコー
ドをすべて作成し終わったところで、このキーレコード
を比較して昇順にソートする36。ソートの方法はクイ
ックソート、バブルソート等どの様なソート方法を用い
てもよい。キーレコードがソートできれば、キーレコー
ドとデータレコードは1対1に対応するので、データレ
コードのソートも完了したことになる。最後に、データ
レコードをソートされた順番で出力装置へ出力すれば終
了である37。このようにして、キー情報それぞれに異
なるソート方法が指定されている場合でも、キーに変換
し、それらのキーをキーレコードとしてまとめて1つの
大きなキーとしてソートすることで、ソートが可能であ
る。
The obtained key 2 is set after key 1 in the key record. Furthermore, the key information 3 is converted into keys in alphabetical order, and the key 3 is created and registered in the key record. In the form of key 1, key 2, and key 3,
As shown in Figure 2, there is one key record. A key record is created for every data record, and the data records and key records are made to correspond one-to-one. Once all key records have been created, the key records are compared and sorted in ascending order 36. Any sorting method may be used, such as quick sort or bubble sort. If the key records can be sorted, the key records and data records have a one-to-one correspondence, so sorting of the data records has also been completed. Finally, the process ends when the data records are output to the output device in the sorted order 37. In this way, even if different sorting methods are specified for each piece of key information, sorting is possible by converting it into keys, collecting those keys as a key record, and sorting them as one large key.

(実施例2) キー情報が2種類指定されたものとし、優先順位の高い
順にキー情報1、キー情報2とし、それぞれ、10進数
順、16進数順の方法が指定されたものとする。データ
は、ある区切り記号で区切られる可変長のデータレコー
ドの集まりとする。
(Example 2) It is assumed that two types of key information are specified, key information 1 and key information 2 in order of priority, and methods in decimal order and hexadecimal order are specified, respectively. The data is a collection of variable length data records separated by a certain delimiter.

まず、入力装置からソートするデータを読み込み、区切
り記号によってデータをデータレコードに分割する。こ
こでは、キーレコードを作成せず、まず、キー情報1に
よるソート実行後、キー情報2によるソートを行う。そ
れぞれのデータレコードに対応するキー情報1のキーを
指定された方法に基づいて作成する。第4図のように、
各データレコードに対応するキー情報1のキーをすべて
作成した後で、キー情報1のキーを基に、データレコー
ドのソートを行う。キー情報1によるソートが終了した
後、キー情報1によるキーが同じであったために、ソー
トが終了しなかったデータに対して、キー情報2を適用
して、ソートを行う。そこで、例えば、データレコード
2と6のキー1が同じだった場合は、その2つのデータ
レコードのみを取り出す。キー情報2は、キー情報1と
異なるソート方法なので、指定されたソート方法に基づ
いて、第5図のように、キー情報2の方法により、キー
を作成する。そして、キーを作成したデータレコードを
ソート対象として、キーを比較してソートを行う。この
ソートにより得られた結果を、出力装置へ出力する. キー情報は、処理として可能であれば、いくつ指定され
ていても構わないし、また、ソート方法の種類の数も、
ソートで処理できる方法であれば、いくつであっても構
わない。また、指定された方法が同じキーがあって−も
よい。
First, data to be sorted is read from an input device, and the data is divided into data records using delimiters. Here, without creating a key record, first, sorting is performed using key information 1, and then sorting is performed using key information 2. A key of key information 1 corresponding to each data record is created based on the specified method. As shown in Figure 4,
After creating all the keys of key information 1 corresponding to each data record, the data records are sorted based on the keys of key information 1. After the sorting using the key information 1 is completed, the key information 2 is applied to the data for which the sorting was not completed because the keys according to the key information 1 were the same, and the sorting is performed by applying the key information 2. Therefore, for example, if data records 2 and 6 have the same key 1, only those two data records are retrieved. Since key information 2 has a different sorting method than key information 1, keys are created using the method of key information 2, as shown in FIG. 5, based on the specified sorting method. Then, the data records for which keys have been created are sorted, and the keys are compared and sorted. The results obtained from this sorting are output to the output device. Any number of key information may be specified as long as it is possible for processing, and the number of types of sorting methods also varies.
Any number of methods may be used as long as they can be processed by sorting. Also, there may be keys that have the same specified method.

[発明の効果] 以上、説明した本発明によれば、複数のキー情報に基づ
いてデータレコードの集まりをソートする場合、それぞ
れのキー情報で異なるソート方法が指定されていても、
それらの異なる方法によるソートを順番に適用していく
ことによって、ソートを実行することが可能になる。さ
らに、異なるソート方法によって生成されるキーをまと
めてキーレコードにすることによって、さらに効率よく
、混合されたソート方法によるソートを処理することが
できる。
[Effects of the Invention] According to the present invention described above, when sorting a collection of data records based on a plurality of key information, even if different sorting methods are specified for each key information,
Sorting can be performed by sequentially applying these different methods of sorting. Furthermore, by combining keys generated by different sorting methods into a key record, sorting by mixed sorting methods can be processed more efficiently.

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

第1図は、本発明の電子計算機の構成を示すためのブロ
ック図である。第2図は、データレコードとキーレコー
ドの関係を示す図である。第3図は、本発明の一実施例
を示すフローチャートである。第4図、第5図は、デ.
タレコードと、キー情報によって作成されたキーの関係
を示す図である。第6図は、従来のソートを行う手段を
示すフローチャートである。 11 1 2 1 3 1 4 15 16 データ入力装置 データ出力装置 データ記憶装置 キー記憶装置 キーを複数指定する手段 それぞれのキーを 作成する手段 1 7 ソート手段 以 上
FIG. 1 is a block diagram showing the configuration of an electronic computer according to the present invention. FIG. 2 is a diagram showing the relationship between data records and key records. FIG. 3 is a flowchart showing one embodiment of the present invention. FIG. 4 and FIG.
FIG. 3 is a diagram showing the relationship between data records and keys created using key information. FIG. 6 is a flowchart showing conventional sorting means. 11 1 2 1 3 1 4 15 16 Data input device Data output device Data storage device Key Storage device Means for specifying multiple storage keys Means for creating keys for each 1 7 Sorting means and above

Claims (1)

【特許請求の範囲】[Claims] データ入力装置と、データ出力装置と、データ記憶装置
と、ソートのためのソート条件を複数種類指定する手段
と、ソートのための前記ソート条件を前記入力データか
ら作成する複数種類の作成手段と、ソートのために作成
された前記ソート条件の記憶装と、前記ソート条件に基
づいてソートを行なう手段とを備えたことを特徴とする
電子計算機。
a data input device, a data output device, a data storage device, means for specifying a plurality of types of sorting conditions for sorting, and a plurality of types of creating means for creating the sorting conditions for sorting from the input data; An electronic computer comprising: a storage device for the sorting conditions created for sorting; and means for sorting based on the sorting conditions.
JP1210790A 1990-01-22 1990-01-22 Electronic computer Pending JPH03216730A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1210790A JPH03216730A (en) 1990-01-22 1990-01-22 Electronic computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1210790A JPH03216730A (en) 1990-01-22 1990-01-22 Electronic computer

Publications (1)

Publication Number Publication Date
JPH03216730A true JPH03216730A (en) 1991-09-24

Family

ID=11796346

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1210790A Pending JPH03216730A (en) 1990-01-22 1990-01-22 Electronic computer

Country Status (1)

Country Link
JP (1) JPH03216730A (en)

Similar Documents

Publication Publication Date Title
US5247662A (en) Join processor for a relational database, using multiple auxiliary processors
JPH0666050B2 (en) Sort processing method
JPH03216730A (en) Electronic computer
JPS59121436A (en) Sorting method of data group
JPS6172333A (en) Merge processing system
JPH03216729A (en) Elctronic computer
JPS6227836A (en) Storing system for document data
JP2926803B2 (en) Sorting method
JPS63149728A (en) Index forming device
JP2921045B2 (en) Index generation method
JPH01288920A (en) Data sorting device
JPS6266326A (en) Array processing system for japanese data
JPS62118435A (en) Plural indexes generating system
JPH04155521A (en) Sorting processing system
JP3251311B2 (en) Sorting method for data representing numerical values
JPH05216511A (en) Data processor
JPH0452967A (en) And operation processing system for set file
JPH01303539A (en) Initial loading system for index order compiling file
JPH0581339A (en) Data processor
JPS6346537A (en) Method for deciding retrieving condition of retrieving processor
JPH04286072A (en) High speed retrieval system for table
JPH02259827A (en) Record editing system
JPH03216731A (en) Electronic computer
JPH03290730A (en) System for sorting data classification
JPS62157942A (en) Record linking system in two files