RPG/400 CHAIN opcode
730 pts.
0
Q:
RPG/400 CHAIN opcode
Hi,anybody tell me how to find the end of file situation while reading through the CHAIN opcode on a file in RPG/400 and in RPGLE. I think RPGLE we have %found built in function.thanks
ASKED: May 7 2009  7:33 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
2005 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
c fkey chain myfile
c if %found(myfile)
C ,,, stuff if found
C else
C ... stuff if not found
C endif

The chain searches the index
if it discovers that the key exists
it sets %found to true
it returns the physical record
else
it sets %found to false

Phil


/////////////////////////////

In RPG400 an indicator in > (great) column in Chain operation has the same function than %found.

.....CL0N01N02N03Factor1+++Oper+Factor2+++ResultLonDHMaMeIgComentarios++++
C KFLD CHAINFILE 50


Wilson
Last Answered: May 7 2009  2:16 PM GMT by WilsonAlano   2005 pts.
Latest Contributors: Philpl1jb   24570 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

WoodEngineer   2280 pts.  |   May 7 2009  4:37PM GMT

The CHAIN operation does not set on the EOF condition.
The various READ op codes do set the EOF condition.
CHAIN only return two result codes - error and record found/not found.

 

WoodEngineer   2280 pts.  |   May 8 2009  3:58PM GMT

Maybe the READE op code will do what you want.
Its a great way to read a subset of records based on a key and it returns the EOF condition.

 
0