Problem outputing DATA-GEN with array

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
Post Reply
whayes
Posts: 1
Joined: Tue Jun 16, 2026 6:50 pm

Problem outputing DATA-GEN with array

Post by whayes »

i have an incoming pricing request with an array in it. I capture the number of elements on the incoming using the num_ countprefix option
Problem is on the data-gen it isn't recognizing that and tries to write all the elements and i get data decimal errors on the numeric fields being blank whenever i pass less than the 50 elements. 1st time using both so probably doing something wrong on the outgoing data gen . Data-into works great.

dcl-ds incoming qualified;
cusn char(10);
dtes zoned (8:0);
num_itmnin int(10);
dcl-ds itmnin dim(50);
item char(10);
bccdt char(1);
newprc zoned (8:2);
end-ds;
end-ds;

data-into incoming
%DATA(json:'doc=string countprefix=num_')
%PARSER('YAJLINTO');

dcl-ds outgoing qualified;
num_itmno int(10);
dcl-ds itmno dim(50);
itmo char(10);
name_itmo char(10) inz('itmn');
prcnt zoned (8:2);
flrt zoned (8:2);
base zoned (8:2);
end-ds;
end-ds;

outgoing.num_itmno = incoming.num_itmnin;
data-gen outgoing
%DATA(json:'doc=string countprefix=num renameprefix=name')
%GEN('YAJLDTAGEN');
jonboy49
Posts: 264
Joined: Wed Jul 28, 2021 8:18 pm

Re: Problem outputing DATA-GEN with array

Post by jonboy49 »

I have never experienced this -it always works fine for me.

I did notice, however, that your countprefix option on the DATA-GEN was spelled incorrectly. It may be a typo, but you coded:

Code: Select all

 
%DATA(json:'doc=string countprefix=num renameprefix=name')
instead of:

Code: Select all

 
%DATA(json:'doc=string countprefix=num_ renameprefix=name')
Is that the problem?
Post Reply