JPH0447427A - File updating device - Google Patents

File updating device

Info

Publication number
JPH0447427A
JPH0447427A JP2152674A JP15267490A JPH0447427A JP H0447427 A JPH0447427 A JP H0447427A JP 2152674 A JP2152674 A JP 2152674A JP 15267490 A JP15267490 A JP 15267490A JP H0447427 A JPH0447427 A JP H0447427A
Authority
JP
Japan
Prior art keywords
update
record
file
updating
status
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
JP2152674A
Other languages
Japanese (ja)
Inventor
Yoshiaki Yuyama
好章 湯山
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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co Ltd
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 Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP2152674A priority Critical patent/JPH0447427A/en
Publication of JPH0447427A publication Critical patent/JPH0447427A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To efficiently execute the file updating processing by executing the updating by whether the designated updating kind and the record concerned exist or not at first, and by the designated updating kind and the previous updating state in a second time or thereafter, and rewriting a file in the end of the processing. CONSTITUTION:In the case there are plural updating records of the same key, at the time of first updating, tables I in an updating state table 13 and a record sate table 14 are referred to, and in accordance with whether the record concerned exists or not, an updating state is determined, and held in a register 17. Subsequently, the record concerned read out of a file 23 is expanded onto work memory 20, and in accordance with the determined updating state, the updating processing is executed on the work memory 20. At the time of updating in second time or thereafter, tables II in the table 13 and the table 14 are referred to, and in accordance with the previous updating state held in the register, the record concerned is subjected to updating processing on the work memory 20. Next, when the updating records of the same key are all processed, a file 16 is updated by the record updated on the memory 20. By suppressing the number of times of a file access to the minimum, the file updating processing is executed efficiently.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は、オフィスコンピュータ等において、ファイル
上のレコードをリアルタイムで更新させる機能を備えた
ファイル更新装置に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a file update device in an office computer or the like that has a function of updating records on a file in real time.

[発明の概要] 本発明のファイル更新装置は、同一キーレコードに対し
て複数回の更新を行なう際、最初は更新用レコードによ
り指定される更新種及び該当レコードの有無により今回
の更新状態を決定し、2回目以降は更新用レコードによ
り指定される更新種及び前回の更新状態により今回の更
新状態を決定してワークメモリ上で更新処理を行ない、
同一キーレコードに対する処理の最後にファイルを書替
えるようにしたものである。
[Summary of the Invention] When updating the same key record multiple times, the file update device of the present invention initially determines the current update state based on the update type specified by the update record and the presence or absence of the corresponding record. However, from the second time onwards, the current update state is determined based on the update type specified by the update record and the previous update state, and the update process is performed on the work memory.
The file is rewritten at the end of processing for the same key record.

[従来技術] 従来のオフィスコンピュータ等におけるファイル更新装
置は、既に作成されているファイルに対して更新を行な
う場合、他のプロセスによりデー夕が書替えられないよ
うにファイル全体にロックを掛け、ファイル単位にレコ
ード情報を更新するこの場合、同一のレコードに対して
複数の更新用レコードがある場合、レコード更新処理を
行なう毎にソースファイルに対するレコードの書込み/
読出しを行なうようにしている。
[Prior Art] When updating a file that has already been created, a conventional file update device in an office computer, etc. locks the entire file to prevent the data from being rewritten by other processes, and locks the entire file in file units. In this case, if there are multiple update records for the same record, the record information will be written/written to the source file each time the record update process is performed.
I am trying to read it.

例えば第8図に示すようにソースファイル1に記憶され
ているレコードfに対し、3つの更新用レコード2A、
2B、2Cがある場合、まず、上記レコードfがメモリ
3aに読出される。そしてこのメモリ3aに読出された
レコードfが最初の更新用レコード2人に基づいて更新
処理(4a)される。例えばレコードfの特定のフィー
ルド“数量゛に更新用レコード2Aの“数量″′Aが加
算され、その加算結果rf+AJがソースファイル1に
書込まれる。
For example, as shown in FIG. 8, for record f stored in source file 1, three update records 2A,
If there are 2B and 2C, first, the record f is read to the memory 3a. Then, the record f read into the memory 3a is updated (4a) based on the first two update records. For example, the "quantity" A of the update record 2A is added to the specific field "quantity" of the record f, and the addition result rf+AJ is written to the source file 1.

次いで上記ソースファイル1から更新したレコードf 
(f十A)がメモリ3bに読出され、次の更新用レコー
ド2Bに基づいて更新処理(4b)される。例えばレコ
ードfの特定のフィールド“金額゛に更新用レコード2
Bの“金額”Bが加算され、その加算結果rf+A+B
Jがソースファイル1に書込まれる。
Next, record f updated from the above source file 1
(f1A) is read out to the memory 3b, and updated (4b) is performed based on the next update record 2B. For example, record 2 for updating a specific field “amount” of record f.
“Amount” B of B is added, and the addition result is rf+A+B
J is written to source file 1.

次に上記ソースファイル1がら更新したレコードf (
f+A+B)がメモリ3cJ:読出され、次の更新用レ
コード2Cに基づいて更新処理(4c)される。例えば
レコードfの特定のフィールド“在庫″から更新用レコ
ード2cの“引当“Cが減算され、その減算結果rf+
A+B−CJがソースファイル1に書込まれる。
Next, record f (
f+A+B) is read out from the memory 3cJ and updated (4c) based on the next update record 2C. For example, "reservation" C of update record 2c is subtracted from a specific field "inventory" of record f, and the subtraction result rf+
A+B-CJ is written to source file 1.

