Midrange News for the IBM i Community


Posted by: John Dowling
setll, read and update
has no ratings.
Published: 22 Oct 2013
Revised: 24 Oct 2013 - 3836 days ago
Last viewed on: 25 Apr 2024 (5348 views) 

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.

setll, read and update Published by: John Dowling on 22 Oct 2013 view comments(6)

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 ? 

 

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: Viking
Premium member *
CA
Comment on: setll, read and update
Posted: 10 years 6 months 4 days 17 hours 35 minutes ago
Edited: Tue, 22 Oct, 2013 at 18:00:24 (3838 days ago)

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?

Posted by: Ringer
Premium member *
Comment on: setll, read and update
Posted: 10 years 6 months 4 days 16 hours 46 minutes ago

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 

Posted by: john-d1
Premium member *
Comment on: setll, read and update
Posted: 10 years 6 months 4 days 15 hours 42 minutes ago
Edited: Tue, 22 Oct, 2013 at 19:58:00 (3838 days ago)

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 ?

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: setll, read and update
Posted: 10 years 6 months 4 days 15 hours 41 minutes ago

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;

 

Posted by: DaleB
Premium member *
Reading, PA
Comment on: setll, read and update
Posted: 10 years 6 months 4 days 14 hours 47 minutes ago

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.

Posted by: john-d1
Premium member *
Comment on: setll, read and update
Posted: 10 years 6 months 2 days 20 hours 56 minutes ago

Thanks for all your comments.