JPH06103139A - Random file access method - Google Patents

Random file access method

Info

Publication number
JPH06103139A
JPH06103139A JP4277927A JP27792792A JPH06103139A JP H06103139 A JPH06103139 A JP H06103139A JP 4277927 A JP4277927 A JP 4277927A JP 27792792 A JP27792792 A JP 27792792A JP H06103139 A JPH06103139 A JP H06103139A
Authority
JP
Japan
Prior art keywords
record
stored
key
pointer
random organization
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
JP4277927A
Other languages
Japanese (ja)
Inventor
Yuji Hirano
裕司 平野
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 JP4277927A priority Critical patent/JPH06103139A/en
Publication of JPH06103139A publication Critical patent/JPH06103139A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To execute a forward access, as well in the order of storage by a random file which can execute a physical forward access and a direct access by designating a key. CONSTITUTION:In the case of storing records A, B and C in a random file in its order, the next record pointer 13 is added to each record, and a key of the record stored next to its record is set on its pointer 13. Also, a key (a) of the record A stored in the beginning is set in advance on the head record pointer FP on a memory. When the key (a) set on the pointer FP is designated and accessed, the record A stored in the beginning is read out, and when an access is executed by using a key (b) set on its next record pointer 13 of this read-out record A, the record B stored in the next time is read out. Moreover, when an access is executed by using a key set on its next record pointer 13, the record C stored in the end is read out.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は電子計算機におけるファ
イルアクセス制御に関し、特に乱編成ファイルアクセス
方法の改良に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to file access control in an electronic computer, and more particularly to improvement of a randomly organized file access method.

【0002】[0002]

【従来の技術】電子計算機におけるファイル編成には、
順編成,索引順編成,乱編成といった各種の編成があ
り、その各々に対しアクセス法が提供されている。
2. Description of the Related Art File organization in a computer is
There are various types of organization such as sequential organization, index sequential organization, and random organization, and access methods are provided for each of them.

【0003】個々のファイル編成には各々固有の特徴が
ある。即ち、順編成はキーによる直接アクセスは不可能
であるが格納順の順次アクセスが可能であり、索引順編
成は、キーによる直接アクセスとキー順の順次アクセス
が共に可能である。また、乱編成は、キーによる直接ア
クセスと物理的な順次アクセスとが可能である。
Each file organization has its own characteristics. That is, in the sequential organization, the direct access by the key is impossible, but the sequential access in the storage order is possible, and in the index sequential organization, both the direct access by the key and the sequential access in the key order are possible. Further, the random organization can be directly accessed by a key or physically sequentially accessed.

【0004】個々のファイル編成は上述したような固有
の特徴を有しているので、実際には計算機で実行する仕
事に適したファイル編成を選択して使用している。従っ
て、キーによる直接アクセスと物理的な順次アクセスと
の両アクセスを活用したい場合には、乱編成が採用され
ることになる。
Since each individual file organization has the unique characteristics described above, the file organization suitable for the work to be executed by the computer is actually selected and used. Therefore, when it is desired to utilize both the direct access by the key and the physical sequential access, the random organization is adopted.

【0005】[0005]

【発明が解決しようとする課題】ところで、乱編成ファ
イルを使って計算機で実行する仕事によっては、乱編成
ファイルに対し格納順の順次アクセスも行えると都合の
よいことがある。即ち、所謂FIFO的にレコードを出
し入れして処理する場合等である。
By the way, depending on the work to be executed by the computer using the random organization file, it may be convenient to be able to sequentially access the random organization file in the order of storage. That is, for example, when a record is taken in and out and processed by a so-called FIFO.

【0006】然るに、従来の乱編成ファイルに対するア
クセス法では、乱編成ファイルに対して格納順に順次ア
クセスを行うことができない。
However, according to the conventional method for accessing a randomly organized file, it is not possible to sequentially access the randomly organized file in the order of storage.

【0007】そこで本発明の目的は、乱編成ファイルに
対して格納順の順次アクセスも可能とすることにある。
Therefore, an object of the present invention is to enable sequential access in a storage order to a random organization file.

【0008】[0008]

【課題を解決するための手段】本発明は上記の目的を達
成するために、物理的な順次アクセスが行えると共にレ
コードのキーを指定することにより直接にレコードのア
クセスが行える乱編成ファイルを有する電子計算機にお
ける乱編成ファイルアクセス方法において、前記乱編成
ファイルに格納したレコードに付加した次レコードポイ
ンタに当該レコードの次に格納されたレコードのキーを
格納しておくことによって前記乱編成ファイルに格納さ
れたレコードをその格納順に関連付けておき、前記乱編
成ファイルに格納されたレコードのうち最初に格納され
たレコードのキーをメモリ上の先頭レコードポインタで
管理するようにしている。
In order to achieve the above object, the present invention provides an electronic device having a random organization file which enables physical sequential access and direct record access by designating a record key. In the random organization file access method in a computer, the key of the record stored next to the record is stored in the random organization file by storing the key of the record next to the record in the next record pointer added to the record stored in the random organization file. The records are associated in the order in which they are stored, and the key of the record stored first among the records stored in the random organization file is managed by the head record pointer on the memory.

