Read operation on a subfile
0 pts.
0
Q:
Read operation on a subfile
Hi,

Can we use the READ opcode on a subfile as we do on a database file?

thanks
ASKED: Jun 15 2005  6:37 AM GMT
0
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Yep Read READC or chain

keep in mind chain is by relative record#

Ken
Last Answered: Jun 15 2005  8:17 AM GMT by AS400programmer   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

MadDogDing   0 pts.  |   Jun 15 2005  9:26AM GMT

Keep in mind, though, that when you do the READC, it will only read in records from the subfile that have had a CHANGE made to them. As an example, if you have written a bunch of subfile records out and have a one-byte input field at the front and the user inputs a “1″ (to select the record) into the input field on the third record of the subfile, then, when you do a loop to perform the READC, the only record that you will get will be the third record. If the user had entered a “1″ on the third and the fifth subfile record, then the looping READC would first read subfile record 3 and the next READC would give you subfile record 5.

 

TheQuigs   0 pts.  |   Jun 15 2005  10:59AM GMT

MadDogDing is correct. Just remember that if the user uses the field-exit key to get to the 3rd and 5th records, they have changed — even pressing space to move through subfile records flags them as changed.

 

cyates   0 pts.  |   Jun 15 2005  4:38PM GMT

If you need to read all the records, even if they weren’t changed, you can use the SFLNXTCHG keyword when loading the subfile.

 

AS400programmer   0 pts.  |   Jun 16 2005  8:06AM GMT

remember sflnxtchg is indicator driven.
so you can control wahat records come back.
I usually use a one byte hidden field to
indicate that the user has changed are added
something to a sfl record. I continue to
bring that record back while that sfl is
on the display. Say a sfl is 200 records
and the user touches only 6 of those records,
It’s better to bring back the 6 they touched
than all 200.

 
0