Peter,

after reviewing John Ehrman's document
"Assembler Language as a Higher Level Language: Macros and Conditional Assembly Techniques - SHARE 95,Sessions 8167-8168"

I was inspired to write a DCL macro that enabled me to define bit fields by name. The byte location, flag value, and their association were managed by the macro. When I would code an IF macro using the bit name, the macro would expand to use the proper field name and flag.
Same for Set/Reset etc.

So - as noted before - the problem is solvable, but it does take quite some macro coding. And therefore time as well, of course... Reading John Ehrman's document may save you some of that time ;-)

Kind regards,
Abe Kornelis
===========




Farley, Peter x23353 schreef op 4-10-2014 21:13:
John,

Thank you for that example, it helps a lot.  The example I gave was generating 
DC lines for the sake of figuring out the proper syntax.  My real goal is a bit 
different.

I have a static list of 64 flag bit names (each one like Flag_A EQU X'80').  I want 
to create a flag-test macro FTEST to test one or more of those bit flags against a 
set of 8 flag bytes, each named FLAGn, 1 <= n <= 8.  So if Flag_A is defined as 
a bit in Flag1, I will generate a test like:

         FTEST Somewhere,Flag_A
+        TM    Flag1,Flag_A
+        BO    Somewhere

And if a list of multiple flag names are provided to the test macro, the result 
should resemble:

         FTEST Somewhere, (Flag_P,Flag_H,Flag_G,Flag_A)
+        TM    Flag1,Flag_A+Flag_G+Flag_H
+        BO    Somewhere
+        TM    Flag2,Flag_P
+        BO    Somewhere

Obviously the trick is to associate a flag number with each name, and to sort 
the list of flag names provided to the FTEST macro by the flag byte number so 
that all tests against the same flag byte are grouped together.

Also, other than a manually created list of GBLA definitions and SETA initializations 
for the flag names (like GBLA &Flag_A and &Flag_A SETA 1), is it possible to 
create a loop that dynamically computes the flag number for each name (where the flag 
names are stored in the proper order in an initialized GBLC array) and dynamically 
creates the GBLA and SETA lines? I.E., is it legal to loop over GBLA as well as SETA 
statements?

Have you solved a problem like this already, or can you suggest an approach 
that will work for such a macro?

Thank you again for your clear example.

Peter

-----Original Message-----
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of John Gilmore
Sent: Saturday, October 04, 2014 1:05 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Syntax for using created SET symbols in a SETC value?

Consider

|&F1id setc '__F1'   --array 1 identifier
|&F2id setc '__F2'   --array 2 identifier
|&F3id setc '__F3'   --array 3 identifier
|        gblc  &(&F1id)(1)   --declare array 1 w/o giving it elements
|        gblc  &(&F2id)(1)   --declare array 2 w/o giving it elements
|        gblc  &(&F3id)(1)   --declare array 3 w/o giving it elements
|&(&F1id)(1) setc 'a','b','c'  --initialize/create first 3 elements of array 1
|&(&F2id)(1) setc 'd','e','f'   --initialize/create first 3 elements of array 2
|&(&F3id)(1) setc 'g','h','i'   --initialize/create first 3 elements of array 3
|&idaid(1) setc '&F1id','&F2id'.'&F3id'   --array of array identifiers
|&arraysn seta n'&idaid  --number of array identifiers
|&i      seta  0                  --initialize arrays index
|.arrays_loop anop  ,      --top of arrays loop
|&i      seta  &i+1            --increment arrays index
|&eoa setb  (&i gt &arraysn)   --arrays exhausted?
|          aif     (&eoa).arrays_lend    --if so, leave arrays loop
|&aident  setc  '&(&idaid)(&i)'  --identifier of array &i
|&elemsn seta n'&(&aident)     --element count array &i
|&j       seta  0                 --initialize elements index
|.elems_loop                   --top of array &i elements loop
|&j       seta  &j+1            --increment elements index
|&eoe  setb  (&j gt &elemsn)   --elements of array &i exhausted?
|           aif    (&eoe).elems_lend    --if so, leave elements loop
|&label setc 'F'.'&i'.'&j'    --DC label
|&target setc '&(&aident)(&j)'   --DC target value
|&label DC C'&target'
|           ago  .elems_loop  --next element da capo
|.elems_lend anop  ,      --bottom of elements loop
|           ago  .arrays_loop  --next array da capo
|.arrays_lend anop  ,     --bottom of arrays loop
| . . .

The only thing problematic about this is the statement

|&label setc 'F'.'&i'.'&j'    --DC label

Suppose you have

0 < &i < 15
0 < &j < 30

within these loops.  Then element 29 of array 1 will have the  label
'F'.'1'.'29'  or F129, and element 9 of array 12 will have the label
'F'.'12'.'9' = F129 too.

This sort of thing can be dealt with easily using the A2D builtin
function and leading-zeros padding to ensure that the character
representations of &i all have the same number of digits and that
those of &j all have the same perhaps different number of digits.  I
can elaborate on this if it seems opaque.

What needs to be emphasized about these constructions is that while
they seem to be intolerably detail-ridden when first encountered one's
cat brain takes over very quickly.  They become very easy to use with
practice.

John Gilmore, Ashland, MA 01721 - USA

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

Reply via email to