【0009】[0009]

【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。
Embodiments of the present invention will now be described in detail with reference to the drawings.

【0010】図1は本発明の乱編成ファイルアクセス方
法の一実施例を適用した電子計算機の要部構成図であ
り、乱編成ファイル1と、乱編成ファイルアクセス機構
2と、乱編成ファイル1を利用するプログラム3と、プ
ログラム3が格納順による順次アクセスでも乱編成ファ
イル1をアクセスできるようにするための初期設定手段
7,レコード格納手段4,レコード取り出し手段5,メ
モリ6上の先頭レコードポインタFPおよび最後尾レコ
ードポインタEPとを含んでいる。
FIG. 1 is a block diagram of an essential part of an electronic computer to which an embodiment of the random organization file access method of the present invention is applied. A random organization file 1, a random organization file access mechanism 2 and a random organization file 1 are shown. The program 3 to be used, and the initial setting means 7 for allowing the program 3 to access the random organization file 1 even by sequential access in the storage order, the record storing means 4, the record extracting means 5, the first record pointer FP on the memory 6. And the last record pointer EP.

【0011】乱編成ファイル1には多数のレコードが格
納されるが、各レコードは両方向チェインによってその
格納順が管理される。
A large number of records are stored in the random organization file 1, and the storage order of each record is managed by a bidirectional chain.

【0012】即ち、図2に示すように、乱編成ファイル
1中の各レコードには、レコード本体11およびキー1
2以外に次レコードポインタ13と前レコードポインタ
14とが付加され、これら2つのポインタによって各レ
コードが両方向にチェイン付けられる。
That is, as shown in FIG. 2, each record in the random organization file 1 includes a record body 11 and a key 1.
In addition to 2, a next record pointer 13 and a previous record pointer 14 are added, and these two pointers chain each record in both directions.

【0013】図3は、乱編成ファイル1にレコードA,
レコードB,レコードCの順に3つのレコードを格納し
たときの様子を示しており、最初に格納されたレコード
Aの次レコードポインタ13にはその次に格納されたレ
コードBのキーbが、レコードBの次レコードポインタ
13にはその次に格納されたレコードCのキーcが、最
後に格納されたレコードCの次レコードポインタ13に
は当該レコードが最後のレコードであることを示すNU
LLが設定されている。また、最後に格納されたレコー
ドCの前レコードポインタ14にはその直前に格納され
たレコードBのキーbが、レコードBの前レコードポイ
ンタ14にはその直前に格納されたレコードAのキーa
が、最初に格納されたレコードAの前レコードポインタ
14には当該レコードが最初のレコードであることを示
すNULLが設定されている。
In FIG. 3, record A,
The figure shows a state in which three records are stored in the order of record B and record C, and the key b of the record B stored next to the record B is stored in the next record pointer 13 of the record A stored first. NU indicating that the key c of the record C stored next is stored in the next record pointer 13 of the next record pointer, and that the record is the last record in the next record pointer 13 of the record C stored last.
LL is set. Further, the previous record pointer 14 of the last stored record C has the key b of the record B stored immediately before it, and the previous record pointer 14 of the record B has the key a of the record A stored immediately before it.
However, the previous record pointer 14 of the first stored record A is set to NULL indicating that the record is the first record.

【0014】また、図3に示すようにメモリ6上の先頭
レコードポインタFPには最初に格納されたレコードA
のキーaが格納され、最後尾レコードポインタEPには
最後に格納されたレコードCのキーcが格納されてい
る。
Also, as shown in FIG. 3, the first record A stored in the first record pointer FP on the memory 6 is
Key a is stored, and the last record pointer EP stores the key c of the last stored record C.

【0015】以上のように乱編成ファイル1における各
レコードA,B,Cをその格納順にチェイン付けておく
ことにより、そのチェインをたどることによって格納順
に順次アクセスすることができるようになる。
As described above, by chaining the records A, B, and C in the random organization file 1 in the order in which they are stored, it is possible to access them sequentially in the order in which they are stored by following the chain.

【0016】以下、各部の詳細な機能と全体的な動作を
説明する。
The detailed functions and overall operation of each section will be described below.

【0017】プログラム3による乱編成ファイル1のフ
ァイルオープン時、先ず、初期設定手段7が起動され
る。
When the file of the random organization file 1 is opened by the program 3, first, the initial setting means 7 is activated.

