 




<?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: Problem with the READ from PF in RPGLE</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 18:27:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115438</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Mon, 21 Jan 2013 11:43:32 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115438</guid>
		<description><![CDATA[Here is about what we might have expected
Why doesn&#039;t this do what you want?
Is mlama00 keyed on agcde?
Are there repeating values of agcde in the table?


Setll mlama00
Read  mlama00
Dow not %eof(mlama00) and agcde &lt;= 713
Move agcde   cde_agt
eval o_agnme = %trim(agnme)
eval o_agcde = agcde
Exsr load_data
Read mlama00
enddo

]]></description>
		<content:encoded><![CDATA[<p>Here is about what we might have expected<br />
Why doesn&#8217;t this do what you want?<br />
Is mlama00 keyed on agcde?<br />
Are there repeating values of agcde in the table?</p>
<p>Setll mlama00<br />
Read  mlama00<br />
Dow not %eof(mlama00) and agcde &lt;= 713<br />
Move agcde   cde_agt<br />
eval o_agnme = %trim(agnme)<br />
eval o_agcde = agcde<br />
Exsr load_data<br />
Read mlama00<br />
enddo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115437</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Mon, 21 Jan 2013 11:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115437</guid>
		<description><![CDATA[code window will not work for me!!Here is about what we might have expectedWhy doesn&#039;t this do what you want?Is mlama00 keyed on agcde?Are there repeating values of agcde in the table?&#160;Setll mlama00Read&#160; mlama00Dow not %eof(mlama00) and agcde &lt;= 713Move agcde&#160;&#160; cde_agteval o_agnme = %trim(agnme)eval o_agcde = agcdeExsr load_dataRead mlama00enddo&#160;]]></description>
		<content:encoded><![CDATA[<p>code window will not work for me!!Here is about what we might have expectedWhy doesn&#8217;t this do what you want?Is mlama00 keyed on agcde?Are there repeating values of agcde in the table?&nbsp;Setll mlama00Read&nbsp; mlama00Dow not %eof(mlama00) and agcde &lt;= 713Move agcde&nbsp;&nbsp; cde_agteval o_agnme = %trim(agnme)eval o_agcde = agcdeExsr load_dataRead mlama00enddo&nbsp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115433</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Mon, 21 Jan 2013 09:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115433</guid>
		<description><![CDATA[That segment of code doesn&#039;t make sense. It has the start of a DO-loop but doesn&#039;t show the ENDDO. The loop is conditioned on %EOF(m1ama00), but the CHAIN is the only statement shown that can set %EOF(m1ama00).
&#160;
You did show the F-spec, so now we know that the program is accessing m1ama00 by key and not by RRN. That was the first thing we needed. But we still don&#039;t see the key definition from the file description.
&#160;
We also still have no idea why you keep putting the CHAIN in there. It has no purpose. It will either just read the same record that the program already has or it will read a different record. If it reads the same record, then it has no purpose. And if it reads a different record, then it will mess up the sequence of records that you read.
&#160;
Take it out and leave it out, or explain why you have it there.
&#160;
Also explain why you have no error indicators on the CHAIN and it also has no (E) extender. How do you expect to find out that it can&#039;t find a record?
&#160;
Yes, the CHAIN can have all fields from the record. But you already have all the fields when you READ. Why try to get all the fields twice?
&#160;
Finally, you keep saying that values are wrong. How do you know they are wrong? Are you running in debug and watching memory? You don&#039;t show any output statements in the program, so we can&#039;t tell what you look at when you say that values are wrong.
&#160;
Beyond those, earlier you showed the run_qry subroutine. You said it was called from Load_data, but your code doesn&#039;t show that Load_data calls it. And run_qry creates a cursor and FETCHes two rows, but Load_data runs every time you go through your DO_loop. Why would you want a cursor? Why don&#039;t you just SELECT the two records one at a time without a cursor? It is very inefficient to create a cursor every time. Why are you FETCHing two rows?
&#160;
Your SELECT doesn&#039;t have an ORDER BY clause, so you can&#039;t expect to get two rows from the file that are next to each other. The second row that you FETCH could be any other row in the file.
&#160;
So, get rid of the CHAIN or explain its purpose. And show us the key definition for m1ama00. And explain what you mean when you say values are wrong. I am guessing that you have a report or a screen that shows some values, but I have no idea how a value is copied from a file record to output so you can see it.
&#160;
Tom]]></description>
		<content:encoded><![CDATA[<p>That segment of code doesn&#8217;t make sense. It has the start of a DO-loop but doesn&#8217;t show the ENDDO. The loop is conditioned on %EOF(m1ama00), but the CHAIN is the only statement shown that can set %EOF(m1ama00).<br />
&nbsp;<br />
You did show the F-spec, so now we know that the program is accessing m1ama00 by key and not by RRN. That was the first thing we needed. But we still don&#8217;t see the key definition from the file description.<br />
&nbsp;<br />
We also still have no idea why you keep putting the CHAIN in there. It has no purpose. It will either just read the same record that the program already has or it will read a different record. If it reads the same record, then it has no purpose. And if it reads a different record, then it will mess up the sequence of records that you read.<br />
&nbsp;<br />
Take it out and leave it out, or explain why you have it there.<br />
&nbsp;<br />
Also explain why you have no error indicators on the CHAIN and it also has no (E) extender. How do you expect to find out that it can&#8217;t find a record?<br />
&nbsp;<br />
Yes, the CHAIN can have all fields from the record. But you already have all the fields when you READ. Why try to get all the fields twice?<br />
&nbsp;<br />
Finally, you keep saying that values are wrong. How do you know they are wrong? Are you running in debug and watching memory? You don&#8217;t show any output statements in the program, so we can&#8217;t tell what you look at when you say that values are wrong.<br />
&nbsp;<br />
Beyond those, earlier you showed the run_qry subroutine. You said it was called from Load_data, but your code doesn&#8217;t show that Load_data calls it. And run_qry creates a cursor and FETCHes two rows, but Load_data runs every time you go through your DO_loop. Why would you want a cursor? Why don&#8217;t you just SELECT the two records one at a time without a cursor? It is very inefficient to create a cursor every time. Why are you FETCHing two rows?<br />
&nbsp;<br />
Your SELECT doesn&#8217;t have an ORDER BY clause, so you can&#8217;t expect to get two rows from the file that are next to each other. The second row that you FETCH could be any other row in the file.<br />
&nbsp;<br />
So, get rid of the CHAIN or explain its purpose. And show us the key definition for m1ama00. And explain what you mean when you say values are wrong. I am guessing that you have a report or a screen that shows some values, but I have no idea how a value is copied from a file record to output so you can see it.<br />
&nbsp;<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sureyz</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115428</link>
		<dc:creator>Sureyz</dc:creator>
		<pubDate>Mon, 21 Jan 2013 06:36:22 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115428</guid>
		<description><![CDATA[&lt;pre&gt;Hi 
This is my F specification.. everything is fine here i hope..
m1ama00   if   e           k disk

anyway i just changed my code as follows.

                   Dow       not %eof(m1ama00)     
                   if        %eof(m1ama00)         
                   Leave                           
                   Endif                           
                   move      agcde         cde_agt 
agcde         chain     m1ama00               
                   eval      o_agnme = %trim(agnme)
                   eval      o_agcde = agcde       
                   Exsr      Load_data             
                   eval      agcde = agcde + 001   
                    if        agcde = 713           
                   leave                           
                   endif                           

Now its showing the 169,170,171 etc.. 
But a new problem has arise. That is its showing right agnme upto 168. But from 169 to 299 its repeating the same name of 168.. from 300 onwards its showing the specific agnme which is correct.. 

Chain should hold all the fields of that specific row.. Am i right ? 

Tom, as you told, i just removed the CHAIN and its didn&#039;t worked . that&#039;s why i tried this.. 


Surey&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<pre>Hi 
This is my F specification.. everything is fine here i hope..
m1ama00   if   e           k disk

anyway i just changed my code as follows.

                   Dow       not %eof(m1ama00)     
                   if        %eof(m1ama00)         
                   Leave                           
                   Endif                           
                   move      agcde         cde_agt 
agcde         chain     m1ama00               
                   eval      o_agnme = %trim(agnme)
                   eval      o_agcde = agcde       
                   Exsr      Load_data             
                   eval      agcde = agcde + 001   
                    if        agcde = 713           
                   leave                           
                   endif                           

Now its showing the 169,170,171 etc.. 
But a new problem has arise. That is its showing right agnme upto 168. But from 169 to 299 its repeating the same name of 168.. from 300 onwards its showing the specific agnme which is correct.. 

Chain should hold all the fields of that specific row.. Am i right ? 

Tom, as you told, i just removed the CHAIN and its didn't worked . that's why i tried this.. 


Surey</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115425</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sun, 20 Jan 2013 16:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115425</guid>
		<description><![CDATA[F-spec for file m1ama00.&#160; And is m1ama00 keyed on AgCDE????&quot;&#160;its reading the Physical file from the first when its comes to AGCDE 168,then its directly going to the 300&quot;&#160; So we&#039;ve been focusing on the file m1ama00&#160;and how you are getting data from it.&#160; But perhaps it&#039;s processing the data in the correct order but failing to report some rows because of the design of your downstream processes.&#160;So how do you know that the rows are being accessed from mlama00 out of order?&#160;]]></description>
		<content:encoded><![CDATA[<p>F-spec for file m1ama00.&nbsp; And is m1ama00 keyed on AgCDE????&#8221;&nbsp;its reading the Physical file from the first when its comes to AGCDE 168,then its directly going to the 300&#8243;&nbsp; So we&#8217;ve been focusing on the file m1ama00&nbsp;and how you are getting data from it.&nbsp; But perhaps it&#8217;s processing the data in the correct order but failing to report some rows because of the design of your downstream processes.&nbsp;So how do you know that the rows are being accessed from mlama00 out of order?&nbsp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115422</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Sun, 20 Jan 2013 10:46:57 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115422</guid>
		<description><![CDATA[You still haven&#039;t shown the F-spec for m1ama00, and you haven&#039;t shown the key information for the file from the file description. And you still haven&#039;t explained why the CHAIN statement is in your READ loop.
&#160;
But if you want to know how to read the file in sequence, the best guess is to delete that CHAIN statement from the program.&#160;The program&#160;will probably work better without it. It doesn&#039;t seem to have a purpose, and it looks like it interferes with your sequencing.
&#160;
Tom]]></description>
		<content:encoded><![CDATA[<p>You still haven&#8217;t shown the F-spec for m1ama00, and you haven&#8217;t shown the key information for the file from the file description. And you still haven&#8217;t explained why the CHAIN statement is in your READ loop.<br />
&nbsp;<br />
But if you want to know how to read the file in sequence, the best guess is to delete that CHAIN statement from the program.&nbsp;The program&nbsp;will probably work better without it. It doesn&#8217;t seem to have a purpose, and it looks like it interferes with your sequencing.<br />
&nbsp;<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sureyz</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115420</link>
		<dc:creator>Sureyz</dc:creator>
		<pubDate>Sun, 20 Jan 2013 07:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115420</guid>
		<description><![CDATA[&lt;pre&gt;This would help you i Guess.. 
This is the run_qry subroutine its executed from Load_Data Subroutine.. 


     run_qry       BegSr            
/EXEC SQL                           
+ PREPARE S1 FROM :QRYSTR1          
/END-EXEC                           
*                                   
/EXEC SQL                           
+ DECLARE C1 CURSOR WITH HOLD FOR S1
/END-EXEC                           
*                                   
/EXEC SQL                           
+ OPEN C1                           
/END-EXEC                           
/EXEC SQL                           
+ FETCH NEXT FROM C1 INTO :agent_prm
/END-EXEC                           
/EXEC SQL                                        
+ FETCH NEXT FROM C1 INTO :agent_prm             
/END-EXEC                                                   
* 
/EXEC SQL                                        
+ CLOSE C1                                       
/END-EXEC                                        
                   EndSr                         &lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<pre>This would help you i Guess.. 
This is the run_qry subroutine its executed from Load_Data Subroutine.. 


     run_qry       BegSr            
/EXEC SQL                           
+ PREPARE S1 FROM :QRYSTR1          
/END-EXEC                           
*                                   
/EXEC SQL                           
+ DECLARE C1 CURSOR WITH HOLD FOR S1
/END-EXEC                           
*                                   
/EXEC SQL                           
+ OPEN C1                           
/END-EXEC                           
/EXEC SQL                           
+ FETCH NEXT FROM C1 INTO :agent_prm
/END-EXEC                           
/EXEC SQL                                        
+ FETCH NEXT FROM C1 INTO :agent_prm             
/END-EXEC                                                   
* 
/EXEC SQL                                        
+ CLOSE C1                                       
/END-EXEC                                        
                   EndSr                         </pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sureyz</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115419</link>
		<dc:creator>Sureyz</dc:creator>
		<pubDate>Sun, 20 Jan 2013 07:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115419</guid>
		<description><![CDATA[&lt;pre&gt;Hi Phil and Tom .
Thats my poor coding. 
Simply i want to read m1ama00 file from the beginning to end and execute the subroutine for the each AGCDE.. 
How can i do that..  If u specify the code it would be helpful to me.. 

Thanks 
Surey&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<pre>Hi Phil and Tom .
Thats my poor coding. 
Simply i want to read m1ama00 file from the beginning to end and execute the subroutine for the each AGCDE.. 
How can i do that..  If u specify the code it would be helpful to me.. 

Thanks 
Surey</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115406</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Sat, 19 Jan 2013 18:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115406</guid>
		<description><![CDATA[The load_data subroutine is only useful to show that it doesn&#039;t affect the order of records. It still doesn&#039;t show anything about how the file is ordered. It doesn&#039;t include the F-spec. It doesn&#039;t include the file description. And it certainly doesn&#039;t tell us why you have a CHAIN to the same file right in the middle of a READ loop. That is what causes your problem, but we still can&#039;t tell what the programming should be doing because we don&#039;t know any definitions. -- Tom]]></description>
		<content:encoded><![CDATA[<p>The load_data subroutine is only useful to show that it doesn&#8217;t affect the order of records. It still doesn&#8217;t show anything about how the file is ordered. It doesn&#8217;t include the F-spec. It doesn&#8217;t include the file description. And it certainly doesn&#8217;t tell us why you have a CHAIN to the same file right in the middle of a READ loop. That is what causes your problem, but we still can&#8217;t tell what the programming should be doing because we don&#8217;t know any definitions. &#8212; Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115403</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sat, 19 Jan 2013 18:24:57 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/problem-with-the-read-from-pf-in-rpgle/#comment-115403</guid>
		<description><![CDATA[Wonderful but doesn&#039;t help .. atleast not yet.Why do you read and chain from the same file and then read again??? Phil]]></description>
		<content:encoded><![CDATA[<p>Wonderful but doesn&#8217;t help .. atleast not yet.Why do you read and chain from the same file and then read again??? Phil</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 6/8 queries in 0.011 seconds using memcached
Object Caching 395/396 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-22 20:55:53 -->