At 14:33 +0200 on 08/16/2014, Peter Hunkeler wrote about How to
assign length of generated instructions to macro var:
I want to modify a macro I've written long ago to generate reentrant
code. For that, I'm asking for two new parameters: WORKA= and
WORKL=, the address of a workarea (in dynamically allocated storage)
for the macroo use, and the length of that area.
The code generated varies in length, depending n what parms are
specified on the macro. Some of what he code does is to generate
list forms of other macros inline plus the instructions to move that
part to the workarea, where it can be further modified by my macro.
I want the macro to check that the length of the code generated does
not exeed the length of the workarea as indicatedby WORKL=.
I have not come up with a way to get the length of a code section
the macro generated into macro variables, so that I can compare to
WORKL= and abort if neccessary.
--
Peter Hunkeler
From your description you are generating a MF=L and then moving it to
the work area to be filled in. Why not just change the WORKL to be a
symbol which is used to make an EQU?
START&SYSNDX DS 0D
MAPPING-MACRO-CALL MF=L,....
END&SYSNDX DS 0D
&WORKL EQU END&SYSNDX-START&SYSNDX
Now use the symbol associated with the WORKL to define the work area
length. IOW: If your WORKA=AREA and WORKL=LENGTH then the definition
of the work area in your code is:
DS 0D
AREA DS XL(LENGTH)
Your macro would just populate the work area via
MVC AREA,START&SYSNDX
If the length could be over 256 bytes then use a MVCL and R0-R1 and R14-R15.