Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
I'm missing something. I have a program the setll, reads, updates and then reads gain. It looks like it's reading the updated record again. This what I'm dong
Setll *loval file
Read File
dow not %eof (file)
some processing here
Update file
Read file
enddo (end of file)
Like I said it is reading thefile just updated. Do I have to reset myself back into the file after the update ?
In your update, is the File keyed and are you updating the key fields? Could it be that you put it back with a new key which places the record later in the keyed order and therefore it subsequently gets read again?
Yes, if you are updating a KEY field and READing by Key, that record could magically reappear.
What does your F-Spec look like? Is the K there or blank?
Chris Ringer
Yes the fields are part of the key, (item number) and I am changing it (addiding a suffix ie was A105 iow is A105-240). How can I get around it ?
Rember that the legacy *LOVAL is not usually what you want when doing a SETLL.
Typically you'll want to use *START
SETLL *START myfile;
Do you have to have the file keyed? You're SetLL and ReadE are both sequential. If you remove the K from the F-spec, and just read sequential, you'll still read the entire file, but you'll only get each record once.