× 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: OPNQRYF versus LF
  • From: Mark Walter <mwalter@xxxxxxxxxx>
  • Date: Fri, 24 Mar 2000 13:48:00 -0500
  • Organization: Hanover Wire Cloth

If the program opens the file as a Primary or Secondary file, use the 
OPTION(*ALL). If it is a Full Procedural open then also add SEQONLY(*NO)
parameter to your OPNQRYF statement.

Might I recommend a book. Open Query File Magic by Ted Holt. It is 
available from Midrange Computing.

-----Original Message-----
From:   Bale, Dan [SMTP:DBale@TFSA.Textron.com]
Sent:   Thursday, March 23, 2000 2:44 PM
To:     'RPG400-L@midrange.com'
Cc:     'Osvaldo Rodrigues'
Subject:        RE: OPNQRYF versus LF

Osvaldo,

Do yourself a huge favor and learn OPNQRYF.  Any AS/400 programmer worth 
his
or her salt must know how to use this valuable command.

In your case, check out the following example code:

     PGM
     OVRDBF     FILE(YOURFILE) SHARE(*YES)
     OPNQRYF    FILE((YOURFILE)) OPTION(*ALL) +
                 QRYSLT('&FLD2A *eq %values("50" "60" "70")')
     CALL       PGMA
     CLOF       OPNID(YOURFILE)
     DLTOVR     FILE(YOURFILE)
     ENDPGM

Using this method, you are not using any temporary files; you are creating
and using a temporary access path created by OPNQRYF and used in PGMA.  You
define the YOURFILE file like normal in PGMA and remove all the selection
code from it.  OPTION(*ALL) in the OPNQRYF command is the key to being able
to update records in this file.

Using OPNQRYF (instead of program data selection) should win every
performance contest.

You can find out more about the possibilities available by using OPNQRYF by
reading the Data Management Guide and/or (if available for your version of
OS/400) "DB2 UDB for AS/400 Database Programming" and look for the section
titled "Using the Open Query File (OPNQRYF) command".

HTH,
- Dan Bale

-----Original Message-----
From: Osvaldo Rodrigues [mailto:Osvaldo.Rodrigues@brainag.com]
Sent: Thursday, March 23, 2000 1:04 PM
To: RPG400-L@midrange.com
Subject: OPNQRYF versus LF


Hello!
I have a PGM that does a selection on a LF file by one or more fields. In
that
selection we have a field that you can
select more than one value (allows a maximum of 5) for that field. Lets
suppose
that it is 2Alfa and you had entered values '50','60' and '70' for a given
selection.

At this moment I am reading each record of the query file and comparing the
refered field to each of those values (I
inserted them in an array). I think this is a litle bit hassle, running all
the
file and for each record seeking the array.

I know that if I use the OPNQRYF  it would help restricting the number of
records. But since it creates the query file as a temporary file and I also
need
to do some updates to the file I dont know how to do this.

One last question how can I measure in therms of perfomance and processing
time
the 2 ways ?

I must confesse that I never used the OPNQRYF only read some stuff about 
it.

Any help would be great!

Thanks a lot.

Osvaldo Rodrigues
AS400 Programmer

BRAIN Portugal
A BRAIN International Company

BIW Iberia- Informatica Lda
Av. Joao Canavarro, 305   Phone:   +351 252 248-120
Edificio Alameda   Fax:   +351 252 248-111
4480-668 Vila do Conde
Portugal
e-mail:            Osvaldo.Rodrigues@brainag.com
Internet:          http://www.brainag.com

NOTICE    This message contains privileged and confidential information
intended
only for the use of the address see named above. If you have received this
message in error please notify BRAIN Portugal immediately.
+---
| 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
+---
+---
| 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
+---


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.