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



I think as of a certain version the precompiler started to handle single-level qualified names. Interesting method you have there. However I'm not usually I'm not selecting all fields in a file.

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 Sam_L
Sent: Tuesday, April 22, 2014 9:02 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Invalid Host Data Structure for embedded SQL

Kurt, in my experience the SQL pre-compiler can't handle qualified data structure names.

I've used qualified names by using pointers, something like this:

dcl-ds PrdDescP ExtName( 'PRDDESCP' ) Qualified end-ds;
dcl-ds PrdDescPSQL ExtName( 'PRDDESCP' ) based(PrdDescP_P) end-ds;
dcl-s PrdDescP_P pointer;
PrdDesc_P = %addr(PrdDescP);
exec SQL select * from PRDDESCP into PrdDescPSQL;

Conceptually because I don't have access to the source right now and I haven't been able to actually use the new free form.

And I'm not sure how that would translate to your example, but I could not find another way around the restriction.

Sam

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 email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

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