【0018】初期設定手段7は、例えば図4に示すよう
に、先ず乱編成ファイルアクセス機構2を通じて乱編成
ファイル1を物理順にアクセスして1レコードを読み出
す(S1)。そして、乱編成ファイル1に1つもレコー
ドが格納されていないときは(S2でYES)、メモリ
6上の先頭レコードポインタFPおよび最後尾レコード
ポインタEPを共にNULLとし(S3)、処理を終え
る。
As shown in FIG. 4, for example, the initial setting means 7 first accesses the random organization file 1 in the physical order through the random organization file access mechanism 2 and reads one record (S1). Then, when no record is stored in the random organization file 1 (YES in S2), both the first record pointer FP and the last record pointer EP on the memory 6 are set to NULL (S3), and the process ends.

【0019】他方、乱編成ファイル1からレコードが読
み出された場合(S2でNO)、処理S4〜S9を実行
することにより、乱編成ファイル1の最後のレコードま
での各レコードに基づき、以下の処理を行う。
On the other hand, when a record is read from the random organization file 1 (NO in S2), the processes S4 to S9 are executed to determine the following records based on the records up to the last record of the random organization file 1. Perform processing.

【0020】(1)読み出したレコードの前レコードポ
インタ14がNULLであれば(S5でYES)、その
レコードは最初に格納されたレコードであるので、その
レコードのキーの値を先頭レコードポインタFPに設定
する(S7)。
(1) If the previous record pointer 14 of the read record is NULL (YES in S5), that record is the first stored record, so the key value of that record is set to the first record pointer FP. Set (S7).

【0021】(2)読み出したレコードの次レコードポ
インタ13がNULLであれば(S6でYES)、その
レコードは最後に格納されたレコードであるので、その
レコードのキーの値を最後尾レコードポインタEPに設
定する(S8)。
(2) If the next record pointer 13 of the read record is NULL (YES in S6), that record is the last stored record, so the key value of that record is set to the end record pointer EP. (S8).

【0022】従って、例えば乱編成ファイル1に図3に
示したような3つのレコードA,B,Cが格納されてい
る場合、初期設定手段7の上述した処理により、先頭レ
コードポインタFPにはレコードAのキーaが、最後尾
レコードポインタEPにはレコードCのキーcが設定さ
れることになる。
Therefore, for example, when three records A, B, and C as shown in FIG. 3 are stored in the random organization file 1, the first record pointer FP is set to the record by the above-mentioned processing of the initial setting means 7. The key a of A and the key c of the record C are set at the last record pointer EP.

【0023】なお、以下、乱編成ファイル1にレコード
が順次格納されていく様子を説明するために、最初は乱
編成ファイル1には1つもレコードが格納されておら
ず、従って初期設定手段7のS3の処理によって先頭レ
コードポインタFPおよび最後尾レコードポインタEP
にNULLが設定されたものとする。
In order to explain how the records are sequentially stored in the random organization file 1, no records are initially stored in the random organization file 1, and therefore the initial setting means 7 does not store any records. By the process of S3, the first record pointer FP and the last record pointer EP
Is set to NULL.

【0024】次にこの状態でプログラム3が乱編成ファ
イル1に、レコード本体とキーaを有するレコードAの
格納を要求したとすると、その要求をレコード格納手段
4が受け取り、レコード格納手段4は例えば図5に示す
処理を開始する。
Next, in this state, if the program 3 requests the random organization file 1 to store the record A having the record body and the key a, the record storage means 4 receives the request, and the record storage means 4 receives, for example, The process shown in FIG. 5 is started.

【0025】先ず、レコードAに図2で説明した次レコ
ードポインタ13および前レコードポインタ14用の領
域を付加する(S11)。
First, the areas for the next record pointer 13 and the previous record pointer 14 described in FIG. 2 are added to the record A (S11).

【0026】次に、その次レコードポインタ13にNU
LLを設定する(S12)。
Next, NU is set to the next record pointer 13.
LL is set (S12).

【0027】次に、その前レコードポインタ14に最後
尾レコードポインタEPに設定されているキーを格納す
る(S13)。従って、最後尾レコードポインタEPが
NULLになっている現状の場合、レコードAの前レコ
ードポインタ14にはNULLが格納される。
Next, the key set in the last record pointer EP is stored in the previous record pointer 14 (S13). Therefore, in the present situation where the last record pointer EP is NULL, the previous record pointer 14 of the record A stores NULL.

