× 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.



On 17-Apr-2012 00:48 , Dave wrote:

Please help me understand this :

Were the given MAPFLD and JFLD an actual copy\paste, or might have there been some editing? The column names AID and IID seem somewhat problematic in the given scenario; i.e. seems IID either needs to be mapped to an alternate name in the first OPNQRYF, or IID needs to exist in both QTEMP/T040 and FMT01A, but the latter case would prevent success on the second query. I suspect the MAPFLD definition "(iid aid)" was accidentally dropped from the first query?

<<SNIP first query>>

OVRDBF FILE(FMT01A) TOFILE(FMT01) SHARE(*YES)
OPNQRYF FILE((FMT01A) (QTEMP/T040)) +
FORMAT(FMT01 FMT1F1) KEYFLD(*FILE) +
JFLD((1/AID 2/IID *EQ)) OPNID(FMT01A)

CALL PGM(myRPG)

MyRPG :
FFMT01A IP E K DISK

<<SNIP>>

Does the the second QRYF, FMT01A, have all the fields of FMT01 +
QTEMP/T040?

The query has the fields of the Record Format FMT1F1 of the database *FILE named FMT01 in *LIBL; i.e. per the FORMAT() specification.

The RPG is compiled on file FMT01 by running a OVRDBF
FILE(FMT01A) TOFILE(FMT01) before the compile command. So it can't
know anything about the fields in the file QTEMP/T040.

Does OVRDBF FILE(FMT01A) TOFILE(FMT01) SHARE(*YES) mean that MyRPG
will only "see" the fields in the QRYF FMT01A that are in the file
FMT01?

That override designates both whence the data is obtained [i.e. from file FMT01 in *LIBL] and to share the query ODP with the implicit OPEN performed in the MyRPG program on the file named FMT01A. The MyRPG program was compiled to the external definition of file FMT01 in *LIBL so the program expects those columns, and if level checking is in effect, then that effect is probably ensured else an error occurs.

Regards, Chuck

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.