×
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 played with this (a little) using my very limited knowledge of V5R4
recursive SQL capabilities. Had to SysReq2 out of a nasty loop.
My concerns would be how to concantenate, and still respect the potential
for spaces at the end of the field. For example, assuming a 10 character
comment field.
....+....1....+...
MYCODE MYDESC
A NOW IS THE
A TIME FOR
A ALL GOOD M
A EN TO COME
A TO THE AI
A D OF THE P
A ARTY.
B THE END.
******** End of d
Occasionally you will have comments at the beginning, or the end. Which
is no big deal, until you consider concantenating that with a field from a
work file like the work file in this infinite loop (remember the SysReq2):
WITH EXPLODED(Pmycode, bigDesc) as
(select mycode, mydesc
from qtemp/testrecur
union all
select mycode,trim(bigDesc) concat mydesc
from testrecur, exploded
where mycode=pmycode)
select * from exploded
order by pmycode
I think you might be better served using a cursor and a varying length RPG
character field (often called a host variable). Then you could simply do
a
exec sql declare cursor ...;
exec sql open cursor ...;
myBigField='';
dow FetchCursorSubprocedure();
myBigField+= MyDesc; // append field on to end of comments
endDo;
exec sql close cursor ...;
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.