【0028】また、最後尾レコードポインタEPの値が
NULLであったため(S14でYES)、先頭レコー
ドポインタFPに今回格納するレコードAのキーaを設
定し(S15)、このレコードAを乱編成ファイルアク
セス機構2を通じて乱編成ファイル1に書き出す(S1
6)。そして、最後尾レコードポインタEPに今回格納
したレコードAのキーaを設定し(S20)、処理を終
了する。
Since the value of the last record pointer EP is NULL (YES in S14), the key a of the record A to be stored this time is set in the first record pointer FP (S15), and this record A is stored in the random organization file. Write to the random organization file 1 through the access mechanism 2 (S1
6). Then, the key a of the record A stored this time is set in the last record pointer EP (S20), and the process ends.

【0029】以上のようなレコードAの格納処理が行わ
れることにより、乱編成ファイル1の内容およびメモリ
6上の内容は図6に示すようになる。
By performing the storage processing of the record A as described above, the contents of the random organization file 1 and the contents on the memory 6 become as shown in FIG.

【0030】次にプログラム3が乱編成ファイル1に、
レコード本体とキーbを有するレコードBの格納を要求
したとすると、その要求をレコード格納手段4が受け取
り、図5に示す処理を開始する。
Next, the program 3 is stored in the random organization file 1,
If it is requested to store the record B having the record body and the key b, the record storage means 4 receives the request and starts the processing shown in FIG.

【0031】先ず、レコードBに図2で説明した次レコ
ードポインタ13および前レコードポインタ14用の領
域を付加し(S11)、その次レコードポインタ13に
NULLを設定する(S12)。
First, the areas for the next record pointer 13 and the previous record pointer 14 described in FIG. 2 are added to the record B (S11), and NULL is set to the next record pointer 13 (S12).

【0032】次に、その前レコードポインタ14に最後
尾レコードポインタEPに設定されているキーaを格納
し(S13)、最後尾レコードポインタEPがNULL
でないので(S14でNO)、処理S17〜処理S20
を実行する。
Next, the key a set in the last record pointer EP is stored in the previous record pointer 14 (S13), and the last record pointer EP is NULL.
Since it is not (NO in S14), processing S17 to processing S20
To execute.

【0033】先ず、最後尾レコードポインタEPの値a
をキーとして指定して乱編成ファイルアクセス機構2を
通じて乱編成ファイル1からそのキーaを持つレコード
Aを読み出す(S17)。
First, the value a of the last record pointer EP
Is designated as a key and the record A having the key a is read from the random organization file 1 through the random organization file access mechanism 2 (S17).

【0034】次に、この読み出したレコードAの次レコ
ードポインタ13に今回格納するレコードBのキーbを
格納する(S18)。
Next, the key b of the record B to be stored this time is stored in the next record pointer 13 of the read record A (S18).

【0035】次に、以上の2つのレコードA,Bを乱編
成ファイルアクセス機構2を通じて乱編成ファイル1に
書き出す(S19)。
Next, the above two records A and B are written to the random organization file 1 through the random organization file access mechanism 2 (S19).

【0036】そして、最後尾レコードポインタEPに今
回格納したレコードBのキーbを設定し(S20)、処
理を終了する。
Then, the key b of the record B stored this time is set in the last record pointer EP (S20), and the process is terminated.

【0037】以上のようなレコードBの格納処理が行わ
れることにより、乱編成ファイル1の内容およびメモリ
6上の内容は図6から図7に示すように変更される。
By performing the storage processing of the record B as described above, the contents of the random organization file 1 and the contents on the memory 6 are changed as shown in FIGS.

【0038】次にプログラム3が乱編成ファイル1に、
レコード本体とキーcを有するレコードCの格納を要求
したとすると、レコード格納手段4が図5に示す処理を
行うことにより、乱編成ファイル1およびメモリ6上の
内容は図7から図3に示したような内容に変更される。
Next, the program 3 is added to the random organization file 1,
If it is requested to store the record C having the record body and the key c, the record storage means 4 performs the processing shown in FIG. 5, so that the contents of the random organization file 1 and the memory 6 are shown in FIG. 7 to FIG. It will be changed to something like.

【0039】次に乱編成ファイル1に格納されたレコー
ドをFIFO方式で取り出す際の動作を説明する。な
お、本実施例では、取り出したレコードを乱編成ファイ
ル1から削除するモードと削除しないモードとの2種類
が用意されている。先ず、取り出したレコードを削除し
ながらFIFO方式でレコードを格納順に取り出す動作
を説明する。
Next, the operation for extracting the record stored in the random organization file 1 by the FIFO method will be described. In the present embodiment, there are prepared two types of modes, that is, a mode of deleting the retrieved record from the random organization file 1 and a mode of not deleting it. First, the operation of fetching the records in the storage order by the FIFO method while deleting the fetched records will be described.