[発明が解決しようとする課題] 上記従来のファイル更新装置は、同一のレコードに対し
て複数の更新用レコードがある場合、各更新用レコード
に基づいてファイル更新を行なう毎に、ファイルに対し
て読出し/書込み処理を行なわなければならず、この結
果、ファイルに対するアクセス回数が多くなって処理効
率が低下するという問題があった。
[Problems to be Solved by the Invention] The conventional file update device described above, when there are multiple update records for the same record, updates the file each time the file is updated based on each update record. Reading/writing processing must be performed, resulting in a problem in that the number of accesses to the file increases and processing efficiency decreases.

このような原因は、同一のレコードに対して複数の更新
処理を行なう場合、処理に際して更新状態を記憶してお
らず、従って、1つの更新処理を終了する毎に、その処
理結果をファイルに書込んで記憶させなければならない
ところにあると考えられる。
The reason for this is that when multiple update processes are performed on the same record, the update status is not memorized during the process, and therefore the processing results are written to a file each time one update process is completed. It is thought that it is necessary to memorize it in detail.

してみれば、同一のレコードに対して複数の更新処理を
行なう場合、最初の更新時は指定更新種と該当レコード
の有無により今回の更新状態を決定すると共に記憶して
ワークメモリ上での更新処理を行ない、2回目以降は指
定更新種と前回の更新状態により更新状態を決定して上
記ワークメモリ上での更新処理を行ない、同一レコード
に対する最後の処理でファイルを書替えるようi、: 
t i ハ、ファイルアクセス回数を減少し得ることは
明らがである。
Therefore, when performing multiple update processing on the same record, at the first update, the current update status is determined based on the specified update type and the presence or absence of the corresponding record, and the current update status is stored and updated in the work memory. From the second time onward, the update status is determined based on the specified update type and the previous update status, and the update process is performed on the work memory, and the file is rewritten in the last process for the same record.
It is clear that the number of file accesses can be reduced.

本発明の課題は、同一のレコードに対して複数の更新処
理を行なう場合、ファイルアクセス回数を最小限に抑え
てファイル更新処理を効率的に行ない得るファイル更新
装置を提供することである。
An object of the present invention is to provide a file update device that can minimize the number of file accesses and efficiently perform file update processing when multiple update processing is performed on the same record.

[課題を解決するための手段] 本発明の手段は次の通りである。[Means to solve the problem] The means of the present invention are as follows.

同一キーの更新用レコードが複数ある場合、最初の更新
の際、更新用レコードにより指定される更新種及びファ
イル内の該当レコードの有無に応じて更新状態を決定し
、該当レコードをワークメモリ上に展開して上記決定更
新状態に従って上記ワークメモリ上での更新を行なう第
1の更新手段。
If there are multiple update records with the same key, at the first update, the update status is determined according to the update type specified by the update record and the presence or absence of the corresponding record in the file, and the corresponding record is stored in the work memory. first updating means for expanding and updating on the work memory according to the determined update state;

例えば更新状態テーブル13及びレコード状態テーブル
14内のテーブルIを参照して更新用バッファ19上で
更新処理するCPUIIである。
For example, the CPU II refers to Table I in the update status table 13 and record status table 14 and performs update processing on the update buffer 19.

2回目以降の更新の際は、更新用レコードにより指定さ
れる更新種及び上記前回の更新状態に応じて今回の更新
状態を決定し、この決定された更新状態に従って上記ワ
ークメモリ上の該当レコードの更新を行なう第2の更新
手段。
For the second and subsequent updates, the current update status is determined according to the update type specified by the update record and the previous update status, and the corresponding record in the work memory is updated according to the determined update status. A second updating means for updating.

例えば更新状態テーブル13及びレコード状態テーブル
14内のテーブル■を参照して更新用バッファ19上で
更新処理するCPUI 1である。
For example, the CPU 1 refers to table (2) in the update status table 13 and record status table 14 and performs update processing on the update buffer 19.

上記第2の更新手段により同一キーの更新用レコードが
処理されて無くなったとき、上記ワークメモリ上で更新
されたレコードによりファイルを更新するファイル更新
手段。
File updating means for updating the file with the updated record on the work memory when the updating record of the same key is processed by the second updating means.

例えば更新用バッファ19の内容によりソースファイル
23を書替えるCPUI 1である。
For example, the CPU 1 rewrites the source file 23 based on the contents of the update buffer 19.

[作用] 本発明の手段の作用は次の通りである。[Effect] The operation of the means of the invention is as follows.

同一キーの更新用レコードが複数ある場合、最初の更新
の際、更新状態テーブル及びレコード状態テーブル内の
テーブル■を参照し、更新用レコードにより指定される
更新種及びファイル内の該当レコードの有無に応じて更
新状態を決定し、レジスタに保持する。そして、ファイ
ルから読出した該当レコードをワークメモリ上に展開し
、上記の決定された更新状態に従ってワークメモリ上で
更新処理する。
If there are multiple update records with the same key, at the first update, refer to the update status table and the table ■ in the record status table, and check the update type specified by the update record and the presence or absence of the corresponding record in the file. The update state is determined accordingly and held in the register. Then, the corresponding record read from the file is developed on the work memory and updated on the work memory according to the update state determined above.

