× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Problem in OPNQRYF
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 30 Jul 1999 14:25:24 -0500

Hi Vini...

Vini.Kolathur@msasaro.com (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 c
>  try it
> out by putting the CPYFRMQRYF after calling the RPG.

Thats not true.  The reason that this works is because the CPYFRMQRYF
will reposition the file to the beginning!

Try running your RPG twice.  You'll find that the second one has a
problem, because it does not reposition to the start.

Why?  Because CPYFRMQRYF is smart enough to start at the beginning,
and your program isn't.

>          Many people have suggested putting a *LOVAL SETLL in the RP
>  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.

POSDBF will do what you want.

>         I feel that IBM should fix up the CPYFRMQRYF to reposition t
>  file
> pointer to the first record after it has done it's piece of work.
>

Its not a bug in CPYFRMQRYF!   I have about a dozen programs that I
use that have worked great since V2R2, and would stop working if
IBM changed this behavior!  This is the way it was designed to work,
its the way its always worked, and theres no reason to change it.

The whole IDEA behind OVRDBF SHARE(*YES) and using an OPEN file,
that you have to CLOF to close is that you can keep reusing it
without having to close the file!   Thats the whole reason it exists!!

After running CPYFRMQRYF you can reposition to the start without
having to rebuild the access path with OPNQRYF.  Thats BECAUSE it
keeps the file OPEN!  Otherwise you'd have to rebuild the whole
thing, and do extra work POINTLESSLY.

PLEASE, IBM!   DON'T CHANGE THIS COMMAND!

+---
| 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



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.