View previous topic :: View next topic
|
Author |
Message |
Gatbys
New User
Joined: 04 May 2008 Posts: 3 Location: Stockholm, Sweden
|
|
|
|
Hi,
While doing READ BY ISN, I have encountered a term "Double Update".
Can anyone please explain what is "Double Update"?
Thanks for your time.
Cheers,
Gatbys. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Working in Natural for 12 years, this is the first time I've heard of the term.
You said "I have encountered a term ...". Can you specify where? I couldn't find it in any of the formal manuals.
O. |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
This problem is more often referred to as "record migration" or "block migration." Often DBAs will recommend READ BY ISN as a means to avoid double updates.
Let's say that your company has had a banner year, so all employees are getting a 10% raise. The most efficient way to process an entire file is with a READ PHYSICAL, so you write
Code: |
DEFINE DATA LOCAL
1 EMP VIEW EMPLOYEES
2 PERSONNEL-ID
2 SALARY (1)
END-DEFINE
*
R.
READ EMP PHYSICAL
ASSIGN SALARY (1) = SALARY (1) * 1.10
DISPLAY PERSONNEL-ID
'New/Salary' SALARY (1)
UPDATE (R.)
--- et logic ---
END-READ
END |
It so happens that the first record processed has a salary go from 99,900 to 109,890. The record length has increased by 1 byte, but the Adabas block was full prior to the increase and the updated record will no longer fit back in this block. The record automatically is migrated by Adabas to another block, say block 100. Since you are performing a physical read, that same record will be processed again when block 100 is reached, receiving another 10% increase.
READ BY ISN avoids the problem, because each record/ISN is processed only once, regardless of block migrations. |
|
Back to top |
|
|
|