Trim strings and suppress empty array elements from RPG?
Posted: Wed May 24, 2023 10:07 am
So I have an RPG program that I have set up to be called using PROFOUND API. It works just fine. But I find that it outputs trailing spaces in the 75 char fields I have mapped. In addition, my array is the same size each time regardless of the number of entries it actually contains. I have searched for information about this but haven't found any. Is there an easy way to handle this or would this require writing a js solution within the API tool?
dcl-ds jsonOut qualified template;
prgmstr_id int(10);
purge_datetime timestamp;
path char(75);
pattern char(75);
end-ds;
dcl-pi *n;
server char(75);
data likeds(jsonOut) dim(50);
end-pi;
dcl-ds jsonOut qualified template;
prgmstr_id int(10);
purge_datetime timestamp;
path char(75);
pattern char(75);
end-ds;
dcl-pi *n;
server char(75);
data likeds(jsonOut) dim(50);
end-pi;