 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Strange problem with locking of records</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/</link>
	<description></description>
	<lastBuildDate>Sat, 18 May 2013 20:55:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: The Most-Watched IT Questions: September 13, 2011 - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-96495</link>
		<dc:creator>The Most-Watched IT Questions: September 13, 2011 - ITKE Community Blog</dc:creator>
		<pubDate>Tue, 13 Sep 2011 06:17:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-96495</guid>
		<description><![CDATA[[...] CharlieBrowne, Philpl1jb, TomLiotta, and Yorkshireman are trying to help solve a strange problem with locking of records.  6. CharlieBrowne, TomLiotta, Philpl1jb, and Bvining are helping a member complaining that RPG [...]]]></description>
		<content:encoded><![CDATA[<p>[...] CharlieBrowne, Philpl1jb, TomLiotta, and Yorkshireman are trying to help solve a strange problem with locking of records.  6. CharlieBrowne, TomLiotta, Philpl1jb, and Bvining are helping a member complaining that RPG [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yorkshireman</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95993</link>
		<dc:creator>yorkshireman</dc:creator>
		<pubDate>Wed, 31 Aug 2011 07:17:17 +0000</pubDate>
		<guid isPermaLink="false">#comment-95993</guid>
		<description><![CDATA[So

You have a database with 100 files referentially linked by key (account number) and the account number is being altered ?

Then for the duration of the process which alters the account nukmber, all records in the 100 files should be locked by the change process to avoid alteration by any other processes. ?  

a sequential  locking each record is not the same thing.  Or does you commit boundary take this into account?  


Did you read the manuals regarding record locks?
a cursory glance into the UDB Programming manual says

&lt;i&gt;Updating database records
The update operation allows you to change an existing database record in a logical or physical file. (The UPDAT statement in the RPG/400 language and the REWRITE statement in the COBOL/400 language are examples of this type operation.) Before you update a database record, the record must first be read and locked. The lock is obtained by specifying the update option on any of the read operations listed under the
“Reading database records using an arrival sequence access path” on page 168 or “Reading database  records using a keyed sequence access path” on page 169.
If you issue several read operations with the update option specified, each read operation releases the lock on the previous record before attempting to locate and lock the new record. When you do the update operation, the system assumes that you are updating the currently locked record. Therefore, you do not have to identify the record to be updated on the update operation. After the update operation is done, the
system releases the lock.
Note: The rules for locking are different if your job is running under commitment control. See the Backup and Recovery book for more details.
If the update operation changes a key field in an access path for which immediate maintenance is specified, the access path is updated if the high-level language allows it. (Some high-level languages do not allow changes to the key field in an update operation.)&lt;/i&gt;

So the next place to look is the Backup and recovery book.  


But the real answer, as stated, is probably to use SQL for such an update.]]></description>
		<content:encoded><![CDATA[<p>So</p>
<p>You have a database with 100 files referentially linked by key (account number) and the account number is being altered ?</p>
<p>Then for the duration of the process which alters the account nukmber, all records in the 100 files should be locked by the change process to avoid alteration by any other processes. ?  </p>
<p>a sequential  locking each record is not the same thing.  Or does you commit boundary take this into account?  </p>
<p>Did you read the manuals regarding record locks?<br />
a cursory glance into the UDB Programming manual says</p>
<p><i>Updating database records<br />
The update operation allows you to change an existing database record in a logical or physical file. (The UPDAT statement in the RPG/400 language and the REWRITE statement in the COBOL/400 language are examples of this type operation.) Before you update a database record, the record must first be read and locked. The lock is obtained by specifying the update option on any of the read operations listed under the<br />
“Reading database records using an arrival sequence access path” on page 168 or “Reading database  records using a keyed sequence access path” on page 169.<br />
If you issue several read operations with the update option specified, each read operation releases the lock on the previous record before attempting to locate and lock the new record. When you do the update operation, the system assumes that you are updating the currently locked record. Therefore, you do not have to identify the record to be updated on the update operation. After the update operation is done, the<br />
system releases the lock.<br />
Note: The rules for locking are different if your job is running under commitment control. See the Backup and Recovery book for more details.<br />
If the update operation changes a key field in an access path for which immediate maintenance is specified, the access path is updated if the high-level language allows it. (Some high-level languages do not allow changes to the key field in an update operation.)</i></p>
<p>So the next place to look is the Backup and recovery book.  </p>
<p>But the real answer, as stated, is probably to use SQL for such an update.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95987</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 30 Aug 2011 21:53:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-95987</guid>
		<description><![CDATA[Are these actual &quot;keys&quot; associated with indexes?

How are the files defined -- MAINT(*IMMED)? Where is the COMMIT in your code? I don&#039;t see any referenced, only rollback.

This would be far better done with SQL than trying to issue an I/O statement for every individual row.

Tom]]></description>
		<content:encoded><![CDATA[<p>Are these actual &#8220;keys&#8221; associated with indexes?</p>
<p>How are the files defined &#8212; MAINT(*IMMED)? Where is the COMMIT in your code? I don&#8217;t see any referenced, only rollback.</p>
<p>This would be far better done with SQL than trying to issue an I/O statement for every individual row.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95973</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Tue, 30 Aug 2011 15:23:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-95973</guid>
		<description><![CDATA[I appears that the reade works like this
- Can I get a lock on the record
  - no, error
- Yes, does the key match the key

So your critical READE&#039;s need to be preceeded with
- SETLL
- IF %equals
- READE 

or replace them with a CHAIN 
Phil]]></description>
		<content:encoded><![CDATA[<p>I appears that the reade works like this<br />
- Can I get a lock on the record<br />
  &#8211; no, error<br />
- Yes, does the key match the key</p>
<p>So your critical READE&#8217;s need to be preceeded with<br />
- SETLL<br />
- IF %equals<br />
- READE </p>
<p>or replace them with a CHAIN<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: charliebrowne</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95969</link>
		<dc:creator>charliebrowne</dc:creator>
		<pubDate>Tue, 30 Aug 2011 13:07:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-95969</guid>
		<description><![CDATA[Two things.
1. We need to see the code or the compile listing. Can you either post it here or email it to me at charlieb@themembersgroup.com
2. Have you ever considered doing this with SQL statements?]]></description>
		<content:encoded><![CDATA[<p>Two things.<br />
1. We need to see the code or the compile listing. Can you either post it here or email it to me at <a href="mailto:charlieb@themembersgroup.com">charlieb@themembersgroup.com</a><br />
2. Have you ever considered doing this with SQL statements?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: varun123</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95947</link>
		<dc:creator>varun123</dc:creator>
		<pubDate>Tue, 30 Aug 2011 00:24:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-95947</guid>
		<description><![CDATA[Hi CharlieBrown,

My program has more than 100 loops, and the purpose is to update the OLD_NUMBER with NEW_NUMBER...
So, all LOOP&#039;s just READE with OLD_NUMBER, and UPDATE to NEW_NUMBER.

When READE or READ encounters, my program is facing the RECORD LOCKING problem.... irrespective of the ACCOUNT NUMBER that I have locked.

However instead of READ, when I use CHAIN my code is working fine as expected. But I cannot change all the LOOPS, and all the PROGRAMS now... 

1) So, please advise me, if there is any wise way to handle this issue?
2) Why only CHAIN working, Why not READ?

Hope you understood this time.]]></description>
		<content:encoded><![CDATA[<p>Hi CharlieBrown,</p>
<p>My program has more than 100 loops, and the purpose is to update the OLD_NUMBER with NEW_NUMBER&#8230;<br />
So, all LOOP&#8217;s just READE with OLD_NUMBER, and UPDATE to NEW_NUMBER.</p>
<p>When READE or READ encounters, my program is facing the RECORD LOCKING problem&#8230;. irrespective of the ACCOUNT NUMBER that I have locked.</p>
<p>However instead of READ, when I use CHAIN my code is working fine as expected. But I cannot change all the LOOPS, and all the PROGRAMS now&#8230; </p>
<p>1) So, please advise me, if there is any wise way to handle this issue?<br />
2) Why only CHAIN working, Why not READ?</p>
<p>Hope you understood this time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: varun123</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95946</link>
		<dc:creator>varun123</dc:creator>
		<pubDate>Mon, 29 Aug 2011 23:44:10 +0000</pubDate>
		<guid isPermaLink="false">#comment-95946</guid>
		<description><![CDATA[Hi CharlieBrown

As I specified before, problem with the first and as well as second READ]]></description>
		<content:encoded><![CDATA[<p>Hi CharlieBrown</p>
<p>As I specified before, problem with the first and as well as second READ</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: varun123</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95945</link>
		<dc:creator>varun123</dc:creator>
		<pubDate>Mon, 29 Aug 2011 23:42:27 +0000</pubDate>
		<guid isPermaLink="false">#comment-95945</guid>
		<description><![CDATA[Hi All!

No, still you didn&#039;t get what I mean.....!  Forget about SETLL, READ every thing.. just see the below points. 

I locked Acc3 record belongs to #File1 and I called my program.
- Case 1:
       The Acc1 is the KEY under process. After SETLL, when READ encounters, the program says &quot;Acc3 RECORD LOCKED BY XXXX&quot;  

   #File1 for update
    ===========
    Acc1 X2   Y2
    Acc2  X1  Y1...
    Acc3  A1  B1...
    Acc3  A2  B2....
    Acc3  A3  B3....

- Case 2:
Take Acc2 as the key field, and also the same problem.

- Case 3:
Assume Acc3 as the key field, here *PSSR will handle anyway, as the Acc3 record is really locked. So Case 1 and Case 2 were affected?


1) As per my example stated before, 
how come the READE has been failed though the key passed is irrelevant to the record that was locked?

2) Why CHAIN is working, Why not READ/READE... any problem with sequential access in case of record locks?]]></description>
		<content:encoded><![CDATA[<p>Hi All!</p>
<p>No, still you didn&#8217;t get what I mean&#8230;..!  Forget about SETLL, READ every thing.. just see the below points. </p>
<p>I locked Acc3 record belongs to #File1 and I called my program.<br />
- Case 1:<br />
       The Acc1 is the KEY under process. After SETLL, when READ encounters, the program says &#8220;Acc3 RECORD LOCKED BY XXXX&#8221;  </p>
<p>   #File1 for update<br />
    ===========<br />
    Acc1 X2   Y2<br />
    Acc2  X1  Y1&#8230;<br />
    Acc3  A1  B1&#8230;<br />
    Acc3  A2  B2&#8230;.<br />
    Acc3  A3  B3&#8230;.</p>
<p>- Case 2:<br />
Take Acc2 as the key field, and also the same problem.</p>
<p>- Case 3:<br />
Assume Acc3 as the key field, here *PSSR will handle anyway, as the Acc3 record is really locked. So Case 1 and Case 2 were affected?</p>
<p>1) As per my example stated before,<br />
how come the READE has been failed though the key passed is irrelevant to the record that was locked?</p>
<p>2) Why CHAIN is working, Why not READ/READE&#8230; any problem with sequential access in case of record locks?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95943</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Mon, 29 Aug 2011 20:38:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-95943</guid>
		<description><![CDATA[Setll moves you to the desired record 
but it it doesn&#039;t exit it moves you to the next record in the index!
Ater a setll you need to check the %EQUAL condition to determine if an exact match occurred.

Phil]]></description>
		<content:encoded><![CDATA[<p>Setll moves you to the desired record<br />
but it it doesn&#8217;t exit it moves you to the next record in the index!<br />
Ater a setll you need to check the %EQUAL condition to determine if an exact match occurred.</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: charliebrowne</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-problem-with-locking-of-records/#comment-95930</link>
		<dc:creator>charliebrowne</dc:creator>
		<pubDate>Mon, 29 Aug 2011 16:10:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-95930</guid>
		<description><![CDATA[Is it the 1st READE or the 2nd READE?
What exacttly is your &quot;DO FOR ALL&quot; statement?]]></description>
		<content:encoded><![CDATA[<p>Is it the 1st READE or the 2nd READE?<br />
What exacttly is your &#8220;DO FOR ALL&#8221; statement?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/8 queries in 0.037 seconds using memcached
Object Caching 395/396 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-19 00:01:21 -->