Here's an example of how I would address this issue:
MYDATAMAP DSECT ,
MYFIELD1 DS [whatever]
MYFIELD2 DS [whatever]
...
MYDATAMAPZ DS 0X
MYDATAMAPL EQU MYDATAMAPZ-MYDATAMAP
...
MYSOMETHINGELSE {C|D}CSECT ,
...
MYEMBEDDEDINSTANCE DS 0D
DS XL(MYDATAMAPL)
...
MYCODE CSECT ,
...
MD USING MPDATAMAP,MYEMBEDDEDINSTANCE
...
L R1,MD.MYFIELD1
[etc]
...
DROP MD
Basically, what I do when I want to create one or more embedded
instances of a common data structure is this:
* I create one map of the common data structure. (That map can be
an entire dsect, but there's a way to use just part of a dsect if the
common data is embedded into some sort of primary instance.)
* Then for all embedded instances, I create a single field
(paying attention to alignment as necessary) whose length is equal to
the common data structure's length.
* The when I want to reference the fields within the embedded
instance, I'll establish a named dependant using to overlay the
common data structure's map over on top of the embedded instance.
When done right, all changes to the common data structure will
automagically be propagated to all embedded instances and all code
that references them.
Done.
Dave Cole
ColeSoft Marketing
414 Third Street, NE
Charlottesville, VA 22902
EADDRESS: <mailto:[email protected]>[email protected]
Home page: www.colesoft.com
Facebook: www.facebook.com/colesoftware
YouTube: www.youtube.com/user/colesoftware
At 10/2/2014 12:14 PM, Gary Weinhold wrote:
I am trying to develop a technique to force a DSECT (describing some
private control block of mine) to stay synchronized with the
inline-constant and space-reserving versions of the same control block.
For example, for DSECT ABC with field definitions of
ABCID DS CL4 Eyecatcher
ABCLEN DS AL2 Length of ABC
ABCLVL DS AL2 ABC modification level
ABCDATA DS F Some binary data
ABCL EQU (*-ABCID)
I would like to be able to generate in-line constants:
label1 DS 0F
DC CL4'EYEC'
DC AL2(ABCL)
DC AL2(1)
DC F'0'
ABCL EQU (*-label1)
and space:
label2 DS CL(ABCL)
The DSDC macro generates a labeled DS statements or unlabeled DC
statements depending on &TYPE; its format is, for example:
ABCEYE DSDC CL4,C'ABCD','EYECATCHER',&TYPE
ABCLEN DSDC AL2,(ABCBLKLN),'LENGTH OF THIS CONTROL BLOCK',&TYPE
Although I started work on this with a macro I call DSDC, I was
wondering if I'm reinventing the wheel. Is there a model for this out there?
Any suggestions are welcome.
Gary Weinhold
Data Kinetics, Ltd.
Dave Cole
ColeSoft Marketing
414 Third Street, NE
Charlottesville, VA 22902
EADDRESS: <mailto:[email protected]>[email protected]
Home page: www.colesoft.com
Facebook: www.facebook.com/colesoftware
YouTube: www.youtube.com/user/colesoftware