On Sat, Aug 16, 2014 at 7:33 AM, Peter Hunkeler <[email protected]> wrote:
> Hello list members,
>
> This is my first post to this list. I've been working on MVS for some
decades and have been an active member of IBM-MAIN for many years. This
time I need some help with an assembler macro. In former times I've
programmed in assembler quit a lot. However, this knowledge is a bit rusty.
>
> 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

In order to check at assembly time, the parameter given via the WORKL=
parameter _must_ be a "self defining term". That is, the assembler must be
able to resolve it into a number at assembly time. Things like "01" or
K'&something or L'VARNAME , and so on. I quick example of what I would do
would look something like:

     MACRO
&LBL MACNAME &WORKA=,&WORKL=
&LBL DS      0H JUST HANG A LABEL HERE
... code
*
* TEST TO BE SURE WORKA IS LONG ENOUGH
     AIF (LGENMAC,LE,&WORKL).GOODPARM
     MNOTE 8,'ACCORDING TO THE &&WORKL= PARAMETER,'
     MNOTE 0,'THE &&WORKA AREA IS TOO SMALL'
     MNOTE 0,' PLEASE LOOK AT THE LISTING FOR THE VALUE'
     MNOTE 0,' OF THE LGENMAC SYMBOL TO FIND THE MINIMAL'
     MNOTE 0,' SIZE REQUIRED'
     MEXIT , THAT'S ALL FOLKS!
.GOODPARM ANOP
*
*MORE CODE?
*
GENERATED_MACROS DS 0D #I ALWAYS ALIGN TO DOUBLEWORD
.. insert generated macros here
     DS      0D AND I SIZE UP TO ANOTHER DOUBLEWORD
LGENMAC EQU *-GENERATED_MACROS



-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

Reply via email to