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



In addition to what was said about the pre-compiler not handling nested
DS...

Even if nested DS were supported, the structure you're using doesn't make
sense for the cursor you have defined...

With the dsIniziativa structure defined as it is, I'd expect to see some
sort of pivoting being done in the cursor to consolidate multiple rows into
a single row with repeating dsIniziativa elements. But Db2 also doesn't
support dynamic pivoting like that.

Charles


On Mon, Apr 20, 2020 at 5:20 AM Maria Lucia Stoppa <mlstoppa@xxxxxxxxx>
wrote:

Goodmorning,

I've struggled with an arrays of arrays for a while now, but I couldn't
find out why it doesn't work.
Without the use of the "iniziative" variabile the service program compiles
and runs as expected.
When I try to use "iniziative" variable in dsAgente, which is based on
"dsIniziativa" the compile process always returns
"SQL0312 Variable DSAGENTE not defined or not usable in position 24 ."

That's the code:
dcl-proc getListaAgenti export;
//--------------------------------------
dcl-pi *N;
i_codice char(3) const;
errore ind;
messaggio varchar(250);
contaAgenti int(5);
agenti likeds(dsAgente) dim(999);
end-pi;
//--------------------------------------
dcl-ds dsAgente qualified inz;
codice varchar(3);
nominativo varchar(35);
telefono varchar(20);
email varchar(50);
emailPEC varchar(50);
agenziaId varchar(4);
inizioMandato zoned(8: 0);
iniziativeAttive zoned(3: 0);
iniziative likeds(dsIniziativa) dim(999);
end-ds;
//--------------------------------------
dcl-ds dsIniziativa inz;
codice varchar(6);
comune varchar(35);
provincia char(2);
stato varchar(10);
campagna ind;
end-ds;
(some initializations here)
//--------------------------------------
exec sql
declare cur_age cursor for
select
trim(agn.ageagn)
, trim(age.agras)
, trim(age.agtel)
, trim(age.agmail)
, trim(agx.prpec)
, trim(agn.agegnz)
, agx.prdim
, 0
from AGELA01L agn //agenda
left join AGEAG00F age on agn.ageagn =
age.agage //anagrafica agente
left join AGEPR01L agx on agn.ageagn =
agx.prage //estensione agente
where 1 = 1
and agn.ageagn =
case
when :wFiltroCodice = 'all' then agn.ageagn
else :wFiltroCodice
end
order by agn.ageagn
;
exec sql open cur_age;
dow 1 = 1;
reset dsAgente;
exec sql fetch cur_age into :dsAgente;
(rest of the code)

The error instruction is the "fecth into", the last blue one.

I tried using precompiler options *LVL1 and *LVL2 without success.
I really don't know where the problem is, also because the message is too
generic, and I can't update the system right now to install the latest
cumulative which allow a detailed message to be printed.

Thank you for any help.
(and I hope you are all fine)

--

Maria Lucia Stoppa
mlstoppa@xxxxxxxxx
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.