Hi Barbara,
Thanks a lot for responding to my query. Thanks so much for the sample example on inheriting DIM keyword.
My xsd for brand  defines as below:
<xs:element name="brand" maxOccurs="unbounded">
 
 
So I defined brand as dim(999)- I am anticipating max of 999 or min of 3.
 
d brand                              likeds(brand_Template) DIM(999)
 
doesnt brand_Template get dim(999) applied automatically in below ? since you mentioned(
Your brand_Template doesn't have DIM(999). You only have DIM(999) on the brand subfield of brands_Template.)
 
 
d brand_Template  DS                  qualified  based(dummy_ptr)
d name                          10a
d branchcode                    5a
d productcode                    6a
 
Does duplicate definition of XML necessary to have DIMs defined ? In example File1_Template DS gets elements from more than one DS, only brand_Template has DIM but not name_Template. I need duplicate so I can use EVAL-CORR to compare with XML data structure to get data for file fields. 
 
 * Defining duplicate XML version for secondary version              
d File1_Template...                                              
d                 ds                  qualified based(ptrbrand)      
d branch                              like(brand_Template.branchcode) const
d                                     dim(MAX_BRAND)                          
d product                              like(brand_Template.productcode) const
d                                     dim(MAX_BRAND)
d fnam1                              like(name_Template.firstname)
D                                     const                        
D lnam2                              like(name_Template.lastname) 
D                                     const




________________________________
From: Barbara Morris <bmorris@xxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Thursday, May 10, 2012 12:12 AM
Subject: Re: XML data structure question

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).

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.