With some extra work, you could do something like this
NAME FLAGS FOO+BAZ
FOO FLAG X'80'
BAR FLAG X'40'
BAZ FLAG X'20'
...
FON BAR+BAZ
...
FOFF FOO
...
FTM FOO+BAR
or even this
NAME FLAGS HH,[FOO+BAZ]
* STORAGE - Generate DC AL1, use storage immediate
* HH - Optional DC AL2, use register immediate
* HL - Optional DC AL2, use register immediate
* LH - Optional DC AL2, use register immediate
* LL - Optional DC AL2, use register immediate
FOO FLAG X'80'
BAR FLAG X'40'
BAZ FLAG X'20'
...
MYINIT FDC FOO+BAZ
...
FON BAR+BAZ,REG=MYREG
...
FOFF FOO,REG=MYREG
...
FTM FOO+BAR,REG=MYREG
or even count bits automatically.
--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf
of Steve Smith [[email protected]]
Sent: Wednesday, August 16, 2023 11:23 AM
To: [email protected]
Subject: Re: Self-documenting Bit Settings
I don't object to using the length attribute this way, but with another
macro, you can avoid that. We have a set of macros that define, test, set,
or clear flags very easily, but use a definition macro works like so:
&name @FLAG &value
&name._A EQU *-1
&name._V EQU &value
The other macros look like (e.g.):
@SETFLAG FLAGX
and generate:
OI FLAGX_A,FLAGX_V
@CLRFLAG would produce NI FLAGX_A,255-FLAG_V (of course).
You still have to code a DC B or something before the @FLAG macros,
labelled or not. So, otherwise it works the same as using the length
attribute.
There are slight pros & cons to each, so I guess it comes down to
preference or possibly local standards.
sas
On Wed, Aug 16, 2023 at 10:08 AM Dave Clark <[email protected]>
wrote:
> "IBM Mainframe Assembler List" <[email protected]> wrote on
> 08/16/2023 10:05:25 AM:
> > I can see that point.
>
>
> So, now my three macros follow this pattern -- pending further
> recommendations. Thanks.
>
> MACRO
> &LABEL TF &FLAG,&BAD TEST FLAG BIT(S)
> AIF (T'&BAD EQ 'O').GOOD
> MNOTE 12,'TOO MANY OPERANDS SPECIFIED'
> MEXIT
> .GOOD AIF (T'&FLAG NE 'O').BEGIN
> MNOTE 12,'AN OPERAND IS REQUIRED'
> MEXIT
> .* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> .* This is a simple macro to make it easier to accurately manipulate *
> .* a bit flag definition just by the equated bit mask name -- i.e., *
> .* the macro does not need to know the name of the actual flag byte *
> .* nor the flag byte even have to have a name at all. *
> .* *
> .* As presented by the late Dr. John Ehrman of IBM at SHARE. *
> .* *
> .* The idea is, you can have a definition similar to either of the *
> .* following. The actual flag byte does not need a name but you can *
> .* specify one if you want it to show up in the cross-reference or *
> .* if you want the equated bit masks to follow the flag byte def- *
> .* inition. The equated bit masks then take on the location of the *
> .* flag byte and the length of the equated bit mask is set to the *
> .* bit mask, itself. *
> .* *
> .* FLAG1 EQU *,B'00000001' *
> .* FLAG2 EQU *,B'00000010' *
> .* FLAG3 EQU *,B'00000100' *
> .* FLAG4 EQU *,B'00001000' *
> .* FLAG5 EQU *,B'00010000' *
> .* FLAG6 EQU *,B'00100000' *
> .* FLAG7 EQU *,B'01000000' *
> .* FLAG8 EQU *,B'10000000' *
> .* DS BL1 MY FLAG BYTE *
> .* *
> .* MYFLAG DS BL1 MY FLAG BYTE *
> .* FLAG1 EQU MYFLAG,B'00000001' *
> .* FLAG2 EQU MYFLAG,B'00000010' *
> .* FLAG3 EQU MYFLAG,B'00000100' *
> .* FLAG4 EQU MYFLAG,B'00001000' *
> .* FLAG5 EQU MYFLAG,B'00010000' *
> .* FLAG6 EQU MYFLAG,B'00100000' *
> .* FLAG7 EQU MYFLAG,B'01000000' *
> .* FLAG8 EQU MYFLAG,B'10000000' *
> .* *
> .* NOTE: See also the SF macro and the CF macro. *
> .* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> .BEGIN ANOP
> &LABEL TM &FLAG,L'&FLAG TEST FLAG BIT(s)
> MEND
>
> Sincerely,
>
> Dave Clark
> --
> int.ext: 91078
> direct: (937) 531-6378
> home: (937) 751-3300
>
> Winsupply Group Services
> 3110 Kettering Boulevard
> Dayton, Ohio 45439 USA
> (937) 294-5331
>
>
>
>
>
>
> *********************************************************************************************
> This email message and any attachments is for use only by the named
> addressee(s) and may contain confidential, privileged and/or proprietary
> information. If you have received this message in error, please
> immediately notify the sender and delete and destroy the message and all
> copies. All unauthorized direct or indirect use or disclosure of this
> message is strictly prohibited. No right to confidentiality or privilege
> is waived or lost by any error in transmission.
>
> *********************************************************************************************
>