× 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 use qualified data structure with SQL all the time and I do a lot of type
definition with Templates and then do a LikeDs to create my local variable
and have not had a problem.

Example. Extremely simple.

d TD_OptionRecord...
d ds Qualified
d Template
d Option...
d 2a

d Options...
d ds LikeDs(TD_OptionRecord)
d Based(ptrOptions)
d Dim(32766)

// Additional code to get a pointer to user space.

Exec Sql Declare C1 Cursor For
Select OPTION
From Z#ACAMPIN/QAUOOPT
Order By OPTION;

Exec Sql Open C1;
If SqlState <> cSqlStateOk;
Dsply 'Open Error';
Return;
EndIf;

Exec Sql Fetch Next
From C1
For 32766 Rows
Into :Options;



On Wed, Oct 15, 2014 at 1:04 PM, <darren@xxxxxxxxx> wrote:

I think the precompiler does okay with qualified data structures. I use
them almost exclusively with SQL. Its the definition that it falls on.
What I mean is that it gets picky about what I put in the likeds( ).
Perhaps the precompiler isn't able to understand the SQLCA as a likeds
structure. I've had to lay things like that out explicitly before, but I
suppose you could also put it into some kind of a copy book as a template.



From: Sam_L <lennon_s_j@xxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 10/15/2014 02:53 PM
Subject: Re: Qualified Data Structure with SQL Insert
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



As I recall, the SQL precompiler doesn't like qualified data structures.
I believe I ran into this at v7R1 and had to solve it with pointers.
I don't have access to that code or a V7R1 machine now, however and your
code is, I think, complicated in that SQLCA is defined and used by the
SQL insert. So even a pointer solution might not work.

You could probably solve the problem quickly by using RLA...

Sam

On 10/15/2014 1:08 PM, Michael Ryan wrote:
I thought I was being clever...perhaps not...I can't get the variables in
the INSERT clause right. I've tried using pIn_SQLCA subfields or In_SQLCA
subfields and I get the :In_SQLCA.SQLWRN -> SQL0312: Position 21 Variable
IN_SQLCA not defined or not usable as well as the other side SQL0312:
Position 30 Variable SQLWRN not defined or not usable. Why can't I do
this?

D In_SQLCA DS LikeDS(SQLCA)

P WSV_Logger...
P B Export
D WSV_Logger...
D PI Like(rc)
D pIn_SQLCA Value
D LikeDS(SQLCA)

D rc S 10I 0

/Free
In_SQLCA = pIn_SQLCA;

Exec SQL
Insert Into WEBSVC/WSVLOGP (WSV_SQLCAID,
WSV_SQLCABC,
WSV_SQLCODE,
WSV_SQLERRML,
WSV_SQLERRMC,
WSV_SQLERRP,
WSV_SQLERR,
WSV_SQLWRN,
WSV_SQLSTATE)
Values ( :In_SQLCA.SQLCAID,
:In_SQLCA.SQLCABC,
:In_SQLCA.SQLCODE,
:In_SQLCA.SQLERRML,
:In_SQLCA.SQLERRMC,
:In_SQLCA.SQLERRP,
:In_SQLCA.SQLERR,
:In_SQLCA.SQLWRN,
:In_SQLCA.SQLSTATE) ;

Return 1;

P WSV_Logger...
P E


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



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