• Subject: [Fwd: Problem in OPNQRYF]
  • From: "James W. Kilgore" <qappdsn@xxxxxxx>
  • Date: Fri, 30 Jul 1999 16:00:18 -0700
  • Organization: Progressive Data Systems, Inc.



"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: david@midrange.com
+---END



This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].