 




<?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: error occurred while update my PF using rpgle program</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/</link>
	<description></description>
	<lastBuildDate>Mon, 20 May 2013 05:26:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: The Most-Watched IT Questions: March 6, 2012 - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104521</link>
		<dc:creator>The Most-Watched IT Questions: March 6, 2012 - ITKE Community Blog</dc:creator>
		<pubDate>Tue, 06 Mar 2012 17:07:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-104521</guid>
		<description><![CDATA[[...] 1. Pdsathiskum, Philpl1jb, TomLiotta try to solve the error when updating the PF using a RPGLE program. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 1. Pdsathiskum, Philpl1jb, TomLiotta try to solve the error when updating the PF using a RPGLE program. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104437</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sat, 03 Mar 2012 12:39:30 +0000</pubDate>
		<guid isPermaLink="false">#comment-104437</guid>
		<description><![CDATA[Adding an in-use flag to the file, presents other problems.  If the user updates the record the program sets the flag off.  If the user moves to another record or exits the screen the program sets the flag off.  But if the user is disconnected (closes the session) the flag is left in On status and the row will be in-use forever.  To correct that I put the Job# of the locking job in the &quot;flag&quot; field.  when a program found the field populated it checked to see if that was an active job.  If it wasn&#039;t active the record was considered as available for use.
Phil]]></description>
		<content:encoded><![CDATA[<p>Adding an in-use flag to the file, presents other problems.  If the user updates the record the program sets the flag off.  If the user moves to another record or exits the screen the program sets the flag off.  But if the user is disconnected (closes the session) the flag is left in On status and the row will be in-use forever.  To correct that I put the Job# of the locking job in the &#8220;flag&#8221; field.  when a program found the field populated it checked to see if that was an active job.  If it wasn&#8217;t active the record was considered as available for use.<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104429</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sat, 03 Mar 2012 00:55:23 +0000</pubDate>
		<guid isPermaLink="false">#comment-104429</guid>
		<description><![CDATA[&lt;i&gt;i don’t know how to solve this problem.&lt;/i&gt;

There are at least two ways to solve it. The first is as Phil described. Have a DS that your CHAINs load the fields into. Save a copy of the entire DS and compare it against the DS that you get with the second CHAIN. Any difference tells your program that the record has changed since the user first saw it.

The second way might be to CHAIN with lock both times. Immediately after the first CHAIN do an UPDATE that sets a flag in the record that says the record is in use. That first UPDATE will release the lock, but any other program that reads the record can test the flag to see if it is in use for updating. The record will be retrieved, but your logic will have to ensure that no changes are made until the record can be safely read.

Whatever way you decide to handle it, your program will need to do the testing and to notify the user about the problem. The user will need to choose to wait or to see the changed record or whatever.

As I mentioned earlier, this is why many programs don&#039;t handle the situation at all. The programs use a single CHAIN with lock and leave the record locked the entire time... because it&#039;s easier.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>i don’t know how to solve this problem.</i></p>
<p>There are at least two ways to solve it. The first is as Phil described. Have a DS that your CHAINs load the fields into. Save a copy of the entire DS and compare it against the DS that you get with the second CHAIN. Any difference tells your program that the record has changed since the user first saw it.</p>
<p>The second way might be to CHAIN with lock both times. Immediately after the first CHAIN do an UPDATE that sets a flag in the record that says the record is in use. That first UPDATE will release the lock, but any other program that reads the record can test the flag to see if it is in use for updating. The record will be retrieved, but your logic will have to ensure that no changes are made until the record can be safely read.</p>
<p>Whatever way you decide to handle it, your program will need to do the testing and to notify the user about the problem. The user will need to choose to wait or to see the changed record or whatever.</p>
<p>As I mentioned earlier, this is why many programs don&#8217;t handle the situation at all. The programs use a single CHAIN with lock and leave the record locked the entire time&#8230; because it&#8217;s easier.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104408</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Fri, 02 Mar 2012 09:09:30 +0000</pubDate>
		<guid isPermaLink="false">#comment-104408</guid>
		<description><![CDATA[&lt;i&gt;Tom, your correct. but i don’t know how to solve this problem.
after i tried use CHAIN without lock (n).. it show same error.&lt;/i&gt;
I&#039;m not sure what you did..solving this probelm shouldn&#039;t have required any changes to the code only additions..

When you acquire the row the first time you need to save a copy of a field, fields or more likely the entire record as a data structure.  Then when you go into the update routine and acquire the record for a second time you need to compare the orginal with the new values, if they aren&#039;t the same, the record was changed by someone else during the time you were viewing it.]]></description>
		<content:encoded><![CDATA[<p><i>Tom, your correct. but i don’t know how to solve this problem.<br />
after i tried use CHAIN without lock (n).. it show same error.</i><br />
I&#8217;m not sure what you did..solving this probelm shouldn&#8217;t have required any changes to the code only additions..</p>
<p>When you acquire the row the first time you need to save a copy of a field, fields or more likely the entire record as a data structure.  Then when you go into the update routine and acquire the record for a second time you need to compare the orginal with the new values, if they aren&#8217;t the same, the record was changed by someone else during the time you were viewing it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pdsathishkumar</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104407</link>
		<dc:creator>pdsathishkumar</dc:creator>
		<pubDate>Fri, 02 Mar 2012 07:19:06 +0000</pubDate>
		<guid isPermaLink="false">#comment-104407</guid>
		<description><![CDATA[Tom, your correct. but i don&#039;t know how to solve this problem.
after i tried use CHAIN without lock (n).. it show same error.]]></description>
		<content:encoded><![CDATA[<p>Tom, your correct. but i don&#8217;t know how to solve this problem.<br />
after i tried use CHAIN without lock (n).. it show same error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104394</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Fri, 02 Mar 2012 00:35:55 +0000</pubDate>
		<guid isPermaLink="false">#comment-104394</guid>
		<description><![CDATA[Tom&#039;s right about detecting changes by other users or programs.

Generally the screen fields have different names from the database fields regardless of update method.  Typically when the user requests an update, the data must be validated before the file is updated.

Phil]]></description>
		<content:encoded><![CDATA[<p>Tom&#8217;s right about detecting changes by other users or programs.</p>
<p>Generally the screen fields have different names from the database fields regardless of update method.  Typically when the user requests an update, the data must be validated before the file is updated.</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104389</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 01 Mar 2012 21:22:29 +0000</pubDate>
		<guid isPermaLink="false">#comment-104389</guid>
		<description><![CDATA[&lt;i&gt;i got clear solution for this situation.&lt;/i&gt;

Not quite yet.

There is still one problem that needs to be resolved. This problem is maybe the biggest reason that many programmers do not use two CHAINs to perform one UPDATE. They will use a single CHAIN that locks the row the entire time that the user has the record on the screen.

Here&#039;s the problem:

User #1 asks for a record, and your program CHAINs &lt;b&gt;without lock&lt;/b&gt; and displays the record.

Then, User #2 asks for the same record, and again your program CHAINs &lt;b&gt;without lock&lt;/b&gt; and displays the record.

The same record is now on two screens at the same time.

User #2 makes a change and presses F5. Your program CHAINs &lt;b&gt;with lock&lt;/b&gt; and UPDATEs the record.

What does User #1 have on the screen? When User #1 presses F5, what record will be retrieved when your program does the CHAIN? And when your program does the UPDATE for User #1, what happens to the change that was made by User #2?

Does either user know that the other user made any changes?

Tom]]></description>
		<content:encoded><![CDATA[<p><i>i got clear solution for this situation.</i></p>
<p>Not quite yet.</p>
<p>There is still one problem that needs to be resolved. This problem is maybe the biggest reason that many programmers do not use two CHAINs to perform one UPDATE. They will use a single CHAIN that locks the row the entire time that the user has the record on the screen.</p>
<p>Here&#8217;s the problem:</p>
<p>User #1 asks for a record, and your program CHAINs <b>without lock</b> and displays the record.</p>
<p>Then, User #2 asks for the same record, and again your program CHAINs <b>without lock</b> and displays the record.</p>
<p>The same record is now on two screens at the same time.</p>
<p>User #2 makes a change and presses F5. Your program CHAINs <b>with lock</b> and UPDATEs the record.</p>
<p>What does User #1 have on the screen? When User #1 presses F5, what record will be retrieved when your program does the CHAIN? And when your program does the UPDATE for User #1, what happens to the change that was made by User #2?</p>
<p>Does either user know that the other user made any changes?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pdsathishkumar</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104364</link>
		<dc:creator>pdsathishkumar</dc:creator>
		<pubDate>Thu, 01 Mar 2012 11:48:45 +0000</pubDate>
		<guid isPermaLink="false">#comment-104364</guid>
		<description><![CDATA[Thanks Tom and Phil,
i got clear solution for this situation. 
i changed my field name in display file. 
so multiple user program must contain different field name in database file and display file. 
now it ll working fine....]]></description>
		<content:encoded><![CDATA[<p>Thanks Tom and Phil,<br />
i got clear solution for this situation.<br />
i changed my field name in display file.<br />
so multiple user program must contain different field name in database file and display file.<br />
now it ll working fine&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104357</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 01 Mar 2012 06:58:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-104357</guid>
		<description><![CDATA[&lt;i&gt;...how can i move the field value…&lt;/i&gt;

If you use the same names for the database and display files, you can&#039;t move values between the fields because the program uses the same memory for both.

You can use the same names when you want the values to be the same in many programs. But if you read a record from the database file after reading the record from the display filewhen using the same names, the values from the display file will be lost.

So you need to use different names in an update program like the one you are writing. With different names, you move values back and forth whenever you decide is the right time.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>&#8230;how can i move the field value…</i></p>
<p>If you use the same names for the database and display files, you can&#8217;t move values between the fields because the program uses the same memory for both.</p>
<p>You can use the same names when you want the values to be the same in many programs. But if you read a record from the database file after reading the record from the display filewhen using the same names, the values from the display file will be lost.</p>
<p>So you need to use different names in an update program like the one you are writing. With different names, you move values back and forth whenever you decide is the right time.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pdsathishkumar</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/error-occurred-while-update-my-pf-using-rpgle-program/#comment-104355</link>
		<dc:creator>pdsathishkumar</dc:creator>
		<pubDate>Thu, 01 Mar 2012 05:27:22 +0000</pubDate>
		<guid isPermaLink="false">#comment-104355</guid>
		<description><![CDATA[Hi Phil and Tom, 
i didn&#039;t have different field for database and display file...
just i map the database file field in display file.. so the both file (database &amp; display) had same field only... 
field name in both database and display file
EMPNO, EMPNAME, SALARY, etc, like this....

&lt;i&gt;you need to move the fields from the display to the physical file record, then update it.&lt;/i&gt;
then, how can i move the field value...
please give a suggestion...]]></description>
		<content:encoded><![CDATA[<p>Hi Phil and Tom,<br />
i didn&#8217;t have different field for database and display file&#8230;<br />
just i map the database file field in display file.. so the both file (database &amp; display) had same field only&#8230;<br />
field name in both database and display file<br />
EMPNO, EMPNAME, SALARY, etc, like this&#8230;.</p>
<p><i>you need to move the fields from the display to the physical file record, then update it.</i><br />
then, how can i move the field value&#8230;<br />
please give a suggestion&#8230;</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/10 queries in 0.049 seconds using memcached
Object Caching 393/399 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-20 05:54:30 -->