"James W. Kilgore" wrote: > Vini, > > The OPNQRYF builds a temporary LF which *LOVAL would position to the first >selected > record. > > In the OPNQRYF you would specify SHARE(*YES) and both the CPYFRMQRYF and your >RPG > program will share the same ODP. > > If you had two RPG programs instead of CPYFRMQRYF followed by an RPG program >you > would see the same behavior. > The second RPG program will pick up where the first program left the file >cursor. > > Having a shared ODP which can be positioned by one program, then read by >another > program is a handy little trick. Essentially, having CPYFRMQRYF -not- leave >the > cursor where it was last at would make the behavior inconsistent with other >I/O > functions. > > The consistent behavior under a shared ODP is that the file cursor is >-always- where > the last read occurred. In the case of CPYFRMQRYF the cursor is left at EOF. > > Vini Kolathur wrote: > > > > > > > James, > > The same thing would not happen if i process the file in me RPG because >of > > the simple reason that i would have closed the file in my RPG. You can try >it > > out by putting the CPYFRMQRYF after calling the RPG. > > Many people have suggested putting a *LOVAL SETLL in the RPG. This > > would only crash the program because the *LOVAL SETLL will try to position >it to > > the first record. This necessarily could not be the first record in the > > selection criterion. > > I feel that IBM should fix up the CPYFRMQRYF to reposition the file > > pointer to the first record after it has done it's piece of work. > > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: firstname.lastname@example.org +---END
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.