This is something I have not done before, working with nested data
structures.
Here is an abbreviated definition of the data structure.
dcl-ds dsOBK368 qualified;
CMSnumber varchar(6) ; // obcsq100.kcms#
EnteredBy varchar(10); // obcsq100.kenusr
Currency varchar(3); // mscmp100.ccrcd
// Use USD if blank
dcl-ds dsErrorUsers likeds(dsErrorUsers_t) dim(5) ;
SalesmanNumber varchar(3); // obcsq100.ksalno
SalesManName varchar(25); // sasmp100.smnam
dcl-ds dsCMSLines likeds(dsCMSLines_t) dim(100) ;
end-ds;
dcl-ds dsErrorUsers_t qualified Template;
User varchar(10); // obcsq100.ke1usr
// obcsq100.ke2usr
// obcsq100.ke3usr
// obcsq100.ke4usr
// obcsq100.ke5usr
end-ds;
dcl-ds dsCMSLines_t qualified Template;
LineNumber varchar(3); // obcsq200.kline
Product varchar(15); // obcsq200.kprdn
ReasonCode varchar(3); // obcsq200.klrcd
ReturnQuantity varchar(6); // obcsq200.klnqty (5,0)
InvoicePrice varchar(15); // obcsq200.kinvpr (13,3)
RequestedPrice varchar(15); // obcsq200.kreqpr (13,3)
ListPrice varchar(15); // obcsq200.kprice (13,3)
CMSAmount varchar(15); // List Price * Return Qty
ApprovalType char(1); // obcsq100.kcmsty
NextUser varchar(10); // obcsq100.knxusr
NextApprover varchar(10); // obcsq100.knxapv
EditAllowed char(1); // Default Y
end-ds;
Snippet of RPG
dsOBK368.dsCMSLines[wCount].LineNumber =
%char(dsOBCSQ200_a.KLINE) ;
dsCMSLines[wCount].Product = dsOBCSQ200_a.KPRDNO ;
dsOBK368.dsCMSLines.ReasonCode = dsOBCSQ200_a.KLRCD ;
Question:
1. How do I increment the element number ? The above does not get past
the compiler. I have tried it the other way too.
dsCMSLines.Product[wCount] = dsOBCSQ200_a.KPRDNO ;
2. Compiler complains about the first lines saying the field types are
not the same. However, I am converting the packed to character using %CHAR.
This is an SQLRPGLE program on v7.4.
Thank you.
Darryl Freinkel
A4G
Telephone: 770.321.8562
As an Amazon Associate we earn from qualifying purchases.
Follow-Ups :
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page . If you have questions about this, please contact
[javascript protected email address] .
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.