2回目以降の更新の際は、更新状態テーブル及びレコー
ド状態テーブル内のテーブル■を参照し、更新用レコー
ドにより指定される更新種及び上記レジスタに保持して
いる前回の更新状態に応じて今回の更新状態を決定し、
レジスタに保持する。
For the second and subsequent updates, refer to the update status table and the table ■ in the record status table, and update the current update status according to the update type specified by the update record and the previous update status held in the register above. Determine the update status,
Hold in register.

このレジスタに保持された更新状態に従って該当レコー
ドをワークメモリ上で更新処理する。
The corresponding record is updated on the work memory according to the update state held in this register.

そして、上記2回目以降の更新により同一キーの更新用
レコードが全て処理されると、上記ワークメモリ上で更
新されたレコードによりファイルを更新して更新処理を
終了する。
Then, when all update records with the same key are processed in the second and subsequent updates, the file is updated with the updated records on the work memory, and the update process ends.

[実施例] 以下、一実施例を第1図ないし第7図を参照しながら説
明する。
[Example] An example will be described below with reference to FIGS. 1 to 7.

第1図は、全体の構成を示すブロック図である。FIG. 1 is a block diagram showing the overall configuration.

同図において、符号11は回路全体の制御を行なうCP
Uで、このCPU11にはパスライン12を介して更新
状態テーブル13、レコード状態テーブル14、更新用
レコードレジスタ15、更新用レコードファイル16、
更新状態レジスタ17、レコード状態レジスタ18、更
新用バッファ19、ワークメモリ20、更新状態管理メ
モリ21、バックアップメモリ22、ソースファイル2
3が接続される。
In the figure, reference numeral 11 indicates a CP that controls the entire circuit.
U, this CPU 11 is provided with an update state table 13, a record state table 14, an update record register 15, an update record file 16,
Update status register 17, record status register 18, update buffer 19, work memory 20, update status management memory 21, backup memory 22, source file 2
3 is connected.

更新状態テーブル13には、第2図(a)、(b)に示
す更新状態テーブル■、■が設定される。
In the update state table 13, update state tables ① and ② shown in FIGS. 2(a) and 2(b) are set.

第2図(a)の更新状態テーブルは、同一ファイルの同
一レコードに対して最初の処理を実行する時の管理状態
を示すもので、更新種とファイル上のレコードの有無に
よって「削」  「追」、r訂」、「集」、「エラー」
の状態が設定されている。これらの各状態において、 「削」 :削除を意味し、レコードなしの状態にする、 「追」 :追加を意味し、レコードを新規に作成する、 r訂」 二訂正を意味し、対象レコードのフィールドの
値にフィールドの内容を修正する、「集」 :集計で対
象レコードのフィールドの値を加算する、 ことを示している。
The update status table in Figure 2 (a) shows the management status when the first process is executed for the same record in the same file, and it shows the management status when the first process is executed for the same record in the same file. ", r-revised", "collection", "error"
state is set. In each of these states, ``delete'' means deletion, leaving a record without a record, ``addition'' means addition, creating a new record, and ``revision'' means correction, which means changing the target record. Modify the field contents to the field value, "Collection": Indicates that the field value of the target record is added in the aggregation.

また、更新種としては、■「削除」、■「追加」、■「
追加・訂正」、■「追加・集計」、■「訂正」、■「集
計」の6種類がある。
In addition, the update types include ■"Delete", ■"Add", ■"
There are six types: ``Addition/Correction'', ``Addition/Tally'', ``Correction'', and ■ ``Tally''.

上記更新種は、更新用レコードの作成に際して次のよう
な使い分けを行なう。
The above update types are used as follows when creating an update record.

追加:該当キーのレコードがファイル内に無ければ追加
したいが、有れば更新の必要が無い場合。
Add: If there is no record with the relevant key in the file, you want to add it, but if there is, there is no need to update it.

訂正、削除、集計:該当キーのレコードがファイル内に
有れば更新処理(訂正、削除、集計)したいが、無けれ
ば更新の必要が無い場合。
Correction, deletion, aggregation: If there is a record with the relevant key in the file, you want to update it (correction, deletion, aggregation), but if there is no record, there is no need to update it.

追加・訂正、追加・集計:該当キーのレコードにより必
ず更新する必要が有る場合。
Addition/Correction, Addition/Aggregation: When it is necessary to update the record of the corresponding key.

上記更新状態テーブルIにおいて、例えば今回の更新種
が「削除」の場合、ファイル上のレコードがあれば「削
除」、レコードが無ければ「エラー」として更新状態を
認識する。
In the update status table I, for example, if the current update type is "delete", the update status is recognized as "delete" if there is a record on the file, and as "error" if there is no record.

