• Subject: RE: OPNQRYF a flat file?
  • From: "Fisher, Don" <DRF@xxxxxxxxxxxxxxxx>
  • Date: Wed, 28 Feb 2001 12:58:02 -0500

It's been a while, but I believe you must map any field to which you refer
in the OPNQRYF statement.  The FORMAT option, if I recall correctly, may
only contain fields either defined by the file being queried or by the
MAPFLD parameter.

The following should do it if you define your FORMAT file with the ORRNPK
field:
OVRDBF FILE(DANBALEEZ) SHARE(*YES)
OPNQRYF FILE((DANBALEZ)) KEYFLD((ORRNPK)) UNIQUEKEY(*ALL)
   FORMAT(<file with ORRNPK field>) MAPFLD((ORRNPK '%sst( PTCKON08  524  7
)' *ZONED 7 0)).

On the other hand, an SQLRPGLE program could do the following with, in my
humble opinion, less fuss and more efficiency:
C/Exec SQL
  + Declare ReleaseNumber Cursor for 
  + Select distinct substr(PTCKON08,527,7) from DANBALEEZ
C/End-Exec

C/Exec SQL Open ReleaseNumber
C/End-Exec

C DOW SQLCOD <> *ZEROES
C/Exec SQL
  + Fetch ReleaseNumber into <some seven digit field>
C/End-Exec
C Add 1 to an accumulator
ENDDO

C/Exec SQL Close ReleaseNumber
C/End-Exec

Note the above is untested code and should be treated as such.

Donald R. Fisher, III
Project Manager
Heilig-Meyers Furniture Company
(804) 784-7500 ext. 2124
Don.Fisher@HeiligMeyers.com

<clip>
Can OPNQRYF be used on a non-externally described flatfile?  The flatfile
maps
to a file that is externally described, and will eventually be copied to
files
with the externally described format, but first I have to run the flatfile
through OPNQRYF to determine all the unique release numbers found in the
file.
 Note that ASNPK is the externally described file and DANBALEZ is the
non-externally described flatfile.  ORRNPK is the Release Number field,
defined as 7-digits, zoned decimal.
<clip>
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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.