I have not used listagg in RPGLE pgm before but figured I'd give it a try, so my result set could be up to 50 rows from the CONFIG table (and I want 2 char codes for each) and it seems the listagg only like a "standalone" field to load into, I'm stuck on how to get the lookup. Can I not just lookup from a qualified array structure?
This code did not compile with an error on the lookup
D LoadDc DS Qualified Dim(50)
D DCList 100A
D dcListA 2A Overlay(DCList:1)
/FREE
Exec Sql
Select listagg(extchar)
Within group (order by extchar) as List
Into: LoadDc.DCList
From CONFIG
Where config_name = 'TESTING';
If %lookup(29:LoadDc(*).dcListA) > 0;
'found lookup';
Else;
'not found';
EndIf;
This code did not compile with an error on the lookup
D LoadDc DS Qualified Dim(50)
D DCList 100A
D dcListA 2A Overlay(DCList:1)
/FREE
Exec Sql
Select listagg(extchar)
Within group (order by extchar) as List
Into: LoadDc.DCList
From CONFIG
Where config_name = 'TESTING';
If %lookup(29:LoadDc(*).dcListA) > 0;
'found lookup';
Else;
'not found';
EndIf;
Comment