第2図(b)に示す更新状態テーブル■は、更新種と前
回の更新状態との関係を示している。同一レコードに対
して2回目以降の更新を行なう場合、前回のレコード状
態と今回の更新種によりレコード状態を認識するもので
、その際に更新状態テーブル■が使用される。なお、今
回の更新種が「削除」で、前回のレコード状態が「追」
、r訂」、「集」であること、及び今回の更新種が「追
加」で、前回のレコード状態がr訂」、r集Jであるこ
とは、更新種が■「削除」■「追加」 ■「追加・訂正
」 ■「追加・集計」、■「訂正」、■「集計」の昇順
にソートされていることを前提としているために論理的
に有り得ないので、状態設定は行なっていない。
The update state table (2) shown in FIG. 2(b) shows the relationship between the update type and the previous update state. When updating the same record for the second time or later, the record status is recognized based on the previous record status and the current update type, and the update status table (2) is used at this time. Please note that the update type this time is "Delete" and the previous record status is "Add".
, r-revised", "collection", and the current update type is "addition", and the previous record status is r-revised", r-collection J. ” ■ “Add/Correct” ■ “Add/Tally” ■ “Correction” ■ “Tally” Sort in ascending order, so it is logically impossible, so the status is not set. .

上記更新状態テーブル■において、今回の更新種が例え
ば「訂正」の場合、前回の更新状態がr削」であれば「
エラー」、それ以外であれば「訂正」として更新状態を
認識する。
In the above update status table ■, if the current update type is, for example, "correction", and the previous update status is "remove", then "
If not, the update status is recognized as "Error", otherwise it is recognized as "Correction".

また、レコード状態テーブル14には、第3図(a)、
(b)に示すレコード状態テーブルI。
In addition, the record status table 14 includes FIG. 3(a),
Record status table I shown in (b).

■が設定される。■ is set.

第3図(a)のレコード状態テーブルIは、同一ファイ
ルの同一レコードに対して最初の処理を実行する時のレ
コード状態を示すもので、上記6種の更新種とファイル
上のレコードの有無によってrDELJ、「エラー」、
rRWTJ、rAPDJ状態が決定される。これらの各
状態において、 DEL:ファイル上のレコード削除、 エラm:は論理的矛盾発生、 RWT :ファイル上のレコード書替、APD :ファ
イルへのレコード追加、を示している。
Record status table I in Figure 3(a) shows the record status when the first process is executed for the same record in the same file, and it shows the record status depending on the six types of updates mentioned above and the presence or absence of records on the file. rDELJ, "Error",
rRWTJ, rAPDJ states are determined. In each of these states, DEL: Deletion of a record on a file, Error m: Occurrence of logical contradiction, RWT: Rewriting of a record on a file, APD: Addition of a record to a file.

そして、第3図(b)に示すレコード状態テーブル■は
、更新種と前回のレコード状態との関係を示している。
The record status table (2) shown in FIG. 3(b) shows the relationship between the update type and the previous record status.

同一レコードに対して2回目以降の更新を行なう場合、
前回のレコード状態と今回の更新種によりレコード状態
を認識するもので、その際にレコード状態テーブル■が
使用される。
When updating the same record for the second time or later,
The record status is recognized based on the previous record status and the current update type, and the record status table ■ is used at this time.

なお、今回の更新種が「削除」の場合、前回のレコード
状態がrAPDj、rRWTJであることは、上記した
ように更新種によりソートされていることを前提として
いるために論理的に有り得ないので、状態設定は行なっ
ていない。
Note that if the current update type is "delete", it is logically impossible for the previous record status to be rAPDj, rRWTJ because it is assumed that the records are sorted by update type as described above. , no state setting is performed.

更新状態管理メモリ21には、第4図に示すようにファ
イル識別子21a1対象レコードのレングス21b1対
象レコードのキーワード数21c1対象レコードのレコ
ード番号21d、更新状態21eルコード状態21fが
、更新対象レコードの数だけ設定される。上記ファイル
識別子21aは更新対象ファイルのオーブン時の識別子
、対象レコードのレングス21bはバックアップした更
新対象レコードのレングス、対象レコードのキーワード
数21cは更新対象レコードのキーワード数、対象レコ
ードのレコード番号21dは更新対象レコードの物理レ
コード番号を示している。
As shown in FIG. 4, the update status management memory 21 contains a file identifier 21a, length of the target record 21b, number of keywords of the target record 21c, record number 21d of the target record, update status 21e, code status 21f, as many as the number of records to be updated. Set. The above file identifier 21a is the oven identifier of the file to be updated, the length of the target record 21b is the length of the backed up record to be updated, the number of keywords in the target record 21c is the number of keywords in the record to be updated, and the record number 21d of the target record is the update Indicates the physical record number of the target record.

また、更新状態21eは第2図における「削除」、「追
加」、「訂正」、「集計」の状態を示し、レコード状態
21fは第3図における更新レコードの状態モードを示
している。
Further, the update status 21e indicates the status of "deletion", "addition", "correction", and "totalization" in FIG. 2, and the record status 21f indicates the status mode of the update record in FIG. 3.

更新用レコードファイル16には、第5図に示すように
「ファイル名」、「更新種」、「キーワードK」、「デ
ータワードA」〜「データワードG」からなる更新用レ
コードが記憶される。
As shown in FIG. 5, the update record file 16 stores update records consisting of "file name", "update type", "keyword K", and "data word A" to "data word G". .

また、ソースファイル23には、第6図に示すように「
キーワードK」、「データワードA」〜「データワード
G」からなるソースレコードが記憶される。
Also, in the source file 23, as shown in FIG.
A source record consisting of "keyword K" and "data word A" to "data word G" is stored.

次に上記実施例の動作を説明する。Next, the operation of the above embodiment will be explained.

