In this case, I am using AREAD to build a branch table. The macro first
edits the value passed based on the number of entries in the branch
table. It needs knows how many entries by reading branch_to points. (It
also builds the table while it is reading/counting the number of
entries.) The number of entries can easily be over 60 in many of my
programs.
Tony Thigpen
Jon Perryman wrote on 5/3/21 3:06 PM:
AREAD is intended for reading the source file. Although there are
workarounds, I personally avoid them because you can run into problems with
macros that use aread. As you mentioned, SETC to a global variable is a good
option to pass information.
What are the negative issues you encountered with SETC? I've written a lot of
macro's and never had an issue. Sometimes it's more work than I would like but
still manageable. For instance, do you really need AREAD or would temporarily
override opcodes work?
Jon.
On Monday, May 3, 2021, 08:31:25 AM PDT, Tony Thigpen <[email protected]>
wrote:
I have several macros that use AREAD. But, I tried something this
weekend that I still have not figured out. Maybe someone has a suggestion.
I also use macros as a way to include large blocks of common code in
programs. I tried to create such a macro from some code that used one of
my macros that used AREAD. I found that the use of AREAD in the
lower-level macro actually read from the 'top level' program source, not
from the source in the 'next-up' macro.
The doc does indicated that this would happen:
"...from the records in the primary input
stream that follow immediately after the macro instruction."
So, it looks like the only way to use an AREAD and read from an 'higher
level' macro, would be to have the higher level macro push the info to
be read into the buffer using AINSERT. Not as 'nice'.
Did I miss some other option?
(Before you suggest COPY vs. macros for common code, I usually include
parms to the common code. I can re-work that logic using .SETC, etc.,
but that has some negative issues I would need to think about before
doing so.)
Tony Thigpen