【0040】図3に示したように乱編成ファイル1に3
つのレコードA,B,Cが格納されている状態で、プロ
グラム3が削除を伴う格納順の読み出し要求を出すと、
その要求はレコード取り出し手段5で受け取られ、レコ
ード取り出し手段5は図8に示す処理を実行する。
As shown in FIG. 3, 3 in random organization file 1
When the program 3 issues a read request in the order of storage accompanied by deletion in a state in which one record A, B, and C is stored,
The request is received by the record extracting means 5, and the record extracting means 5 executes the processing shown in FIG.

【0041】先ず、メモリ6上の先頭レコードポインタ
FPの値aをキーにして乱編成ファイルアクセス機構2
を通じ乱編成ファイル1からレコードAを読み出す(S
31)。なお、この読み出したレコードAはプログラム
3に通知される。
First, the random organization file access mechanism 2 using the value a of the first record pointer FP on the memory 6 as a key
Record A is read from random file 1 through
31). The read record A is notified to the program 3.

【0042】削除を伴うので、処理S32から処理S3
3へ進み、処理S31で読み出したレコードAの次レコ
ードポインタ13がNULLか否かを判定する。今の場
合、レコードAの次レコードポインタ13はキーbなの
で、その判定結果はNOとなり、処理S34へ進む。
Since deletion is involved, processing S32 to processing S3
In step S3, it is determined whether the next record pointer 13 of the record A read in the process S31 is NULL. In this case, since the next record pointer 13 of the record A is the key b, the determination result is NO, and the process proceeds to step S34.

【0043】処理S34では、処理S31で読み出した
レコードAの次レコードポインタ13の値bをキーとし
て乱編成ファイルアクセス機構2を通じて乱編成ファイ
ル1からレコードBを読み出す。
In step S34, the record B is read from the random organization file 1 through the random organization file access mechanism 2 using the value b of the next record pointer 13 of the record A read in step S31 as a key.

【0044】次にこのレコードBの前レコードポインタ
14にNULLを格納し(S35)、処理S31で読み
出したレコードAを乱編成ファイルアクセス機構2を通
じ乱編成ファイル1から削除する(S36)。
Next, NULL is stored in the previous record pointer 14 of this record B (S35), and the record A read in the process S31 is deleted from the random organization file 1 through the random organization file access mechanism 2 (S36).

【0045】次に処理S35の処理を施したレコードB
を乱編成ファイルアクセス機構2を通じて乱編成ファイ
ル1に書き出し(S37)、メモリ6上の先頭レコード
ポインタFPにレコードBのキーbを設定し(S3
8)、処理を終える。
Next, the record B subjected to the processing of the processing S35
Is written to the random organization file 1 through the random organization file access mechanism 2 (S37), and the key b of the record B is set in the head record pointer FP on the memory 6 (S3).
8), the process is completed.

【0046】以上のようなレコードAの取り出し処理が
行われることにより、乱編成ファイル1およびメモリ6
上の内容は図3から図9に示すような変更される。
By performing the record A retrieval processing as described above, the random organization file 1 and the memory 6
The above contents are changed as shown in FIGS.

【0047】次にプログラム3が削除を伴う格納順の読
み出し要求を再度送出すると、レコード取り出し手段5
が図8に示す処理を実行することにより、レコードBが
乱編成ファイル1から取り出されてプログラム3に通知
される。そして、乱編成ファイル1およびメモリ6の内
容は図9から図10に示すように変更される。
Next, when the program 3 again sends a read request in the storage order accompanied by deletion, the record extracting means 5
By executing the processing shown in FIG. 8, the record B is extracted from the random organization file 1 and notified to the program 3. Then, the contents of the random organization file 1 and the memory 6 are changed as shown in FIGS.

【0048】そして更にプログラム3が削除を伴う格納
順の読み出し要求を送出すると、レコード取り出し手段
5が図8に示す処理を実行してレコードCを読み出し、
それをプログラム3に通知する。このとき、レコードC
の次レコードポインタ13はNULLなので、処理S3
3の判定結果はYESとなり、レコードCが乱編成ファ
イル1から削除された後(S39)、メモリ6上の先頭
レコードポインタFPおよび最後尾レコードポインタE
Pが共にNULLにされる(S40)。
When the program 3 further issues a read request in the storage order accompanied by deletion, the record fetching means 5 executes the processing shown in FIG. 8 to read the record C,
Notify it to program 3. At this time, record C
Since the next record pointer 13 of is NULL, processing S3
The determination result of 3 is YES, and after the record C is deleted from the random organization file 1 (S39), the first record pointer FP and the last record pointer E on the memory 6 are recorded.
Both P are set to NULL (S40).

【0049】以上のようにして、格納順による順次アク
セスを可能にしている。
As described above, sequential access in the storage order is possible.

【0050】また、削除を伴わないレコードの取り出し
は以下のように行われる。
Further, the record extraction without deletion is performed as follows.

