Discussion:
Setll/Reade vs Chain
(too old to reply)
Drew Dekreon
2003-12-01 23:36:33 UTC
Permalink
I'm on v4r5 and have an odd problem in an rpgle program I'm trying to
maintain:

files are all usropn
instead of simply chaining, the original author used setll/reade to
retrieve a record

In the new code I'm adding, I (naturally) used chain.
However - the program seems to fail to be able to position to the
record. I've even seen it happen in debug: kflds in klist correct,
chain, not found. If I let the code cycle thru again, the chain succeeds.

When I traded by chains for setll/reade, everything seems to work
consistently.

Has anyone ever heard of this before? Our last ptf was TL02169 (march '03)
Thad Rizzi
2003-12-02 13:12:48 UTC
Permalink
Post by Drew Dekreon
I'm on v4r5 and have an odd problem in an rpgle program I'm trying to
files are all usropn
instead of simply chaining, the original author used setll/reade to
retrieve a record
In the new code I'm adding, I (naturally) used chain.
However - the program seems to fail to be able to position to the
record. I've even seen it happen in debug: kflds in klist correct,
chain, not found. If I let the code cycle thru again, the chain succeeds.
When I traded by chains for setll/reade, everything seems to work
consistently.
Has anyone ever heard of this before? Our last ptf was TL02169 (march '03)
Just a guess but perhaps when using USROPN no record is positioned on
the open so the chain fails on the first attempt. SETLL postions the
file before the read so it would work fine.
Drew Dekreon
2003-12-05 22:49:34 UTC
Permalink
Thanks for everyone's comments:
After eliminating all the usropns I was able to return to using chain
and everything worked properly.
Oddly enough, the original developer OPENed the files, but never closed
them. I suppose ending the program with LR on would clean them up, but
I'm really not sure.
Post by Thad Rizzi
Post by Drew Dekreon
I'm on v4r5 and have an odd problem in an rpgle program I'm trying to
files are all usropn
instead of simply chaining, the original author used setll/reade to
retrieve a record
In the new code I'm adding, I (naturally) used chain.
However - the program seems to fail to be able to position to the
record. I've even seen it happen in debug: kflds in klist correct,
chain, not found. If I let the code cycle thru again, the chain succeeds.
When I traded by chains for setll/reade, everything seems to work
consistently.
Has anyone ever heard of this before? Our last ptf was TL02169 (march '03)
Just a guess but perhaps when using USROPN no record is positioned on
the open so the chain fails on the first attempt. SETLL postions the
file before the read so it would work fine.
2003-12-02 16:17:23 UTC
Permalink
Post by Drew Dekreon
I'm on v4r5 and have an odd problem in an rpgle program I'm trying to
files are all usropn
instead of simply chaining, the original author used setll/reade to
retrieve a record
In the new code I'm adding, I (naturally) used chain.
However - the program seems to fail to be able to position to the
record. I've even seen it happen in debug: kflds in klist correct,
chain, not found. If I let the code cycle thru again, the chain succeeds.
When I traded by chains for setll/reade, everything seems to work
consistently.
Has anyone ever heard of this before? Our last ptf was TL02169 (march '03)
I can think of 2 problems you could have:
If the setll has a longer, more specific key than the reade but you used the
longer key on the chain, (easy to miss sometimes) This case is not
equivalent.
If the line after the reade is using %eof then this built in function will
not be affected by the chain, you have to make use of %found.
--
Jonathan.
Terence
2003-12-03 13:41:22 UTC
Permalink
Post by Drew Dekreon
I'm on v4r5 and have an odd problem in an rpgle program I'm trying to
files are all usropn
instead of simply chaining, the original author used setll/reade to
retrieve a record
In the new code I'm adding, I (naturally) used chain.
However - the program seems to fail to be able to position to the
record. I've even seen it happen in debug: kflds in klist correct,
chain, not found. If I let the code cycle thru again, the chain succeeds.
When I traded by chains for setll/reade, everything seems to work
consistently.
Has anyone ever heard of this before? Our last ptf was TL02169 (march '03)
I have very rarely found the need to USROPN, but it might be
interesting to see if it works without it. Also, you could try a
SETLL before the first chain.

Also, check that key fields are correct, and all specified. A
SETLL/READE can read the next record after the pointer is set if
partial key is specified, but CHAIN requires exact hit.
e***@yahoo.com
2003-12-03 19:40:01 UTC
Permalink
Is the program an update program and you are trying to chain to a
record that you just added.

In which case, the record is still in the file buffer and has not been
written to the file yet.

Prehaps the setll causes the file buffer to dump the record to the
file so the reade can find it.




On Mon, 01 Dec 2003 14:36:33 -0900, Drew Dekreon
Post by Drew Dekreon
I'm on v4r5 and have an odd problem in an rpgle program I'm trying to
files are all usropn
instead of simply chaining, the original author used setll/reade to
retrieve a record
In the new code I'm adding, I (naturally) used chain.
However - the program seems to fail to be able to position to the
record. I've even seen it happen in debug: kflds in klist correct,
chain, not found. If I let the code cycle thru again, the chain succeeds.
When I traded by chains for setll/reade, everything seems to work
consistently.
Has anyone ever heard of this before? Our last ptf was TL02169 (march '03)
Loading...