A couple of things we've done in the past is to add a prefix to a base
name, for example:

     MACRO
     MYMACRO &PREFIX=XYZ,&VAL1=,&VAL2=,DSECT=YES
&P  SETC '&PREFIX'
     AIF ('&DSECT' EQ 'YES').DSECT
...
                 DS 0F
       AGO .GEN
.DSECT ANOP ,
MYMACRO DSECT ,
.GEN ANOP ,
&P.NAME DC  CL8'MYMACRO'
&P.FIELD1 DC A('&VAL1')
&P.FIELD2 DC H'&VAL2'
...
   MEND

I've also seen this convention in IBM macros.

Then to create a table entry, use:

TABLE DS 0F
      MYMACRO PREFIX=AB1,VAL1=10,VAL2=100
      MYMACRO PREFIX=AB2,VAL1=100,VAL2=30
      MYMACRO PREFIX=AB3,VAL1=10000,VAL2=50

 LARL R1,TABLE
 USING MYMACRO,R1
...

This certainly works and handles the case of inserting a new field but
creates a lot of never used entries in the symbol table (minor issue I
know) and could in theory create naming conflicts (that should be pretty
evident).


*Mark*


On Thu, Jun 19, 2025 at 3:43 PM Charles Mills <charl...@mcn.org> wrote:

> I have certainly done that. What is the specific problem?
>
> One approach is to let the macro define the total size of the data. Then
> when you want the data to be "real storage" just code MYRECORD DS CL(size
> from macro) and use the DSECT to address it field by field.
>
> Charles
>
> -----Original Message-----
> From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> On
> Behalf Of Paul Gilmartin
> Sent: Thursday, June 19, 2025 12:12 PM
> To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
> Subject: Re: Using the same macro to create the DSECT and a table entry
>
> On 6/19/25 11:20, Mark Hammack wrote:
> > I just read Ed Jaffe's presentation from Share where he mentioned that
> > they have some macros that not only generate a DSECT but using the
> > same macro, generate data in the program.  I can find (and have a few)
> > examples of doing that when the data occurs once in a program but am
> > drawing a blank on a good way to do that for multiple occurrences of the
> macro.
> >     ...
> 1) define labels only on zero-storage instructions (L DS 0F)
>     and bypass them with AIF in the CSECT case.
> Or:
> 2) Use the upper-bound operand to limit the addressability
>     of code and a different USING naming the CSEECT to
>     address the DSECT/
>
> --
> gil
>

Reply via email to