As an alternative, I has used dummy named USING statements to validate things like this.

If I remember correctly, the original poster was copying expanded code into a work area. If the code to be copied has a 'last byte' DS 0h, then something like the following will generate an assembler error:

MYMAC    MACRO  MacroLengthParm=,.....
...
CopyFromStart DS 0h
...
... (Code to be copied)
...
...
CopyFromEnd DS 0h
DUMMYUSING USING (CopyFromStart,CopyFromStart+MacroLengthParm),R1
          LA    R1,DUMMYUSING.CopyFromEnd
          DROP  DUMMYUSING
          MEXIT

(Excuse typos, this is off the top of my head.)


Tony Thigpen

-----Original Message -----
 From: Robert Ngan
 Sent: 08/18/2014 12:20 PM
We use code of the form:

WorkArea DSECT
WORD     DS    F
FOO      DS    X
BAR      DS    Y
WorkLen  EQU   *-WorkArea
          DS    (&WORKL-WorkLen)X

If WorkLen exceeds &WORKL, the final DS will have a negative length and
therefore generate an assembly time error.

Robert Ngan
CSC Financial Services Group

IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> wrote on
2014/08/16 07:33:03:

From: Peter Hunkeler <p...@gmx.ch>
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Date: 2014/08/16 07:33
Subject: How to assign length of generated instructions to macro
variable?
Sent by: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU>

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


Reply via email to