RPG/400 CHAIN opcode

1150 pts.
Tags:
CHAIN
RPG
RPG/400
RPGLE
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

<pre>…..CL0N01N02N03Factor1+++Oper+Factor2+++ResultLonDHMaMeIgComentarios++++
C KFLD CHAINFILE 50 </pre>

Wilson

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WoodEngineer
    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.
    6,680 pointsBadges:
    report
  • WoodEngineer
    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.
    6,680 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following