【0051】図3に示したように乱編成ファイル1に3
つのレコードA,B,Cが格納されている状態で、プロ
グラム3が削除を伴わない格納順の読み出し要求を出す
と、レコード取り出し手段5は図8に示す処理を開始
し、先ず、メモリ6上の先頭レコードポインタFPの値
aをキーにして乱編成ファイルアクセス機構2を通じ乱
編成ファイル1からレコードAを読み出し(S31)、
プログラム3に通知する。そして、削除を伴わないので
図8の処理を終了する。
As shown in FIG. 3, 3 in random organization file 1
When the program 3 issues a read request in the storage order without deletion while one record A, B, and C is stored, the record extracting means 5 starts the process shown in FIG. The record a is read from the random organization file 1 through the random organization file access mechanism 2 using the value a of the first record pointer FP of the key as a key (S31),
Notify Program 3. Then, since the deletion is not performed, the processing of FIG. 8 ends.

【0052】プログラム3は受け取ったレコードAの次
に格納されたレコードを読み出す場合、レコードAの次
レコードポインタ13に設定されたキーbをキー指定し
た読み出し要求をレコード取り出し手段5に送出するこ
とにより、レコードBを読み出す。更にレコードBの次
に格納されたレコードCを読み出すときは直前に読み出
したレコードBの次レコードポインタ13に設定された
キーcを使用する。
When the program 3 reads the record stored next to the received record A, the program 3 sends to the record fetching means 5 a read request specifying the key b set in the next record pointer 13 of the record A. , Record B is read. Further, when reading the record C stored next to the record B, the key c set in the next record pointer 13 of the record B read immediately before is used.

【0053】このようにすることにより、乱編成ファイ
ル1に格納されたレコードを削除することなく格納順に
順次アクセスすることができる。
By doing so, the records stored in the random organization file 1 can be sequentially accessed in the storage order without being deleted.

【0054】最後に、任意のキーを指定して乱編成ファ
イル1からレコードを読み出し、この読み出したレコー
ドを乱編成ファイル1から削除する動作を説明する。
Finally, an operation of reading a record from the random organization file 1 by designating an arbitrary key and deleting the read record from the random organization file 1 will be described.

【0055】図3に示したように乱編成ファイル1に3
つのレコードA,B,Cが格納されている状態で、プロ
グラム3が例えばキーbを指定して読み出しとその削除
とを要求すると、その要求はレコード取り出し手段5で
受け付けられ、レコード取り出し手段5は例えば図11
に示す処理を実行する。
As shown in FIG. 3, 3 in random organization file 1
When the program 3 specifies, for example, the key b and requests reading and deletion in the state where the one record A, B, and C are stored, the request is accepted by the record extracting means 5, and the record extracting means 5 For example, in FIG.
The process shown in is executed.

【0056】先ず、指定されたキーbを乱編成ファイル
アクセス機構2に指定して該機構2を通じ乱編成ファイ
ル1からレコードBを読み出す(S51)。なお、この
読み出したレコードBはプログラム3に通知される。
First, the designated key b is designated to the random organization file access mechanism 2, and the record B is read from the random organization file 1 through the mechanism 2 (S51). The read record B is notified to the program 3.

【0057】次に削除を伴う要求なので、レコードBの
削除後のチェインを変更するために処理S53以降の処
理を行う。
Next, since it is a request involving deletion, the processing after the processing S53 is performed in order to change the chain after the deletion of the record B.

【0058】先ず、上記読み出したレコードBの次レコ
ードポインタ13がNULLか否かを判定する(S5
3)。図3に示した場合、レコードBの次レコードポイ
ンタ13はNULLでなくキーcなので、その判定結果
はNOとなり、次にこの次レコードポインタ13の値c
をキーとして乱編成ファイルアクセス機構2を通じて乱
編成ファイル1からレコードCを読み出す(S54)。
そして、この読み出したレコードCの前レコードポイン
タ14にレコードBの前レコードポインタ14の値すな
わちaを格納する(S55)。
First, it is determined whether the next record pointer 13 of the read record B is NULL (S5).
3). In the case shown in FIG. 3, since the next record pointer 13 of the record B is not NULL but the key c, the determination result is NO, and the value c of the next record pointer 13 is next.
The record C is read from the random organization file 1 through the random organization file access mechanism 2 with the key as a key (S54).
Then, the value of the previous record pointer 14 of the record B, that is, a is stored in the previous record pointer 14 of the read record C (S55).

【0059】次に、レコードBの前レコードポインタ1
4がNULLか否かを判定する(S57)。今の場合N
ULLでなくaなので、その判定結果はNOとなり、次
にその値aをキーとして乱編成ファイル1からレコード
Aを読み出す(S58)。そして、このレコードAの次
レコードポインタ13にレコードBの次レコードポイン
タ13の値すなわちcを格納する(S59)。
Next, the previous record pointer 1 of the record B
It is determined whether 4 is NULL (S57). In this case N
Since it is not UL but a, the determination result is NO, and then the record A is read from the random organization file 1 using the value a as a key (S58). Then, the value of the next record pointer 13 of the record B, that is, c is stored in the next record pointer 13 of the record A (S59).

