On 2012/5/9 12:37 PM, murali dhar wrote:
I am doing duplicate definition of XML to match to my file fields.
...
In below example branch and product are referenced to
brand_Template.branchcode and brand_Template.productcode respectively.
Since brand_Template has got DIM(999) Is my definition correct for
branch and product in File1_Template?
Only two elements branch and product belong to array data structure
(brand_Template) and rest come from anotehr data structure which is not
an array. How do I handle dim(999)definition from brand_Template to
these two elements in File1_template data structure?
Your brand_Template doesn't have DIM(999). You only have DIM(999) on the
brand subfield of brands_Template.
d brands_Template...
d DS qualified based(dummy_ptr)
d brand likeds(brand_Template) DIM(999)
d brand_Template DS qualified based(dummy_ptr)
d name 10a
d branchcode 5a
d productcode 6a
Here is your File1_template ds:
d File1_Template...
d ds qualified based(ptrbrand)
d branch like(brand_Template.branchcode)
...
If you don't want the File1_Template.branch subfield to be an array,
then it is already fine.
LIKE and LIKEDS definitions don't inherit the DIM keyword, so if you do
want the File1_Template.branch subfield to be an array, you have to code
the DIM keyword.
You could code it as DIM(%ELEM(brands_Template.brand)), but I think it
would be better to define a named constant as 999, and use that for all
the DIM keywords.
D MAX_BRAND c 999
d brands_Template...
d DS qualified based(dummy_ptr)
d brand likeds(brand_Template)
d dim(MAX_BRAND)
d File1_Template...
d ds qualified based(ptrbrand)
d branch like(brand_Template.branchcode)
d dim(MAX_BRAND)
Just to clarify what I said about LIKEDS not inheriting the DIM keyword,
that's only for the DS itself. A LIKEDS definition does inherit the DIM
keyword for any array subfields subfields.
d ds1 ds qualified dim(10)
d subf 10a dim(5)
d ds2 ds likeds(ds1)
d ds3 ds likeds(ds1) dim(%elem(ds1))
ds2 is not an array, but ds2.subf is an array with dim(5).
ds3 is an array with dim(10), and ds3(i).subf is also an array with dim(5).
As an Amazon Associate we earn from qualifying purchases.