Although it may initially seem confusing, the technique of
defining a flag bit using EQU in the following form, using the
length attribute to provide the bit mask, provides a safe way to
ensure that the named flag is mapped to the correct field:

 flag     EQU  field,mask

or (avoiding an unnecessary cross-reference to the field and
even a name for the field itself):

 flag1    EQU  *,mask1
 flag2    EQU  *,mask2
          ...
          DS   BL1         Flag byte

So for example, HLASM itself has some internal macros TF, SF and
CF (test flag, set flag and clear flag) which generate code such
as the following:

          TF   flag
+         TM   flag,L'flag

I have seen many errors caused by code testing flags mask bits
in the wrong field after data areas have been modified, but this
technique eliminates that class of errors.

This is of course not the normal intended use of the length
attribute, but it means that independent flags and bit masks can
be set and tested as simply as in high level languages.

Jonathan Scott, HLASM
IBM Hursley, UK

Reply via email to