Link to home
Start Free TrialLog in
Avatar of bobdylan75
bobdylan75Flag for Afghanistan

asked on

how does CHAIN statment work? rpgle as400

Hi,
How does CHAIN work?
in particular, if I have 10 records: 1,2,3,4,..,10
if I have just read the 10th record (10).
if I execute this statment:2 chain file
Does the program auto-return to the top of the file in order
to find my 2th record,
or instead it returns NOT FOUND value??
thanks



Avatar of bobdylan75
bobdylan75
Flag of Afghanistan image

ASKER

ps:
the key is obviously the only field I have, the value 1,2,3..10
thanks
Hi
chain gets the a rcord basewd on the index on the file along with other criteria.
It return a single record.

if you have the 10 recors in an indexed file

chain 2 will reset the pointer, if you then did a read you would ger record 3.

Dave
SORRY,
I don't mean 2, but the key=2 like the value of the 2th record.
eval key= 2
key chain filename

the key of the file if the field VALUE. (1,2,3,..10)
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you very clear explanation.