予め作成された更新用レコードは、更新用レコードファ
イル16に蓄えられている。そして、この更新用レコー
ドファイル16に蓄えられた更新用レコードにより、ソ
ースファイル23に対スるファイル更新が行なわれる。
Update records created in advance are stored in an update record file 16. Then, the source file 23 is updated using the update record stored in the update record file 16.

以下、このファイル更新の処理動作を第7図のフローチ
ャートに従って説明する。このフローチャートは、CP
UIIの制御に従って実行される。
The processing operation of this file update will be explained below according to the flowchart of FIG. This flowchart is
Executed under the control of the UII.

まず、更新用レコードファイル16に記憶されている更
新用レコードをキー分類別に、つまり、■「削除」、■
「追加」、■「追加・訂正」、■「追加・集計」、■「
訂正」、■「集計」の昇順にソートする(ステップAl
)。上記のソート処理は、ワークメモリ20を利用して
行なわれる。
First, update records stored in the update record file 16 are classified by key classification, that is, ■ "Delete", ■
"Add", ■ "Addition/Correction", ■ "Addition/Aggregation", ■ "
Sort in ascending order of "Correction" and ■"Tally" (Step Al
). The above sorting process is performed using the work memory 20.

このソート終了後、更新用レコードファイル16から更
新用レコードを更新用レコードレジスタ15に読出しく
ステップA2)、ソースファイル23上に該当するレコ
ードが存在するか否かを判断する(ステップA3)。そ
して、このファイル上のレコードの有無と今回の更新種
に基づいて、更新状態テーブル13及びレコード状態テ
ーブル14の内のテーブルI(第2図(a)、第3図(
a)参照)より、今回の更新状態、レコード状態を読出
しくステップA4)、エラーであるか否かを判別する(
ステップA5)。この場合、更新状態テーブル13及び
レコード状態テーブル14の何れにおいても、更新種が
「追加」であればレコード有りの状態、更新種が「削除
」、「訂正」、「集計」であればレコード無しの状態が
エラーとなる。
After this sorting is completed, the update record is read from the update record file 16 into the update record register 15 (step A2), and it is determined whether the corresponding record exists in the source file 23 (step A3). Then, based on the presence or absence of records in this file and the current update type, Table I of the update status table 13 and record status table 14 (Fig. 2 (a), Fig. 3 (
Read the current update status and record status from step A4) and determine whether there is an error (see step A4).
Step A5). In this case, in both the update status table 13 and the record status table 14, if the update type is "Add", there is a record, and if the update type is "Delete", "Correction", or "Aggregation", there is no record. status is an error.

上記ステップA5でエラーと判断された場合は、ステッ
プA6のエラー処理を実行し、エラーでなければ上記更
新状態を更新状態レジスタ17に、レコード状態をレコ
ード状態レジスタ18に記憶する(ステップA7)。そ
して、上記更新用レコードレジスタ15に保持している
更新用レコード、更新状態レジスタ17及びレコード状
態レジスタ18の保持データから第4図に示す更新状態
管理レコードを作成し、更新状態管理メモリ21に記憶
する(ステップA8)。
If an error is determined in step A5, the error processing in step A6 is executed, and if there is no error, the update status is stored in the update status register 17 and the record status is stored in the record status register 18 (step A7). Then, the update state management record shown in FIG. 4 is created from the update record held in the update record register 15, the data held in the update status register 17, and the record status register 18, and is stored in the update status management memory 21. (Step A8).

更に、上記レコード状態レジスタ18に保持されている
レコード状態がrRWT (書替)」、rAPD(追加
)」、rDEL(削除)」の何れであるかを判別しくス
テップA9 ) 、rRWTJであればステップAl0
1rAPDjであればステップAL4、rDELJであ
ればステップA1gの処理に進む。
Furthermore, it is determined whether the record status held in the record status register 18 is rRWT (rewrite), rAPD (addition), or rDEL (deletion) (step A9); if rRWTJ, step Al0
If it is 1rAPDj, the process proceeds to step AL4, and if it is rDELJ, the process proceeds to step A1g.

上記レコード状態レジスタ18におけるレコード状態が
rRWTJでステップAIOに進んだ場合、ソースファ
イル23における更新対象ファイルの該当レコードを外
部からアクセスできないようにロックする。次いで上記
該当レコードをバックアップメモリ22に書き込んでバ
ックアップする(ステップA11)。その後、ソースフ
ァイル23から上記の該当レコードを更新用バッファ1
9に読出して、更新用レコードレジスタ15に保持して
いる更新用レコードにより修正する(ステップA12.
 A13)。
When the record status in the record status register 18 is rRWTJ and the process proceeds to step AIO, the corresponding record of the update target file in the source file 23 is locked so that it cannot be accessed from the outside. Next, the corresponding record is written to the backup memory 22 and backed up (step A11). After that, the above corresponding record is transferred from the source file 23 to the update buffer 1.
9 and corrected using the update record held in the update record register 15 (step A12.
A13).

