The symbol table allows each symbol to have a program type and an assembler type assigned.
The DC and DS assembler instructions allow you to specify a program type in the fourth subfield, following type_extension.
The subfield has the format P(program_type), where program_type is a 32 bit self-defining term. For example:
Honda DC HP(C'Car')'13' Nissan DC HP(C'Car')'32' Kenworth DC FP(C'Truk')'128' Mack DC FDP(C'Truk')'101'
The assembler assigns a default assembler type to the symbol comprising the type_user subfield and, if specified, the type_extension subfield.
The EQU assembler instruction allows you to specify a program type operand and an assembler type operand.
You use the fourth operand (program type) to specify a 32-bit self-defining term. This value is assigned as the symbol's program type. For example:
Payment EQU 13,,,C'Rate' Bonus EQU 42,,,12345
You use the fifth operand (assembler type) to specify an assembler type keyword, which is restricted to a specific set of keywords. For a list of valid keywords for the EQU instruction, see "EQU instruction" in the HLASM Language Reference. The value (1 to 4 bytes) is assigned as the symbol's assembler type.
For example:
R9 EQU 9,,,,FPR
R10 EQU 10,,,,GR
R11 EQU 11,,,,GR
The SYSATTRP built-in function allows you to query the program type for a symbol. The SYSATTRA built-in function allows you to query the assembler type for a symbol.
For details about the DC, DS, and EQU instructions, or the SYSATTRP and SYSATTRA built-in functions, see the HLASM Language Reference.
Figure 71 shows the behavior using T' and built-in functions to retrieve the original type attribute, the program type, and the assembler type for a DC symbol. Also shown is the extended DC instruction allowing the assigning of the program type to the defined symbol.
Macro
&Lab Show_Types &Symbol
&Original_Type SetC T'&Symbol
&Program_Type SetC SYSATTRP('&Symbol')
&Assembler_Type SetC SYSATTRA('&Symbol')
MNote 0,'Type Attribute via T'' is ''&Original_Type.''.'
MNote 0,'Program Type via function is ''&Program_Type.''.'
MNote 0,'Assembler Type via function is ''&Assembler_Type.''.
MEnd
*
Show1 Show_Types Increment
+ 0,Type Attribute via T' is 'F'.
+ 0,Program Type via function is 'Mony'.
+ 0,Assembler Type via function is 'F'.
Show2 Show_Types PayRate
+ 0,Type Attribute via T' is 'F'.
+ 0,Program Type via function is 'Mony'.
+ 0,Assembler Type via function is 'FD'.
*
Increment DC FP(C'Mony')'3'
PayRate DC FDP(C'Mony')'42'Figure 72 shows the behavior using T' and built-in functions to retrieve the original type attribute, the program type, and the assembler type for an EQU symbol. Also shown is the EQU instruction allowing the assigning of assembler types to symbols used to represent registers.
Macro
&Lab Show_Types &Symbol
&Original_Type SetC T'&Symbol
&Program_Type SetC SYSATTRP('&Symbol')
&Assembler_Type SetC SYSATTRA('&Symbol')
MNote 0,'Type Attribute via T'' is ''&Original_Type.''.'
MNote 0,'Program Type via function is ''&Program_Type.''.'
MNote 0,'Assembler Type via function is ''&Assembler_Type.''.
MEnd
*
Show1 Show_Types R0
+ 0,Type Attribute via T' is 'U'.
+ 0,Program Type via function is 'Work'.
+ 0,Assembler Type via function is 'GR'.
Show2 Show_Types R1
+ 0,Type Attribute via T' is 'U'.
+ 0,Program Type via function is ''.
+ 0,Assembler Type via function is 'GR32'.
Show3 Show_Types A12
+ 0,Type Attribute via T' is 'U'.
+ 0,Program Type via function is ''.
+ 0,Assembler Type via function is 'AR'.
Show4 Show_Types FP4
+ 0,Type Attribute via T' is 'U'.
+ 0,Program Type via function is 'Spam'.
+ 0,Assembler Type via function is 'FPR'.
*
R0 EQU 0,,,C'Work',GR
R1 EQU 1,,,,GR32
A12 EQU 12,,,,AR
FP4 EQU 4,,,C'Rate',FPR[ Top of Page | Previous Page | Next Page | Contents | Index ]