Using DATA-GEN + YAJLDTAGEN for iterative build
Posted: Wed Mar 30, 2022 9:14 pm
I know I could do this by simply nesting the structures, but I am trying to use the iterative build feature for cases where the array size exceeds RPG's capabilities. Problem is no matter how I try to structure it the resulting JSON is always "close but no cigar". I have these two DS;
And what I want to produce is something like this:
No matter what combo of DATA-GEN I try the best I can get so far is this:
I'm guessing that between YAJLDTAGEN and DATA-GEN there is not a combination that will work. Is there any kind of JSON document that can be built iteratively ? I can't think of anything right now but since I know Scott would have tested the capability I feel I am just missing something.
Code: Select all
Dcl-ds orderHeader Inz;
CustomerName varchar(40);
CustomerId char(6);
name_PO_Number char(9) inz('PO Number');
PO_Number varchar(20);
DueDate date(*USA);
End-ds;
Dcl-ds detailLine;
itemCode char(8);
quantity int(5);
price packed(5:2);
End-ds;
Code: Select all
{
"CustomerName": "",
"CustomerId": "",
"PO Number": "",
"DueDate": "03/30/2022",
"Details": [
{
"itemCode": "Item-1",
"quantity": 1,
"price": 0.60
},
repeat items ad naseum
]
}
Code: Select all
{
"CustomerName": "",
"CustomerId": "",
"PO Number": "",
"DueDate": "03/30/2022"
} <<< this close not wanted ...
[ <<< this array needs a key
{
"itemCode": "Item-1",
"quantity": 1,
"price": 0.60