JPS6132695B2 - - Google Patents
Info
- Publication number
- JPS6132695B2 JPS6132695B2 JP2365477A JP2365477A JPS6132695B2 JP S6132695 B2 JPS6132695 B2 JP S6132695B2 JP 2365477 A JP2365477 A JP 2365477A JP 2365477 A JP2365477 A JP 2365477A JP S6132695 B2 JPS6132695 B2 JP S6132695B2
- Authority
- JP
- Japan
- Prior art keywords
- search
- record
- output
- address
- memory
- 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
Links
- 230000015654 memory Effects 0.000 description 41
- 238000000034 method Methods 0.000 description 26
- 230000008569 process Effects 0.000 description 9
- 238000001514 detection method Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 5
- 230000001174 ascending effect Effects 0.000 description 3
- 238000007796 conventional method Methods 0.000 description 1
- 238000012966 insertion method Methods 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 230000008685 targeting Effects 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
【発明の詳細な説明】
本発明は最大値(または最小値)を検索する検
索装置に関する。DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a search device that searches for a maximum value (or minimum value).
フアイル処理を実現する上で、ソーテング処理
(あるキーワード(Key Word)によつて、フア
イル中のレコードを昇順または降順に並びかえる
操作がしばしば必要となる。 In implementing file processing, sorting processing (an operation of rearranging records in a file in ascending or descending order based on a certain key word) is often necessary.
従来ソーテイング・テクニツクとしては、主記
憶装置上でのみ実行するインターナル・ソーテン
グ(挿入法、置換法、トーナメント法……)と、
磁気テープ、または、磁気デイスク等の記憶装置
を用いるエクスターナル・ソーテング(基数分類
法、各種マージ法……)とが有るが、前者は、主
記憶装置上に、対象とするデータのすべてを格納
する必要があるために、多量のデータの実行に
は、不適当であり、後者においても、多数の磁気
テープ記憶装置が必要であつたり、デイスク上に
ソーテングのための、ワーク・エリヤを多く必要
とする。 Conventional sorting techniques include internal sorting (insertion method, replacement method, tournament method, etc.) that is executed only on the main memory,
There is external sorting (radix classification method, various merging methods...) that uses storage devices such as magnetic tape or magnetic disks, but the former stores all of the target data on the main storage device. The latter also requires a large number of magnetic tape storage devices and a large amount of work area for sorting on disk. do.
しかるに、本方式は、フアイル記録媒体として
磁気デイスク等の高速大容量な装置を用いた場
合、特にその威力を発輝する方式であり、デイス
ク等の読出し回路に直結された、または同期して
作動する検索ユニツトを付加することにより、読
出データ中の最大または最小値を検索し、ソート
処理をするものである。 However, this method is especially effective when a high-speed, large-capacity device such as a magnetic disk is used as a file recording medium, and is a method that is particularly effective when a high-speed, large-capacity device such as a magnetic disk is used as a file recording medium. By adding a search unit to search for the maximum or minimum value in the read data, sort processing is performed.
本願は被検索データを格納する格納手段、
上記格納手段から被検索データを読み出す手
段、
上記読み出し手段によつて読み出されるデータ
が検索領域条件を満たすかどうかを判定する判定
手段、
上記判定手段による判定結果に基づいて、上記
検索領域条件を可変としたことを特徴とする検索
装置であり、Cpu(Central Rrocessing Unit)
側のプログラム処理も含めてその処理の概要を第
1図に示す。同図に基づいて説明するならば、ま
ずCpuよりデイスク等の読出し制御回路へ検索対
象フアイルのエリア(スタート/エンドアドレ
ス)を指示し、さらに当検索ユニツトに対し検索
するキーワード(以下キーと称する)の上、下の
限界値及び最大または最小値検索のいずれかの指
定を行ない起動する。 The present application provides a storage means for storing searched data, a means for reading out the searched data from the storage means, a determination means for determining whether the data read by the reading means satisfies the search area condition, and a determination by the determination means. The search device is characterized in that the search area conditions are made variable based on the results, and the search device uses a CPU (Central Rrocessing Unit).
An overview of the processing, including the program processing on the side, is shown in FIG. To explain based on the figure, first, the CPU instructs the readout control circuit of the disk, etc., to the area (start/end address) of the file to be searched, and then the keyword to be searched (hereinafter referred to as key) to the search unit. Start by specifying the upper and lower limit values and either the maximum or minimum value search.
一方、検索ユニツト側の機能として、以下に説
明する動作により、指定された限界値内での最大
または最小のキー値を有するレコードを検索し
て、そのレコードの格納アドレス、つまり該当ア
ドレスを保持して終了するものとすれば、Cpu
は、当アドレスにより、該当レコードを取出し、
所定の処理を行なう。さらに、次の順位のレコー
ドが必要ならば、前回のレコードのキーを、イン
クリメント、またはデイクリメントして、前回同
様に、検索ユニツトへ限界値としてセツトしなお
し、実行させればCpu側から見て、取出しレコー
ドのキー値は順次昇順または降順となる。また、
検索ユニツト側では常に、Cpuから指定される限
界値内で最小または、最大のキー値を有するレコ
ードの検出を行なうだけで良い。 On the other hand, the function of the search unit is to search for the record with the maximum or minimum key value within the specified limit value, and to hold the storage address of that record, that is, the corresponding address. If the CPU
retrieves the corresponding record using this address,
Perform predetermined processing. Furthermore, if you need a record in the next rank, increment or decrement the key of the previous record, set it again as the limit value in the search unit in the same way as before, and run it. , the key values of the retrieved records are in ascending or descending order. Also,
On the search unit side, it is only necessary to always detect the record having the minimum or maximum key value within the limit value specified by the CPU.
この様にして、従来のソーテングと等価な処理
が可能となる。なお、このままの順番読出し方式
では、同一キー値を有するレコードが複数存在し
た場合には、これらをすべて取出すことが出来な
い。 In this way, processing equivalent to conventional sorting becomes possible. Note that with the current sequential reading method, if there are multiple records with the same key value, it is not possible to retrieve all of them.
そこで、本装置では、前記した最大または最小
値検索の基本的な動作以外に、次の機能が必要に
なる。 Therefore, this device requires the following functions in addition to the basic operation of searching for the maximum or minimum value described above.
つまり、当検索ユニツトは必らず指示されてい
るエンド・アドレスまで、検索処理を実行せねば
ならない故に、指定された限界値内で、同一値を
有する複数の最大または最小値のキーのレコード
が在存すると、前記検索終了後の保持アドレス
は、よりエンド・アドレスに近い最後のレコード
のアドレスが該当アドレスとして格納されてい
る。 In other words, since the search unit must always perform the search process up to the specified end address, it is possible to find multiple records with the same maximum or minimum key within the specified limit. If the address exists, the address of the last record closer to the end address is stored as the corresponding address in the retained address after the end of the search.
従つて、同一値の最大または最小値を検索した
ならば、セツトするステータス・フラツグを設け
(以後「複数存在」フラツグと呼ぶ)検索終了
後、同フラツグがセツトしていたならば、上、下
の限界値等は前回同様サーチ・エリヤのエンド・
アドレスのみを、前記該当アドレスより−1した
値に変えて検索処理を再実行する。 Therefore, if you search for the maximum or minimum value of the same value, set a status flag (hereinafter referred to as the "multiple existence" flag). After the search is complete, if the same flag is set, the upper and lower values will be set. The limit value etc. of the search area is the same as last time.
Only the address is changed to a value minus 1 from the corresponding address and the search process is re-executed.
つまり、前回の該当アドレスのレコードは読出
し、必要な処理行なわれてしまつたものとすれ
ば、この該当アドレス以後のエリヤには、当面必
要とするレコードは存在しないことになるから、
検索対象エリヤはその直前までで良く、再び同フ
ラツグがセツト状態で終了したならば、同様に、
エンド・アドレスを狭ばめて、繰返せば結局、同
一キー値のレコードは格納アドレスの大きい順
に、すべて取出すことができる。 In other words, assuming that the previous record at the corresponding address has been read and the necessary processing has been performed, there will be no record that is needed for the time being in the area after this corresponding address.
The area to be searched can be up to just before that, and if the same flag is set again, the search can be done in the same way.
By narrowing down the end addresses and repeating the process, all records with the same key value can be retrieved in descending order of storage address.
また、この様にして同一値の最後のレコードを
検索すると、この「複数存在」のフラツグは、セ
ツトしていない。従つて、次のキー順位のレコー
ドを取出すためには、サーチ・エリヤのエンドア
ドレスを初期値に戻し、正常ルーチンへ復帰せね
ばならない。このための情報として第1図の如
く、同一値を検出して、エンド・アドレスによ
り、サーチ・エリヤを狭めるルーチンの先頭でセ
ツトしておいたフラツグF4を使用する。 Furthermore, when searching for the last record with the same value in this way, the "multiple existing" flag is not set. Therefore, in order to retrieve the record of the next key order, it is necessary to return the end address of the search area to its initial value and return to the normal routine. As information for this purpose, as shown in FIG. 1, the flag F4, which is set at the beginning of a routine that detects the same value and narrows the search area based on the end address, is used.
さらに、検索の結果、与えられた限界値の条件
を満すキーのレコードが存在しない場合、これを
示すステータス・フラツグ「該当なし」を設けて
おき、全体としての処理を終了することができ
る。 Furthermore, if as a result of the search there is no key record that satisfies the conditions of the given limit value, a status flag "Not Applicable" is set to indicate this, and the entire process can be terminated.
本方式によるソート処理のメリツトとして、次
の事柄が考えられる。 The following points can be considered as advantages of sorting processing using this method.
◎ソートのためのワーク・エリヤが不要故、媒体
の利用効率が非常に高い。◎Since no work area is required for sorting, media usage efficiency is extremely high.
◎フアイル編成として、サーチ・フアイルが使用
でき、格納するレコード位置の制約が皆無のた
めに、アツプ・デートの追加、抹消、要求が高
くても、実時間内にこれらに対応できる。◎Search files can be used for file organization, and there are no restrictions on the record position to be stored, so even if there is a high demand for adding or deleting up-dates, these can be handled in real time.
つまり、いつでも望む時に順番読出しが可能
である。 In other words, sequential reading is possible whenever desired.
◎フアイル処理のためのプログラムが非常に簡単
になる。◎File processing programs become extremely simple.
以下、本願発明の検索装置について、詳細な説
明を行なう。 Hereinafter, the search device of the present invention will be explained in detail.
第2図において、Cpuよりの限界値やデイスク
等のサーチ・アドレス等の格納のためのルート
や、各種カウンタ、フリツプ・フロツプ等のイニ
シヤル・セツト線等は省略したが、初期値につい
て考えると、15のカウンタはCpuより与えられる
サーチ・エリヤのスタート・アドレス値、他のカ
ウンタとフリツプ・フロツプはすべて“ゼロ”、
また、必要なときにタイミング1,2などは得ら
れるし、Cpuより与えられたサーチ・エリヤのエ
ンド・アドレスを監視しており、処理を終了する
機能等は当然有るものとする。 In Fig. 2, routes for storing limit values from the CPU, search addresses for disks, etc., initial set lines for various counters, flip-flops, etc. are omitted, but when considering the initial values, Counter 15 is the start address value of the search area given by the CPU, all other counters and flip-flops are "zero",
Furthermore, it is assumed that timings 1 and 2 can be obtained when necessary, that the end address of the search area given by the CPU is monitored, and that there is a function to end the processing.
さらに第3図において、A,B,i,F1,F
2……等の記号は第2図の名称と同一内容を示
す。 Furthermore, in FIG. 3, A, B, i, F1, F
Symbols such as 2... indicate the same contents as the names in FIG.
第2図において、1は被検索データ(フアイ
ル)の格納されているメモリ、この読出し出力を
iと呼ぶ。2は最大値検索の場合には、Cpuより
上限値を、最小値検索の場合には下限値が格納さ
れるメモリで、この出力をAと呼ぶ。3は、上記
メモリ1とメモリ2の出力を比較する比較回路、
比較条件はメモリ21から与えられるものとし
て、最大値検索の場合には、A≧iを検出し、最
小値検索の場合には、A≦iを検出する。その出
力は、アンドゲート11,13へ与えられる。4
は、メモリ2と反対に最大値検索の場合には下限
値が、最小値検出の場合には上限値がCpuより格
納されるメモリであり、入力端にはiが、リー
ド/ライトの制御端子には、オアゲート19の出
力が与えられており、当端子=Hならば読出し、
=Lならば書込の機能を有する。また、出力端子
はアンドゲート6へ導かれている。5は、メモリ
4と同機能を有するメモリで、リード/ライト制
御端子にはオアゲート18の出力が与えられてお
り、出力端子がアンドゲート7へ導かれているこ
と以外はメモリ4と同様な結線である。6及び7
はアンドゲートで、メモリ4,5出力をフリツ
プ・フロツプ17の状態によりオン/オフする。
8はアンドゲート6及び7の出力のオアゲート、
オアゲート8の出力は、比較回路9に導かれ、こ
のデータを以下Bと呼ぶこととする。 In FIG. 2, 1 is a memory in which data to be searched (file) is stored, and its read output is called i. 2 is a memory in which the upper limit value is stored from the CPU in the case of a maximum value search, and the lower limit value is stored in the case of a minimum value search, and this output is called A. 3 is a comparison circuit that compares the outputs of the memory 1 and memory 2;
Assuming that the comparison condition is given from the memory 21, in the case of maximum value search, A≧i is detected, and in the case of minimum value search, A≦i is detected. The output is given to AND gates 11 and 13. 4
is a memory in which the lower limit value is stored by the CPU in the case of maximum value search and the upper limit value is stored by the CPU in the case of minimum value detection, contrary to memory 2, and i is the input terminal, and the read/write control terminal The output of the OR gate 19 is given to , and if this terminal = H, it is read,
=L, it has a writing function. Further, the output terminal is led to an AND gate 6. 5 is a memory having the same function as memory 4, and has the same wiring as memory 4 except that the output of OR gate 18 is given to the read/write control terminal and the output terminal is led to AND gate 7. It is. 6 and 7
is an AND gate that turns on/off the outputs of the memories 4 and 5 depending on the state of the flip-flop 17.
8 is an OR gate for the outputs of AND gates 6 and 7;
The output of the OR gate 8 is led to a comparison circuit 9, and this data will be referred to as "B" hereinafter.
比較回路9は、前記Bとiの比較を行ない、比
較条件はメモリ21から与えられるが、最大値検
索の場合には、i≧Bを検出し最小値検索の場合
には、i≦Bを検出する。また、その出力は比較
回路3と異なり、等号出力(=)と、大小出力
(〓)との2系統で出力される。11はオアゲー
ト10の出力と、比較回路3の出力の論理積を取
るためのアンド・ゲート、当ゲートの出力により
メモリ1からのデータiがCpuより指定された限
界値AorBに対して、A≦i≦Bまたは、A≧i
≧Bの条件が成立したことを知る。 The comparison circuit 9 compares B and i, and the comparison condition is given from the memory 21. In the case of maximum value search, it detects i≧B, and in the case of minimum value search, it detects i≦B. To detect. Further, unlike the comparator circuit 3, its output is output in two systems: an equal sign output (=) and a magnitude output (〓). 11 is an AND gate for taking the logical product of the output of the OR gate 10 and the output of the comparator circuit 3, and the output of this gate allows the data i from the memory 1 to be set to a limit value AorB specified by the CPU if A≦ i≦B or A≧i
It is known that the condition ≧B is satisfied.
12はフリツプ・フロツプで最大または最小値
検索の対象キーの比較の結果i=Bならば、比較
回路9の等号(=)出力端子からパルスが出力さ
れアンドゲート23を経由してセツトする。ま
た、そのクリヤ端子にはアンドゲート13よりの
出力が与えられており、これによつてクリヤされ
る。 Reference numeral 12 denotes a flip-flop, and if the result of the comparison of the target keys in the maximum or minimum value search is i=B, a pulse is output from the equal sign (=) output terminal of the comparison circuit 9 and set via the AND gate 23. Moreover, the output from the AND gate 13 is given to the clear terminal, and is cleared by this.
なお、当フリツプ・フロツプの出力F1は前述
の「複数存在」のステータス・フラツグとなる。
13はアンドゲートであり、比較回路3の出力と
比較回路9の大小出力(〓)の出力との論理積を
取り、A≦i<Bまたは、A≧i>Bの条件が成
立したことを示す。 Incidentally, the output F1 of this flip-flop becomes the status flag for the above-mentioned ``multiple existence''.
13 is an AND gate, which calculates the AND of the output of the comparator circuit 3 and the output of the magnitude output (〓) of the comparator circuit 9, and determines that the condition of A≦i<B or A≧i>B is satisfied. show.
14はフリツプ・フロツプで、アンドゲート1
1の出力によりセツトされる。つまり、当検索ユ
ニツトの処理が始まつて、A≦i≦Bまたは、A
≧i≧Bなる条件成立が1度でも成立したなら
ば、当フリツプ・フロツプ14はセツトしている
ことになり、前述した「該当なし」のステータ
ス・フラツグはオフ(3=0)となる。15は
アドレス・カウンタでメモリ1のフアイルから読
出されるレコードのアドレスを、タイミング2な
るパルスでカウントする。16はアンドゲート1
1よりの条件成立パルスがロード端子に与えられ
たラツチ回路、ロード・パルス毎にアドレスカウ
ンタ15の内容を取込む、つまり処理中最後に取
込んだアドレス値を保持していることからラツチ
回路16の出力をCpuに導びけば、最大または最
小のキー値を有するレコードのアドレスを与える
ことができる。17はアンドゲート11の条件成
立パルスが出力される毎にセツト、リセツトを操
返すフリツプ・フロツプ。その出力はF2と呼
ぶ。18はオア・ゲートで、一方はフリツプ・フ
ロツプ17のQ側、他方は検出回路22よりの出
力が与えられている。19も同様にオア・ゲート
であり、フリツプ・フロツプ17の側と検出回
路22よりの出力が与えられている。 14 is a flip-flop, and gate 1
Set by output of 1. In other words, when the processing of this search unit starts, A≦i≦B or A
If the condition ≧i≧B is satisfied even once, it means that the flip-flop 14 is set, and the above-mentioned "not applicable" status flag is turned off ( 3 =0). 15 is an address counter that counts the address of the record read from the file in the memory 1 at timing 2 pulses. 16 is and gate 1
The latch circuit receives the contents of the address counter 15 for each load pulse, that is, the latch circuit 16 holds the last address value taken in during processing. If you route the output of to the CPU, you can give the address of the record with the maximum or minimum key value. Reference numeral 17 denotes a flip-flop which repeats setting and resetting every time a condition satisfying pulse of AND gate 11 is output. Its output is called F2. 18 is an OR gate, one of which is supplied with the Q side of the flip-flop 17, and the other with the output from the detection circuit 22. Similarly, 19 is an OR gate, and the output from the flip-flop 17 side and the detection circuit 22 are applied.
オア・ゲート18,19の出力はそれぞれメモ
リ4,5のリード/ライト端子へ導かれ機能的に
は負論理の論理積として作用する。 The outputs of the OR gates 18 and 19 are led to the read/write terminals of the memories 4 and 5, respectively, and functionally act as an AND of negative logic.
20はメモリ1より読出されるデータに同期し
てそのウエイトをカウントするカウンタで、その
出力はメモリ2,4,5、そして21のアドレス
端子に導かれている。このことより各メモリ2,
4,5及び21はメモリ1よりの読出しレコード
に同期してアクセスできることになる。 A counter 20 counts the wait in synchronization with data read from the memory 1, and its output is led to the address terminals of the memories 2, 4, 5, and 21. From this, each memory 2,
4, 5, and 21 can be accessed synchronously with records read from memory 1.
また、カウンタ20は各レコード毎にイニシヤ
ル・セツトされるものとする。 Further, it is assumed that the counter 20 is initially set for each record.
メモリ21は、当検索ユニツトの処理開始以前
にメモリ1より読出されるレコードの、アイテム
(又はフイールド)構成や各アイテムに対する検
索条件等がコードで格納されるメモリで、その出
力は比較回路3,9及び検出回路22に導かれて
いる。 The memory 21 is a memory in which the item (or field) configuration and search conditions for each item of records read out from the memory 1 before the start of processing of the search unit is stored in code, and its output is sent to the comparison circuit 3, 9 and a detection circuit 22.
検出回路22は、メモリ21の出力を受けて最
大または最小値を検索するアイテムの通過時間を
検出し、その時間中負信号をオアゲート18,1
9に出力する検出回路。23はアンド・ゲート
で、フリツプ・フロツプ12のステータス・フラ
ツグの「複数存在」のセツト条件をフリツプ・フ
ロツプ14のセツト後のみに限定するためのゲー
トである。つまり1回の処理中で、2回目の条件
成立時から比較回路9及びフリツプ・フロツプ1
2によりi=Bを検出する。 The detection circuit 22 receives the output of the memory 21, detects the passing time of the item for which the maximum or minimum value is searched, and passes the negative signal to the OR gates 18, 1 during that time.
Detection circuit that outputs to 9. Reference numeral 23 denotes an AND gate, which limits the setting condition of "multiple existence" of the status flag of the flip-flop 12 to only after the flip-flop 14 is set. In other words, during one process, from the second time the condition is met, the comparator circuit 9 and the flip-flop 1
2 to detect i=B.
24は、ステータス・フラツグ「複数自在」の
フリツプ・フロツプ12がセツトした場合、ラツ
チ回路16に格納されている。24は最後に存在
した同一値を有するレコードのアドレスを−1し
て制御回路25内のエンド・アドレスを作成する
ためのデエクリメンタ。25はデイスク等の制御
回路で、Cpuまたは、デユクリメンタ24等から
サーチ・エリヤのスタート/エンド・アドレスを
受けて、このエリヤ内を連続して、読出す制御を
行なう。なお、エンド・アドレスとして、Cpuよ
り与えられた情報と、デイクリメンタ24からの
情報と、いずれのものを採用するかの判別のため
のフラツグF4(第1図で説明済)を内蔵してい
る。 24 is stored in the latch circuit 16 when the flip-flop 12 with the status flag "Multiple Free" is set. 24 is a decrementer for creating an end address in the control circuit 25 by subtracting the address of the last existing record having the same value by 1. Reference numeral 25 denotes a control circuit such as a disk, which receives the start/end address of the search area from the CPU or the decrementer 24, etc., and controls continuous reading within this area. Furthermore, as the end address, information given from the CPU, information from the decrementer 24, and a flag F4 (described in FIG. 1) for determining which one is to be adopted are included.
次に、第2図、第3図、第4図を使用して、実
際の動作を順次説明する。今、対象とするフアイ
ル即ちメモリ1に10個のレコードがアドレス00よ
り09まで記録されており、各レコードの対象とす
るキーの値が第4図の順番であつたとする、そし
て、Cpu側からの要求として、キーの値が100か
ら1000までのレコードを昇順(つまり、最小値検
索)にリードしたいものとする。 Next, the actual operation will be sequentially explained using FIGS. 2, 3, and 4. Now, suppose that 10 records are recorded in the target file, that is, memory 1, from addresses 00 to 09, and the target key values of each record are in the order shown in Figure 4, and from the CPU side As a request, suppose you want to read records with key values from 100 to 1000 in ascending order (that is, minimum value search).
まづ、Cpuの制御により、サーチエリヤとして
アドレス“00”と“09”を第2図の制御回路25
へ格納し、次に、下限値の100を第2図のメモリ
2へ、上限値の1000を第2図のメモリ4へ、対象
キーのレコード中の位置及び最小値検索の旨の制
御データを第2図のメモリ21へそれぞれ格納後
検索ユニツトをスタートさせる。 First, under the control of the CPU, addresses "00" and "09" are set as search areas in the control circuit 25 of FIG.
Next, store the lower limit value of 100 to memory 2 in Figure 2, the upper limit value of 1000 to memory 4 in Figure 2, and control data indicating the position of the target key in the record and minimum value search. After each data is stored in the memory 21 of FIG. 2, the retrieval unit is started.
これにより、当ユニツトはA=100、B=1000
となるから、100≦i≦1000を検索することにな
る。最初のレコードをリードする際に第2図のフ
リツプ・フロツプ17は、イニシヤルでリセツト
されている故に、アンドゲート6がオンし、メモ
リ4の出力がBとなる。一方、オアゲート18で
は、フリツプ・フロツプ17のQ側が“L”故
に、その出力は検出回路22よりの出力が“L”
となる期間中“L”となり、メモリ5は書込モー
ドとなり、i=50を記憶する。 As a result, this unit has A=100 and B=1000.
Therefore, we will search for 100≦i≦1000. When reading the first record, the flip-flop 17 in FIG. 2 is reset at the initial stage, so the AND gate 6 turns on and the output of the memory 4 becomes B. On the other hand, in the OR gate 18, since the Q side of the flip-flop 17 is "L", its output is "L" from the detection circuit 22.
During the period, it becomes "L", and the memory 5 enters the write mode and stores i=50.
i=50であることより、50≦1000で比較回路9
は、条件成立出力を出す。しかし、比較回路3か
らは、100≦50が成立しないために出力が発生せ
ず、アンドゲート11はオンしない。従つて、そ
の他の部分に変化は起らない。次に、2個目のレ
コードi=408をリードすると、メモリ4,5及
びフリツプ・フロツプ17等は前回と同様な動作
を行なうが、100≦408であることから比較回路3
の出力と、408≦1000より比較回路9の出力、つ
まりオアゲート10の出力が発生し、アンドゲー
ト11により100≦408≦1000の成立パルスが、フ
リツプ・フロツプ14、ラツチ回路16及びフリ
ツプ・フロツプ17に与えられ、それぞれフリツ
プフロツプ14の「該当なし」のステータス・フ
ラツグをオフ(3=0)し、また該当したレコ
ードのアドレスつまり“01”をアドレス・ラツチ
16へ保持し、さらにフリツプ・フロツプ17を
セツトする。また、メモリ5には408が記憶さ
れている。この状態から3番目、4番目及び5番
目のレコードをリードすると、フリツプ・フロツ
プ17がセツトしていることから、メモリ4はラ
イト・モードに、メモリ5はリードモードになつ
ている。また、アンドゲート6はオフ、アンドゲ
ート7はオンとなつていることから、比較回路9
への入力データBは、メモリ5の出力に切換り、
以後100≦i≦408の条件で検索することになる。
よつて1573、671、85等のデータは無視される。
(ただし、アドレス・カウンタ15は、各レコー
ド毎に+1を行なつているものとする。)
次に、6番目のレコード、i=270をリードす
ると、前記検索条件を満足する故に、前回i=
408のレコードの際と同様に、アンドゲート11
より条件成立信号が出力され、この信号によりフ
リツプ・フロツプ14はセツト(3=0、2回
目以後は無意味)ラツチ回路16へは、該当アド
レスとして“05”を再ロードしなおす。さらに、
メモリ4へ書込まれたi=270を以後Bとすべ
く、フリツプ・フロツプ17をリセツトする。以
上の動作により、7番目のレコード以後は100≦
i≦270の検索条件に変り、メモリ5はライト・
モードとなる。従つて、7番目のi=320のレコ
ードは無視され、次の8番目のレコードi=270
で、再度、条件成立信号が発生し、ラツチ回路1
6へアドレスが保持され、フリツプ・フロツプ1
7のセツトが行なわれる。しかし、今回の特別な
動作として、比較回路9よりの成立信号は、i=
270故に、等号(=)側の出力が発生する。する
と、アンドゲート23を経てフリツプ・フロツプ
12がセツトし、「複数存在」のステータス・フ
ラツグがオンしたことになる。 Since i=50, the comparison circuit 9 is 50≦1000.
outputs the condition satisfied output. However, since 100≦50 does not hold, no output is generated from the comparison circuit 3, and the AND gate 11 is not turned on. Therefore, no changes occur in other parts. Next, when the second record i=408 is read, the memories 4 and 5, flip-flop 17, etc. perform the same operations as before, but since 100≦408, the comparison circuit 3
Since 408≦1000, the output of the comparator circuit 9, that is, the output of the OR gate 10, is generated, and the AND gate 11 generates a pulse that satisfies the condition 100≦408≦1000. , respectively, turns off the "Not Applicable" status flag of the flip-flop 14 ( 3 = 0), holds the address of the corresponding record, that is, "01" in the address latch 16, and then turns off the flip-flop 17. Set. Further, 408 is stored in the memory 5. When the third, fourth and fifth records are read from this state, since the flip-flop 17 is set, the memory 4 is in the write mode and the memory 5 is in the read mode. Also, since AND gate 6 is off and AND gate 7 is on, comparison circuit 9
The input data B to is switched to the output of memory 5,
Thereafter, a search will be performed using the condition 100≦i≦408.
Therefore, data such as 1573, 671, 85, etc. are ignored.
(However, it is assumed that the address counter 15 is incremented by 1 for each record.) Next, when reading the 6th record, i=270, since the above search condition is satisfied, the previous i=
As with the 408 record, and gate 11
A condition fulfillment signal is output, and this signal causes the flip-flop 14 to set ( 3 = 0, meaningless after the second time) the latch circuit 16 to reload "05" as the corresponding address. moreover,
The flip-flop 17 is reset so that i=270 written in the memory 4 will be set as B from now on. Due to the above operation, 100≦ after the 7th record
The search condition changes to i≦270, and memory 5 is write/write.
mode. Therefore, the 7th record with i=320 is ignored and the next 8th record with i=270
Then, the condition fulfillment signal is generated again, and latch circuit 1 is activated.
6 is held, and flip-flop 1
7 sets are performed. However, as a special operation this time, the establishment signal from the comparator circuit 9 is i=
270 Therefore, the output on the equal sign (=) side is generated. Then, the flip-flop 12 is set via the AND gate 23, and the "multiple existence" status flag is turned on.
この状態から、9番目のレコードi=150を読
込むと、検索条件成立となり、ラツチ回路16に
は“08”が、フリツプ・フロツプ17はリセツト
が行なわれ、以後100≦i≦150の条件で検索を行
なうこととなる。一方、比較回路9の出力は、
270≠150より大小比較(〓)側から成立信号が
出、アンドゲート13を経てフリツプ・フロツプ
12をクリヤする。 From this state, when the 9th record i=150 is read, the search condition is satisfied, the latch circuit 16 is set to "08", the flip-flop 17 is reset, and from then on, the search condition is 100≦i≦150. will be carried out. On the other hand, the output of the comparison circuit 9 is
Since 270≠150, an establishment signal is output from the magnitude comparison (ⓓ) side, passes through the AND gate 13, and clears the flip-flop 12.
つまり、「複数存在」のステータス・フラツグ
はオフされる。次の10番目のレコードi=670は
無視されるから、この状態で処理を終了する。 In other words, the "multiple existing" status flag is turned off. Since the next 10th record i=670 is ignored, the process ends in this state.
従つて、Cpu側では、処理の終了を検知した
後、まず、ステータスフラツグの「該当なし」
3をチエツクし、これが“L”ならば、ラツチ回
路16のアドレスを抜取つて、該当レコードのア
ドレス“08”を使用してi=150なるレコードを
リードする。当レコードに必要処理を行なつた後
に、次順位の最小値レコードを検索するために、
メモリ4へ格納する下限値を、当レコードのi=
150に+1して151として、再格納。また、上限値
は、再び1000をメモリ5へ格納して、検索ユニツ
トをスタートさせる。 Therefore, on the CPU side, after detecting the end of processing, first the status flag is set to "Not applicable".
3 is checked, and if it is "L", the address of the latch circuit 16 is extracted and the record i=150 is read using the address "08" of the corresponding record. After performing the necessary processing on this record, in order to search for the next minimum value record,
The lower limit value to be stored in memory 4 is set to i=
Add +1 to 150 to make 151 and restore. Further, the upper limit value 1000 is stored in the memory 5 again, and the search unit is started.
すると、今回はi=150のレコードは無視され
ることにより、処理結果としては、該当レコード
i=270で、そのアドレスは“07”、そして、ステ
ータス・フラツグの「複数存在」=“H”という状
態で処理を終了する。 Then, this time, the record with i = 150 is ignored, so the processing result is the corresponding record i = 270, its address is "07", and the status flag "Multiple Existence" = "H". Terminates processing with the status.
従つて、概要説明で述べた如く、当レコードを
読出し、必要処理を行なつた後、そのアドレス
“07”−1=“06”をサーチのエンド・アドレスと
して、検索のためのその他の条件は前回のまま検
索ユニツトを動作させると、今回の該当レコード
はi=270、そのアドレス“05”が検索され「複
数存在」のフラツグはオフとして終了する。従つ
て、今回以後はエンド・アドレスを初期値に戻
し、取出したレコードのキー値i=270に+1し
て、指示しなおす。この様にして、順次320、
408、670及び671が取出せ、さらに、もう1回の
アクセスで「該当なし」が返えり、全体の処理が
終了する。 Therefore, as mentioned in the overview, after reading this record and performing the necessary processing, use the address "07" - 1 = "06" as the end address of the search, and other conditions for the search. If the search unit is operated as before, the corresponding record this time is i=270, its address "05" will be searched, and the "multiple existence" flag will be turned off and the process will end. Therefore, from now on, the end address will be returned to its initial value, the key value i=270 of the retrieved record will be incremented by 1, and the instruction will be given again. In this way, 320,
408, 670, and 671 are retrieved, and another access returns "Not applicable" and the entire process ends.
なお、従来テクニツクでは、ソート処理中、同
一値のキーが発生すると、あらかじめプライオリ
テイを付けた複数のキーを設けておき、初めに優
先度の最も高いキーについて、ソート処理を行な
い、同一値が発生するたびに、次々に優先度の低
いキーについてソート処理を実行し、すべてを出
力または並び替えを行なうのが一般的方法であ
る。 In addition, in conventional techniques, when keys with the same value occur during sorting, multiple keys with priorities are set in advance, and the key with the highest priority is sorted first. A common method is to perform a sorting process on keys of lower priority one after another each time they occur, and then output or rearrange them all.
しかるに、前述の説明では、同一値のキー値レ
コードの識別情報として、その格納アドレスを採
用したが、本方式においても、第5図の如く、従
来ソートと同様に、あるキーで同一値が発生し、
「複数存在」のフラツグがセツトしたならば、
Cpuの制御により検索ユニツトへ、今までのキー
部(アイテム)に対しては、今回検索した、最大
または最小値のデータと等号比較の検索を指示
し、さらに、ソートのために約束された次順位の
プライオリテイのアイテムに対して最大または最
小値の検索を指示し、与えた条件がすべて満足す
るレコードのみを対象として、最大または最小値
を検索するように検索ユニツトに指示する。この
ことにより当ユニツトは前回のアイテムで等しい
値を有したレコードのみを対象に、今回のアイテ
ム中の最大or最小値を検索する。また、前述のプ
ライオリテイの深いキーのソート状態からステー
タス・フラツグの「該当なし」が返えれば、最大
または最小値検索の対象キーのプライオリテイを
浅くし、「複数存在」が返れば、反対に対象キー
のプライオリテイを深くすれば良い。従つて、両
者のステータス・フラツグが共にオフの場合のみ
基本的動作の「取出したレコードのキー値をイン
クリメントまたはデクリメントし、検索ユニツト
に指示しなおす」という動作を繰返せば良い。つ
まり本方式は、ソート処理時、同一値のキーを取
出す手段として、いずれの方式でも可能である。 However, in the above explanation, the storage address was used as identification information for key value records with the same value, but in this method as well, as shown in Figure 5, the same value occurs with a certain key, as in conventional sorting. death,
Once the “Multiple Existence” flag is set,
Under the control of the CPU, the search unit is instructed to search for the previously searched key part (item) using the data of the maximum or minimum value searched this time and an equal sign comparison. It instructs the search unit to search for the maximum or minimum value for the next priority item, and instructs the search unit to search for the maximum or minimum value only for records that satisfy all of the given conditions. As a result, this unit searches for the maximum or minimum value in the current item, targeting only records that had the same value in the previous item. In addition, if the status flag returns "Not applicable" from the sorting state of keys with deep priorities, the priority of the target key for maximum or minimum value search will be made shallow, and if "multiple existing" is returned, then the It is better to deepen the priority of the target key. Therefore, it is only necessary to repeat the basic operation of ``incrementing or decrementing the key value of the retrieved record and re-instructing the search unit'' only when both status flags are off. In other words, in this method, any method can be used as a means for extracting keys with the same value during sort processing.
以上述べた如く本発明による検索方式はメモリ
のワークエリアをとらないし、また、処理に要す
る時間を減少させることができる。 As described above, the search method according to the present invention does not take up a memory work area and can reduce the time required for processing.
第1図は本発明による検索方式の概要説明図、
第2図は本発明による検索方式を用いた検索ユニ
ツトのブロツク図、第3図は第2図に示すブロツ
ク図の作動説明図、第4図は第2図に示されるブ
ロツク図の検索説明図、第5図は本発明による検
索方式の他の実施例を説明する説明図である。
4,5……メモリ、17……フリツプ・フロツ
プ。
FIG. 1 is a schematic explanatory diagram of the search method according to the present invention;
Fig. 2 is a block diagram of a search unit using the search method according to the present invention, Fig. 3 is an explanatory diagram of the operation of the block diagram shown in Fig. 2, and Fig. 4 is an explanatory diagram of the search of the block diagram shown in Fig. 2. , FIG. 5 is an explanatory diagram illustrating another embodiment of the search method according to the present invention. 4, 5...memory, 17...flip/flop.
Claims (1)
出し手段、 検索条件となるデータを記憶する記憶手段、 前記読み出し手段によつて読み出されるデータ
が前記記憶手段に記憶された検索条件を満たすか
どうかを前記読み出し手段による読み出しに同期
して判定する判定手段、 前記判定手段による判定結果に基づいて、前記
検索条件となるデータを記憶する前記記憶手段の
データを変える制御手段、 とを有することを特徴とする検索装置。 2 前記検索条件のデータとして、前記格納手段
のアドレスを記憶する第2記憶手段を有し、前記
アドレスによつて、前記検索条件を指定する指定
手段を有することを特徴とする特許請求の範囲第
1項記載の検索装置。[Scope of Claims] 1. A storage means for storing searched data, a reading means for reading out the searched data from the storage means, a storage means for storing data serving as a search condition, and the data read by the reading means is determining means for determining whether a search condition stored in a storage means is satisfied in synchronization with reading by the reading means; and a storage means for storing data serving as the search condition based on a determination result by the determining means. A search device comprising: control means for changing data. 2. Claim 1, characterized in that it has a second storage means for storing an address of the storage means as the data of the search condition, and a designation means for specifying the search condition by the address. The search device according to item 1.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2365477A JPS53108743A (en) | 1977-03-04 | 1977-03-04 | Retrieval system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2365477A JPS53108743A (en) | 1977-03-04 | 1977-03-04 | Retrieval system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS53108743A JPS53108743A (en) | 1978-09-21 |
| JPS6132695B2 true JPS6132695B2 (en) | 1986-07-29 |
Family
ID=12116504
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2365477A Granted JPS53108743A (en) | 1977-03-04 | 1977-03-04 | Retrieval system |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPS53108743A (en) |
Families Citing this family (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS57172471A (en) * | 1981-04-17 | 1982-10-23 | Casio Comput Co Ltd | Searching system for electronic dictionary having extended memory |
| JPS58222341A (en) * | 1982-06-18 | 1983-12-24 | Fujitsu Ltd | Median filter circuit |
| JPS59103128A (en) * | 1982-10-11 | 1984-06-14 | Fujitsu Ltd | Processing result output system of card image processing data processor |
| JPS59133641A (en) * | 1983-01-20 | 1984-08-01 | Canon Inc | Information retrieving device |
| JPS59133640A (en) * | 1983-01-20 | 1984-08-01 | Canon Inc | Memory control system |
| JPS6074024A (en) * | 1983-09-30 | 1985-04-26 | Toshiba Corp | Documentation device |
-
1977
- 1977-03-04 JP JP2365477A patent/JPS53108743A/en active Granted
Also Published As
| Publication number | Publication date |
|---|---|
| JPS53108743A (en) | 1978-09-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US3275991A (en) | Memory system | |
| GB1491706A (en) | Information storage apparatus | |
| EP0923030A1 (en) | Data storage/retrieval system | |
| JPS6132695B2 (en) | ||
| US3508220A (en) | Fast access content-organized destructive readout memory | |
| US3431558A (en) | Data storage system employing an improved indexing technique therefor | |
| US4332014A (en) | Data retrieval system | |
| JPH0477938A (en) | Data storage method | |
| JP2573577B2 (en) | File access device | |
| JPH01297724A (en) | Learning type character string retriever and control system for the same | |
| JP2669241B2 (en) | Migration processing method | |
| JPS61151426A (en) | Data storage method | |
| JPH03174654A (en) | Filing method and its device | |
| JPH0557624B2 (en) | ||
| Klammer | Sorting on a multiple magnetic tape unit | |
| JPH0258167A (en) | Optical disk filing device | |
| US20120102267A1 (en) | Implementing enhanced data storage on removable media to optimize performance and relibility | |
| JPS62177642A (en) | File management system for postscript filing device | |
| JPS63253431A (en) | Retrieving system for data base of inverted structure | |
| JPH04165542A (en) | electronic filing device | |
| JPS6225346A (en) | Electronic journal file constitution system | |
| JPH0535554A (en) | File processing equipment | |
| JPH04299771A (en) | Data retrieving device | |
| JPH04353944A (en) | Record additional system for index order formation file | |
| JPH06149647A (en) | Multi-media file managing system |