上記レコード状態レジスタ18におけるレコード状態が
rAPDJでステップA14に進んだ場合、ソースファ
イル23における対象ファイルを更新し、その該当レコ
ードをロックする(ステップA15)。次いで上記該当
レコードをバックアップメモリ22に書き込んでバック
アップすると共に、その該当レコードを更新用バッファ
19へ転送する(ステップAle、 A17)。
When the record status in the record status register 18 is rAPDJ and the process proceeds to step A14, the target file in the source file 23 is updated and the corresponding record is locked (step A15). Next, the corresponding record is written to the backup memory 22 for backup, and the corresponding record is transferred to the update buffer 19 (step Ale, A17).

上記レコード状態レジスタ18におけるレコード状態が
rDELJでステップAL8に進んだ場合、ソースファ
イル23における対象ファイルの該当レコードをロック
する。次いで上記該当レコードをバックアップメモリ2
2に書き込んでバックアップすると共に、その該当レコ
ードを更新用バッファ19へ転送する(ステップA20
. A21)。
When the record status in the record status register 18 is rDELJ and the process advances to step AL8, the corresponding record of the target file in the source file 23 is locked. Next, back up the above records to memory 2.
2 to back it up, and transfer the corresponding record to the update buffer 19 (step A20).
.. A21).

そして、上記ステップAI3、A17、A20の処理を
終了すると、ステップA21に進んで更新用レコードフ
ァイル16から次の更新用レコードを更新用レコードレ
ジスタ15に読出し、前回と同一キーか否かを判別する
(ステップA22)。
When the processes of steps AI3, A17, and A20 are completed, the process proceeds to step A21, where the next update record is read from the update record file 16 to the update record register 15, and it is determined whether the key is the same as the previous one. (Step A22).

前回と同一キーの場合は、今回の指定更新種と、更新状
態レジスタ17、レコード状態レジスタ18に保持され
ている前回の更新状態、レコード状態に基づいて、更新
状態テーブル13及びレコード状態テーブル14の内の
テーブル■(第2図(b)、第3図(b)参照)より、
今回の更新状態、レコード状態の読出しを行ない、エラ
ーか否かをチエツクする。この場合、更新状態テーブル
13では、前回の更新状態が「削」で今回の更新種とし
て「削除」、「訂正」、「集計」が指定された時、及び
前回の更新状態が「追」で今回の更新種として「追加」
が指定された時にエラーとなる。また、レコード状態テ
ーブル14では、前回の更新状態がrDELJで今回の
更新種として「削除」、「訂正」、「集計」が指定され
た時、前回の更新状態がAPDJで今回の更新種として
「追加」が指定された時、前回の更新状態が「RWTJ
で今回の更新種として「追加」が指定された時にエラー
となる。
If the key is the same as the previous one, the update status table 13 and record status table 14 are updated based on the current specified update type and the previous update status and record status held in the update status register 17 and record status register 18. From the table ■ (see Figures 2(b) and 3(b)),
The current update status and record status are read and checked to see if there is an error. In this case, in the update status table 13, when the previous update status is "Delete" and the current update type is "Delete", "Correction", or "Aggregation", and the previous update status is "Add". "Added" as this update type
An error occurs when specified. In addition, in the record status table 14, when the previous update status is rDELJ and the current update type is "delete", "correction", or "summarization", the previous update status is APDJ and the current update type is " When "Add" is specified, the previous update status is "RWTJ".
An error occurs when "Add" is specified as the update type for this time.

上記ステップA24でエラーと判断された場合は、エラ
ー処理(ステップA6)を実行し、エラーでなければ上
記更新状態テーブル13のテーブル■から読出した更新
状態を更新状態レジスタ17に、レコード状態テーブル
14のテーブル■から読出したレコード状態をレコード
状態レジスタ18に記憶する(ステップA25)。次い
で更新用バッファ19の内容を今回の更新用レコード及
び更新状態に基づいて更新する(ステップA26)。ま
た、上記更新用レコードレジスタ15に保持している更
新用レコード、更新状態レジスタ17及びレコード状態
レジスタ18の保持データから第4図に示す更新状態管
理レコードを作成し、更新状態管理メモリ21に記憶す
る(ステップA27)。
If it is determined that there is an error in step A24, error processing (step A6) is executed, and if there is no error, the update state read from table 2 of the update state table 13 is stored in the update state register 17 and recorded in the record state table 14. The record status read from table 2 is stored in the record status register 18 (step A25). Next, the contents of the update buffer 19 are updated based on the current update record and update status (step A26). Further, the update state management record shown in FIG. 4 is created from the update record held in the update record register 15, the data held in the update status register 17, and the record status register 18, and is stored in the update status management memory 21. (Step A27).

その後、上記ステップA21に進んで更新用レコードフ
ァイル16から次の更新用レコードを更新用レコードレ
ジスタ15に読出し、前回と同一キーか否かを判別する
(ステップA22)。
Thereafter, the process proceeds to step A21, where the next update record is read from the update record file 16 to the update record register 15, and it is determined whether the key is the same as the previous one (step A22).

前回と同一キーの場合は、上記ステップA23〜A27
の処理を繰り返し実行するが、同一キーでない場合は更
に更新用レコードファイル16に次のレコードが有るか
否かをチエツクする(ステップA28)。
If it is the same key as last time, follow steps A23 to A27 above.
The above process is repeatedly executed, but if the keys are not the same, it is further checked whether the next record exists in the update record file 16 (step A28).