【0060】そして、今回読み出したレコードBを乱編
成ファイル1から削除し(S61)、レコードA,Cを
乱編成ファイル1へ書き出し(S62)、図11の処理
を終了する。
Then, the record B read this time is deleted from the random organization file 1 (S61), the records A and C are written to the random organization file 1 (S62), and the processing of FIG. 11 is terminated.

【0061】以上のようなレコードBの取り出し処理に
より、乱編成ファイル1およびメモリ6の内容は図3か
ら図12に示すように変更される。
By the process of extracting the record B as described above, the contents of the random organization file 1 and the memory 6 are changed as shown in FIGS.

【0062】なお、図12に示したレコードCに対しキ
ーcを指定した取り出しとその削除とが要求された場
合、レコードCの次レコードポインタ13はNULLな
ので、図11に示す処理S56が実行されて最後尾レコ
ードポインタEPがレコードCの前レコードポインタ1
4の値すなわちaに変更される。また、図12に示した
レコードAに対しキーaを指定した取り出しとその削除
とが要求された場合、レコードAの前レコードポインタ
14はNULLなので、図11に示す処理S60が実行
されて先頭レコードポインタFPにレコードAの次レコ
ードポインタ13の値すなわちcが設定される。
When the record C shown in FIG. 12 is requested to be fetched with the key c and deleted, the next record pointer 13 of the record C is NULL, so the process S56 shown in FIG. 11 is executed. The last record pointer EP is the previous record pointer 1 of the record C.
The value is changed to 4 or a. Further, when the fetching specifying the key a and the deletion thereof are requested for the record A shown in FIG. 12, since the previous record pointer 14 of the record A is NULL, the processing S60 shown in FIG. The value of the next record pointer 13 of the record A, that is, c is set in the pointer FP.

【0063】また、削除を伴わないキー指定による読み
出しの場合、レコード取り出し手段5はその旨を図11
の処理S52で判別し、処理S53以降のチェインの張
り替え処理は行わない。
Further, in the case of the reading by the key designation without the deletion, the record extracting means 5 indicates that.
The determination is made in the processing S52 of step S52, and the chain replacement processing after the processing S53 is not performed.

【0064】[0064]

【発明の効果】以上説明したように本発明の乱編成ファ
イルアクセス方法は、乱編成ファイルに格納したレコー
ドに付加した次レコードポインタに当該レコードの次に
格納されたレコードのキーを格納しておくことによって
乱編成ファイルに格納されたレコードをその格納順に関
連付けておき、そして、乱編成ファイルに格納されたレ
コードのうち最初に格納されたレコードのキーをメモリ
上の先頭レコードポインタで管理するようにしたので、
先頭レコードポインタに保持されたキーを指定してレコ
ードをアクセスすることにより、乱編成ファイルに最初
に格納されたレコードが読み出せる。そして、読み出し
たレコードの次レコードポインタに設定されたキーを指
定して順次アクセスしていけば、乱編成ファイルを格納
順に順次アクセスすることが可能となる。
As described above, according to the random organization file access method of the present invention, the key of the record stored next to the record is stored in the next record pointer added to the record stored in the random organization file. By doing so, the records stored in the random organization file are associated in the order in which they are stored, and the key of the record stored first among the records stored in the random organization file is managed by the first record pointer on the memory. Because I did
The record stored first in the random organization file can be read by accessing the record by designating the key held in the head record pointer. Then, if the key set in the next record pointer of the read record is designated and the sequential access is performed, the random organization files can be sequentially accessed in the storage order.

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

【図1】本発明の乱編成ファイルアクセス方法の一実施
例を適用した電子計算機の要部構成図である。
FIG. 1 is a configuration diagram of essential parts of an electronic computer to which an embodiment of a randomized file access method of the present invention is applied.

【図2】乱編成ファイルに格納されるレコードの構成例
を示す図である。
FIG. 2 is a diagram showing a configuration example of a record stored in a random organization file.

【図3】乱編成ファイルに3つのレコードA,B,Cが
格納されている様子を示す図である。
FIG. 3 is a diagram showing how three records A, B, and C are stored in a random organization file.

【図4】初期設定手段の処理例を示すフローチャートで
ある。
FIG. 4 is a flowchart showing a processing example of an initial setting means.

【図5】レコード格納手段の処理例を示すフローチャー
トである。
FIG. 5 is a flowchart showing a processing example of a record storage means.

