To eliminate performing an array lookup to locate the entry for the needed
value, you could use an LCLA SET symbol to represent the array key.
This allows the assembler to keep track of the subscripts for you.
For example:
MACRO &VALUE=
...
GBLA &(INDEX_&VALUE),
&GBLA_CTR1
...
&GBLA_CTR1 SETA &GBLA_CTR1+1
&(INDEX_VALUE) SETA &GBLA_CTR1
...
Later on in the final macro, you could reference the array entries for value
'ABCD' by the following:
&INDEX SETA &(INDEX_ABCD)
...
&VALUE1 SETC &ARRAY1(&INDEX)
...
and so on
Bill Hitefield
Dino-Software Corporation
800.480.DINO
423.878.5660
www.dino-software.com
-----Original Message-----
From: IBM Mainframe Assembler List <[email protected]> On Behalf
Of Charles Mills
Sent: Monday, March 04, 2019 2:27 PM
To: [email protected]
Subject: Re: Best practice using Conditional Assembly
Cool! New since I was last writing serious HLASM macros. Also suggested by
someone else. It's a good solution to the stated problem but I think the GBLC
array might be his best solution overall since it would feed directly into
generating the table. It's not elegant -- sequentially searching an unsorted
character array again and again in what is basically an interpreted language --
but it would do the job.
Charles
-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On
Behalf Of Tony Harminc
Sent: Monday, March 4, 2019 9:53 AM
To: [email protected]
Subject: Re: Best practice using Conditional Assembly
On Sun, 3 Mar 2019 at 19:15, Charles Mills <[email protected]> wrote:
> You can't do in conditional assembler what you could do in Rexx,
> right? In Rexx, given "input" of ABCD you could set ABCD.IsDefined to
> TRUE and subsequently check it. You can't do that in conditional assembler,
> can you?
> Given an input parameter of ABCD, essentially define a LCLB named &XCODE?
You *can* do something similar in conditional assembler. They're called created
SET symbols, and the syntax is roughly
&(&xxx) SETB 1
where &xxx can be an expression just as well as a single variable symbol. They
can appear anywhere an ordinary SET symbol can, e.g. in GBLx, SETx, and all the
various references. One big difference from REXX is that the resulting created
symbols have to be syntactically valid, i.e.start with an "&", then an alpha
(including $, #, @, _), and contain only the usual alphanumerics in the rest.