更新用レコードファイル16に次のし・コードがある場
合は、レコード状態レジスタ18の記憶内容から、現在
のレコード状態がrAPDJ、rRWTJ、rDELJ
の何れであるかを判別する(ステップA29)。
If the update record file 16 has the following code, the current record status is rAPDJ, rRWTJ, rDELJ from the storage contents of the record status register 18.
(Step A29).

レコード状態がrAPDJの場合は、更に更新状態レジ
スタ17により現在の更新状態が「追加」、「訂正」、
「集計」の何れであるかを判別しくステップA30)、
「訂正」あるいは「集計」であれば更新用バッファ19
に保持されている内容をソースファイル23に書き込み
(ステップA31)、該当レコードをロックする(ステ
ップA32)。また、上記ステップA29おいて現在の
レコード状態がrRWTJであると判別された場合も上
記ステップA31SA32の処理を実行する。
When the record status is rAPDJ, the update status register 17 further indicates the current update status as "addition", "correction",
Step A30) to determine which one is “aggregation”;
If “correction” or “aggregation”, update buffer 19
The content held in is written to the source file 23 (step A31), and the corresponding record is locked (step A32). Also, when it is determined in step A29 that the current record status is rRWTJ, the processing in steps A31SA32 is also executed.

そして、上記ステップA32の処理を終了した場合、ス
テップA30で現在の更新状態が「追加」であると判別
された場合、ステップA29で現在のレコード状態がr
DELJであると判別された場合は、ステップA3に戻
り、更新用レコードレジスタ15に保持されている更新
用レコードに従って上記した処理を繰り返して実行する
When the process of step A32 is finished, if it is determined that the current update status is "addition" in step A30, the current record status is changed to r in step A29.
If it is determined that it is DELJ, the process returns to step A3 and the above-described process is repeated according to the update record held in the update record register 15.

