bdfs1m1c | Structured Programming Macros |
Use this macro to specify the attributes for symbols referred to in the IF,
DO, CASE, and LET macros. These attributes remain in effect until they
are changed by a subsequent DCL macro.
Format
- symbol
- is the label of a variable or constant that will be referred to in the
structured programming macros (SPMs).
- attribute
- is one of the following types for the symbol being declared:
- SIGNED
- The attribute normally given to fullword (F) or halfword (H)
symbols. The SIGNED attribute causes the field to be treated as
containing a positive or negative fixed binary number whose high-order bit
indicates the sign.
- UNSIGNED
- The attribute normally given to any symbol whose type is not a fullword
(F), halfword (H), or character (C). The UNSIGNED attribute causes the
field to be treated as containing a positive fixed binary number.
- REGISTER
- The attribute normally given to symbols defined to the assembler as
follows:
symbol EQU n
The REGISTER attribute causes the symbol to be treated as a general-purpose
register using n as the register number.
- CHARACTER
- The attribute normally given to character (C) symbols. The
CHARACTER attribute causes the field to be treated as a string of
bytes.
If you do not specify an attribute for a symbol, the symbol is removed from
the symbol table.
- arithcon
- is a decimal integer that represents the length of the symbol, in bytes,
unless REGISTER is specified as the attribute. In that case, it is the
general-purpose register number. If you do not specify
arithcon, the length (L') defined to the assembler is
used. This length (L') is not available at assembly time under some
assemblers if the symbol is generated by a macro. If REGISTER is
specified but the register number is not specified, the register defaults to
the length of the symbol, or 1 if the symbol is an equate.
The value of the arithmetic constant is restricted by the attributes
declared as follows:
- Attribute
- Value Range
- SIGNED
- 1-4
- UNSIGNED
- 1-4
- CHARACTER
- 1-256
- REGISTER
- 0-15
- LIST=YES
- prints all symbols that currently have their assembler attributes
overridden with the DCL macro. The last attributes assigned are printed
with the symbol.
- WORK0=n
- defines the first even-odd pair of general-purpose registers to be used by
the SPMs. The value of n must be even. The registers
are available for use in between macros but will be changed during macro
processing.
- WORK2=m
- defines the second even-odd pair of general-purpose registers to be used
by the structured programming macros. The value of m must be
even and cannot be 0. The registers are available for use in between
macros but may be changed during macro processing.
Entry Requirements
None.
Return Conditions
Control is returned to the next sequential instruction.
Programming Considerations
- Because the SPMs are assembler language macros, all symbols used with the
macros must be previously defined to the assembler. In addition, for
the TPF SPMs, you must declare the attributes of the symbols using the DCL
macro.
For example, to use a symbol in a conditional expression following the IF
macro, you must define the symbol to the assembler and specify the symbol
using the DCL macro.
There are two ways to define a symbol to the assembler:
- Use an EQUATE value.
- Use DS to specify space if a reentrant program is not required.
For example:
NUM EQU EBX016,4,C'F'
is a reentrant form of:
NUM DS F
To use NUM in the SPMs, the attributes for the NUM symbol must be declared
using the DCL macro:
DCL NUM,SIGNED,4
The previous declaration specifies that the NUM symbol is a fullword signed
integer. Any value consistent with a fullword plus a sign bit can be
assigned to the symbol NUM. For example:
LET NUM,=,65537
NUM can be an integer 1 larger than a halfword.
- If you do not specify a symbol, the attributes are determined as
follows.
- If the symbol is defined to the assembler as type C, the attribute is
CHARACTER.
- If the symbol is defined to the assembler as type F or H, the attribute is
SIGNED.
- If the symbol is defined with an EQU statement, the attribute is
REGISTER.
- All other types are given the attribute UNSIGNED including undefined
symbols.
- Use this macro primarily for items (or usage) unique to an individual
program. Also, when possible, do not specify the length so that changes
in size do not require recoding.
- Use the REGISTER attribute only with variables declared with an equate or
with variables not previously defined.
- The DCLREG macro provides a convenient method of declaring each of the
general registers, R0-R15. This allows the registers to be used
in subsequent IF, DO, CASE macros, and as operands to the LET macro.
See DCLREG-Declare General Registers for more information about the DCLREG macro.
Examples
The following example shows several DCL macro statements.
DCL WORK0=8
DCL R2,REGISTER,2
DCL MY0CCT,UNSIGNED,2
DCL MY1CCT,SIGNED,2
DCL MY0TXT,CHARACTER,99
DCL EBW020,CHARACTER,4
DCL FRIEDT
DCL LIST=YES
Related Macros
DCLREG-Declare General Registers.