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



As it turns out, this particular scenario was a bug on my part. The Like subfield on the following line was incorrect:
Desc Like( dsT_PrdDescP.Desc );

Sorry about that. These have been some long days.

Good thought on *LVL2. I already have one program that requires it, I should try that out when I run into host structure issues.

Thanks,

Kurt Anderson
Sr. Programmer/Analyst - Application Development, Service Delivery Platform

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Therrien
Sent: Tuesday, April 22, 2014 8:34 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Invalid Host Data Structure for embedded SQL

Have you tried compiling with *LVL2 on the RPGPPOPT parm of the CRTSQLRPGI command

On 4/22/2014 6:16 PM, Kurt Anderson wrote:
I feel like I've never fully understood when a host variable is and is not usable. I did find a couple useful pages, but I'm not seeing why the definition pasted in below does not meet the qualifications of an acceptable host variable and host structure. Usually I have a mix of Qualified, Template, LikeRec or ExtName, and quite often the Data Structure is defined in a copybook. In this case I went much simpler and removed the Template and did not have the DS in a copybook, yet it still doesn't like it. I'm guessing possibly because of ExtName, but my use of ExtName seems to be ok according to the help.
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frz
ajp%2Frzajpdeclaringirpg.htm
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frz
ajp%2Frzajphoststrucirpg.htm

If I change the code to not use LIKE on the subfield definitions, the structure is ok. The two files are in the job description library list.

dcl-ds dsT_SpecChg ExtName( 'SPECCHGP' ) Qualified end-ds;
dcl-ds dsT_PrdDescP ExtName( 'PRDDESCP' ) Qualified end-ds;
dcl-ds ds_Data Dim(100) Qualified;
PrdLvl Like( dsT_SpecChg.PrdLvl );
SvcLvl Like( dsT_SpecChg.SvcLvl );
BSLvl Like( dsT_SpecChg.BSLvl );
Desc Like( dsT_PrdDescP.Desc );
Calls Like( dsT_SpecChg.Calls );
Total Like( dsT_SpecChg.Total );
TotBAmt Like( dsT_SpecChg.TotBAmt );
SurChg Like( dsT_SpecChg.SurChg );
end-ds;

This works:
dcl-ds ds_Data Dim(100) Qualified;
PrdLvl char( 1 );
SvcLvl char( 1 );
BScLvl char( 1 );
Desc char( 30 );
Calls packed( 11 );
Total packed( 17: 6 );
TotBAmt packed( 15: 6 );
SurChg packed( 13: 6 );
end-ds;

For so long when I ran into this issue I simply changed the definition to be hardcoded, but I grow tired of that.

Kurt Anderson
Sr. Programmer/Analyst - Application Development, Service Delivery
Platform [cid:image002.jpg@01CD16F9.25D27630]
web: www.customcall.com<http://www.customcall.com/> | email:
kurt.anderson@xxxxxxxxxxxx<mailto:kurt.anderson@xxxxxxxxxxxx>

A Division of Enghouse Systems Ltd.<http://www.enghouse.com/>
(TSX:ESL)


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


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.