Read records sequentially from a subfile
Can we use READ opcode to read records from a subfile record format(Data part)?
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
Yes, you can read records sequentially from a subfile, but you would do it using the CHAIN operation because a subfile is a 'direct' file. That means that a subfile is accessed using its relative record numbers.
So to read the subfile, use the subfile record number field you defined on the F-spec for the display file in a DO or FOR loop, starting at value 1 and ending at the last record number in the subfile -- you should know that value through having loaded the subfile in the first place.
You code would look like this :
C For ##SFR3 = 1 to LastRec C ##SFR3 Chain (E) #SFL3 : : : C Update #SFL3 C EndFor Between the Chain and the Update you can do what you like!
The Best Web Links: tips, tutorials and more.
Visit the ITKnowledge Exchange and get answers to your developing questions fast.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig Deeper on Data backup, storage and retrieval on iSeries
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.
Meet all of our AS/400 experts
View all AS/400 questions and answers
Start the conversation
0 comments