【図6】乱編成ファイルに最初のレコードAが格納され
たときの様子を示す図である。
FIG. 6 is a diagram showing a state in which a first record A is stored in a random organization file.

【図7】乱編成ファイルに2番目のレコードBが格納さ
れたときの様子を示す図である。
FIG. 7 is a diagram showing a state in which a second record B is stored in a random organization file.

【図8】レコード取り出し手段の格納順アクセス処理の
一例を示すフローチャートである。
FIG. 8 is a flowchart showing an example of a storage order access process of a record extracting unit.

【図9】図3の状態から最初のレコードAを削除したと
きの様子を示す図である。
9 is a diagram showing a state when the first record A is deleted from the state of FIG.

【図10】図9の状態から2番目のレコードBを削除し
たときの様子を示す図である。
10 is a diagram showing a state when the second record B is deleted from the state of FIG.

【図11】レコード取り出し手段のキー指定による読み
出し処理の一例を示すフローチャートである。
FIG. 11 is a flowchart showing an example of a reading process by specifying a key of a record extracting unit.

【図12】図3の状態からレコードBを削除したときの
様子を示す図である。
FIG. 12 is a diagram showing a state when record B is deleted from the state of FIG.

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

1…乱編成ファイル 2…乱編成ファイルアクセス機構 3…乱編成ファイル1を利用するプログラム 4…レコード格納手段 5…レコード取り出し手段 6…メモリ 7…初期設定手段 FP…先頭レコードポインタ EP…最後尾レコードポインタ 1 ... Random organization file 2 ... Random organization file access mechanism 3 ... Program using random organization file 1 4 ... Record storage means 5 ... Record retrieval means 6 ... Memory 7 ... Initial setting means FP ... First record pointer EP ... last record Pointer

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 物理的な順次アクセスが行えると共にレ
コードのキーを指定することにより直接にレコードのア
クセスが行える乱編成ファイルを有する電子計算機にお
ける乱編成ファイルアクセス方法において、 前記乱編成ファイルに格納したレコードに付加した次レ
コードポインタに当該レコードの次に格納されたレコー
ドのキーを格納しておくことによって前記乱編成ファイ
ルに格納されたレコードをその格納順に関連付けてお
き、 前記乱編成ファイルに格納されたレコードのうち最初に
格納されたレコードのキーをメモリ上の先頭レコードポ
インタで管理するようにしたことを特徴とする乱編成フ
ァイルアクセス方法。
1. A random organization file access method in an electronic computer having a random organization file which enables physical sequential access and direct record access by designating a record key, wherein the random organization file is stored in the random organization file. By storing the key of the record stored next to the record in the next record pointer added to the record, the records stored in the random organization file are associated with each other in the order of storage and stored in the random organization file. A randomly organized file access method characterized in that the key of the first stored record among the stored records is managed by the first record pointer on the memory.
JP4277927A 1992-09-22 1992-09-22 Random file access method Pending JPH06103139A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4277927A JPH06103139A (en) 1992-09-22 1992-09-22 Random file access method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4277927A JPH06103139A (en) 1992-09-22 1992-09-22 Random file access method

Publications (1)

Publication Number Publication Date
JPH06103139A true JPH06103139A (en) 1994-04-15

Family

ID=17590228

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4277927A Pending JPH06103139A (en) 1992-09-22 1992-09-22 Random file access method

Country Status (1)

Country Link
JP (1) JPH06103139A (en)

Similar Documents

Publication Publication Date Title
EP0284664A2 (en) Method of rapidly opening disc files identified by path names
JPS5943787B2 (en) Read error handling method
JP2007501449A (en) Method, apparatus, and computer program for processing a queue of messages
US5410694A (en) File access processing system of a computer enabling high-speed sequential access for a stream file
JPS5942897B2 (en) Text data content transfer device
JP2539347B2 (en) File management method
JPH06103139A (en) Random file access method
US5170479A (en) File block managing system using next record header position data and delete history data from block header and record headers to locate requested record block
JPH06131229A (en) Method for information processing and device therefor
JPH096653A (en) Data base checking information processor
JP2828354B2 (en) Database management device
JPH11513160A (en) Execution method of iterative search
JP2504843B2 (en) Buffer expansion device
JP3056566B2 (en) FIFO table memory and control method therefor
JP2586610B2 (en) File creation method
JP2856003B2 (en) Asynchronous data input / output method
JP2912657B2 (en) File access processor
JPH01112446A (en) System for controlling internal data
JPH04336340A (en) Disk cache access control system
JPH02208750A (en) File access system
JP3019104B2 (en) File processing device
JPH03218545A (en) Pre-loading system for main storage
JP2000099533A (en) File access method/system
JP2988048B2 (en) Dictionary information resident access device
JPH01191240A (en) Cyclic organization file processing system