上記した処理により更新用レコードファイル16に保持
されている更新用レコードが全て読出され、ステップA
28において更新用レコードファイル16には次のレコ
ードが記憶されていないと判断されると、ステップA3
3に進んで更新状態管理メモリ21から先頭レコードを
ワークメモリ20に読出し、そのレコード状態が「DE
L」であるか、または[A P DJ、rRWTJであ
るかを判別する(ステップA34)。
Through the above processing, all the update records held in the update record file 16 are read, and step A
If it is determined in step A28 that the next record is not stored in the update record file 16, step A3
Proceed to step 3 to read the first record from the update state management memory 21 to the work memory 20, and change the record state to "DE".
It is determined whether it is "L" or [A P DJ, rRWTJ (step A34).

レコード状態がrDELJの場合は、該当レコードをソ
ースファイル23から削除する。このステップA35の
処理を終了した場合、あるいは上記ステップA34でレ
コード状態がrADDJまたはrRWTJであると判別
された場合は、ステップAHに進んで、更新状態管理メ
モリ21からのレコード読出しを全て終了したか否かを
チエツクし、終了していなければ更新状態管理メモリ2
1から次のレコードをワークメモリ20に読出しくステ
ップA37)、その後、ステップA34に戻って同様の
処理を繰り返して実行する。そして、上記更新状態管理
メモリ21に記憶されているレコードに対する処理を全
て終了すると、ステップA36よりステップA38に進
んでソースファイル23における全レコードのロックを
解除し、ファイル更新処理を終了する。
If the record status is rDELJ, the corresponding record is deleted from the source file 23. If the process of step A35 is finished, or if it is determined in step A34 that the record status is rADDJ or rRWTJ, the process advances to step AH, and whether reading of all records from the update status management memory 21 is finished or not. Check if it is not completed, and if it is not completed, update status management memory 2
1 to the next record to the work memory 20 (step A37), and then returns to step A34 to repeat the same process. When all the processes for the records stored in the update state management memory 21 are completed, the process proceeds from step A36 to step A38, where all the records in the source file 23 are unlocked, and the file update process is ended.

なお、上記実施例では、同一キーに対する更新において
、追加は追加更新時に直ちにファイルを更新し、削除を
全レコードに対する更新終了後に一括して行なったが、
訂正、集計等と同様に同一キーに対する更新の最後でレ
コードの追加、または削除を行なうようにしてもよい。
Note that in the above embodiment, when updating the same key, additions are made to the file immediately upon update, and deletions are made at once after all records have been updated.
Similarly to correction, aggregation, etc., records may be added or deleted at the end of updating for the same key.

[発明の効果〕 以上詳記したように本発明によれば、同一キーレコード
に対して複数回の更新を行なう際、最初は指定更新種及
び該当レコードの有無により、2回目以降は指定更新種
及び前回の更新状態により今回の更新状態を決定してワ
ークメモリ上で更新を行ない、同一キーレコードに対す
る処理の最後にファイルを書替えるようにしたので、フ
ァイルに対するアクセス回数を最小限に抑えて、ファイ
ル更新処理を効率的に行なうことができる。
[Effects of the Invention] As described in detail above, according to the present invention, when updating the same key record multiple times, the specified update type is first updated based on the specified update type and the presence or absence of the corresponding record, and from the second time onwards, the specified update type is updated. The current update status is determined based on the previous update status and the update is performed on the work memory, and the file is rewritten at the end of processing for the same key record, so the number of accesses to the file is minimized. File update processing can be performed efficiently.

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

第1図は本発明の一実施例によるファイル更新装置の回
路構成を示すブロック図、第2図(a)。 (b)は更新状態テーブルの設定内容を示す図、第3図
(a)、(b)はレコード状態テーブルの設定内容を示
す図、第4図は更新状態管理メモリの記憶構成を示す図
、第5図は更新用レコードファイルのレコード形態を示
す図、第6図はソースファイルのレコード形態を示す図
、第7図はファイル更新処理を示すフローチャート、第
8図は従来のファイル更新装置の同一キーレコードに対
して複数回の更新を行なう際の処理動作を示す図である
。 11・・・CPU、12・・・パスライン、13・・・
更新状態テーブル、14・・・レコード状態テーブル、
15・・・更新用レコードレジスタ、16・・・更新用
レコードファイル、17・・・更新状態レジスタ、18
・・・レコード状態レジスタ、19 、、、更新用バッ
ファ、20・・・ワークメモリ、21・・・更新状態管
理メモリ、22・・・バックアップメモリ、23・、・
ソースファイル。
FIG. 1 is a block diagram showing the circuit configuration of a file updating device according to an embodiment of the present invention, and FIG. 2(a) is a block diagram showing the circuit configuration of a file updating device according to an embodiment of the present invention. (b) is a diagram showing the settings of the update status table, FIGS. 3(a) and (b) are diagrams showing the settings of the record status table, and FIG. 4 is a diagram showing the storage configuration of the update status management memory. Fig. 5 is a diagram showing the record format of the update record file, Fig. 6 is a diagram showing the record format of the source file, Fig. 7 is a flowchart showing the file update process, and Fig. 8 is the same as the conventional file update device. FIG. 3 is a diagram illustrating processing operations when updating a key record multiple times. 11...CPU, 12...Pass line, 13...
Update status table, 14... Record status table,
15... Update record register, 16... Update record file, 17... Update status register, 18
...Record status register, 19...Updating buffer, 20...Work memory, 21...Update status management memory, 22...Backup memory, 23...
source file.

Claims (1)

【特許請求の範囲】 同一キーの更新用レコードが複数ある場合、最初の更新
の際、更新用レコードにより指定される更新種及びファ
イル内の該当レコードの有無に応じて更新状態を決定し
、該当レコードをワークメモリ上に展開して上記決定更
新状態に従って上記ワークメモリ上での更新を行なう第
1の更新手段と、 2回目以降の更新の際は、更新用レコードにより指定さ
れる更新種及び上記前回の更新状態に応じて今回の更新
状態を決定し、この決定された更新状態に従って上記ワ
ークメモリ上での該当レコードの更新を行なう第2の更
新手段と、 上記第2の更新手段により同一キーの更新用レコードが
処理されて無くなったとき、上記ワークメモリ上で更新
されたレコードによりファイルを更新するファイル更新
手段と を具備したことを特徴とするファイル更新装置。
[Claims] When there are multiple update records with the same key, at the time of the first update, the update status is determined according to the update type specified by the update record and the presence or absence of the corresponding record in the file, a first update means for expanding a record on a work memory and updating the work memory according to the determined update state; a second update means that determines the current update state according to the previous update state and updates the corresponding record on the work memory according to the determined update state; 1. A file updating device comprising: file updating means for updating the file with the updated record on the work memory when the updating record is processed and disappears.
JP2152674A 1990-06-13 1990-06-13 File updating device Pending JPH0447427A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2152674A JPH0447427A (en) 1990-06-13 1990-06-13 File updating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2152674A JPH0447427A (en) 1990-06-13 1990-06-13 File updating device

Publications (1)

Publication Number Publication Date
JPH0447427A true JPH0447427A (en) 1992-02-17

Family

ID=15545629

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2152674A Pending JPH0447427A (en) 1990-06-13 1990-06-13 File updating device

Country Status (1)

Country Link
JP (1) JPH0447427A (en)

Similar Documents

Publication Publication Date Title
US5446884A (en) Database recovery apparatus and method
US7769714B2 (en) Automatic error correction for replication and instantaneous instantiation
US5870761A (en) Parallel queue propagation
US5197001A (en) Bill of material and project network processing
JP2972419B2 (en) Database operation control method
US5781912A (en) Recoverable data replication between source site and destination site without distributed transactions
US6216140B1 (en) Methodology for the efficient management of hierarchically organized information
US8370311B2 (en) Using versioning to back up multiple versions of a stored object
US6456995B1 (en) System, method and computer program products for ordering objects corresponding to database operations that are performed on a relational database upon completion of a transaction by an object-oriented transaction system
WO1995014273A9 (en) Method and system for tracking changed files
JPH11134235A (en) Recovery support method for external storage device failure
JPH08328933A (en) File access control system for parallel processing system
JPH0447427A (en) File updating device
JP2003515213A (en) Method and apparatus for persisting object-oriented data
US20060004846A1 (en) Low-overhead relational database backup and restore operations
JPH06274404A (en) Data storage managing method
JPH0447428A (en) File update device
JP3112785B2 (en) File management system
JP2850936B2 (en) Database update method
JP2658097B2 (en) Secondary file creation method
JP2000148562A (en) Data backup method, data backup device utilizing the method and computer readable recording medium recorded with data backup program
JPH02211557A (en) Database backup method
JPH0240740A (en) File update system
JP4319438B2 (en) Input information processing apparatus, program, storage medium, and input information processing method
JPH0259837A (en) Data recovery processing system