The workaround is that I defined new host variable fields using LIKE() on
fields from a different logical (which was already being used in the
program), which used the PREFIX(X) keyword on the F-spec for that logical.
So, using the code using QCLSRC as the externally described file:

FQCLSRC IP E DISK RENAME(QCLSRC:SOURCEFILE)
FQRPGLESRC IS E DISK RENAME(QRPGLESRC:SOURCERPG) PREFIX(X)
d NegotiatedCount...
d s 9 0
d Sq_SrcSeq s LIKE( xSrcSeq)
d Sq_SrcDat s LIKE( xSrcDat)
d Sq_SrcDta s LIKE( xSrcDta)
DCOMPARE DS
D SrcSeq
D SrcDat
D SrcDta
DSAVE DS
D SV_SrcSeq LIKE(SrcSeq)
D SV_SrcDat LIKE(SrcDat)
D SV_SrcDta LIKE(SrcDta)

sq_SrcSeq = sv_SrcSeq ;
sq_SrcDat = sv_SrcDat ;
sq_SrcDta = sv_SrcDta ;
Exec SQL set :NegotiatedCount =
( select count(*) as aCount
from QCLSRC
where SrcSeq = :sq_SrcSeq
and SrcDat = :sq_SrcDat
and SrcDta = :sq_SrcDta );
*inLR = *on;

I can't use EXTNAME on the COMPARE DS because there are many more fields
defined in the file than what is needed in the DS.

QUALIFIED TEMPLATE would cause mass confusion amongst some of my
colleagues. This is my reality. I'm better off with the kludge.

Since you're here, Barbara, I'll go ahead and ask the question: Does the
SQL0312 error appear to be a bug, in your opinion, or do you think this is
working as designed?

- Dan


On Tue, Apr 10, 2018 at 3:53 PM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:

On 2018-04-09 11:43 PM, Dan wrote:

...
I've got a workaround, but it's kludgy and makes the code less clear. It
would be helpful to have this fixed so if someone else runs across this
bug, they won't spend half a day debugging it, like I did.


You didn't say what your kludgy work-around is. Maybe this is the same,
but I would define the COMPARE data structure as externally-described.

DCOMPARE E DS EXTNAME(QCLSRC)

That gives the same data structure as this:

DCOMPARE DS
D SrcSeq
D SrcDat
D SrcDta

If you wanted the COMPARE and SAVE data structures to only have some of
the fields in the file, or you wanted to change the order of the subfields
in the data structure, then you could code like this:

DTypes E DS EXTNAME(QCLSRC) QUALIFIED TEMPLATE

DCOMPARE DS
D SrcSeq LIKE(Types.SrcSeq)
D SrcDta LIKE(Types.SrcDTa)

DSAVE DS
D Sv_SrcSeq LIKE(Types.SrcSeq)
D Sv_SrcDta LIKE(Types.SrcDTa)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.