UNION...END UNION
◄Up► ◄Contents► ◄Index► ◄Back►
─────UNION...END UNION──────────────────────────────────────────────────────
Action
Causes two or more maps to occupy the same memory location.
Syntax
UNION
map-statement
map-statement
[map-statement] ...
END UNION
Parameter Description
map-statement A map declaration.
Remarks
The UNION statement allocates the same memory area to more than
one variable.
A UNION can only appear within a STRUCTURE.
The $PACK metacommand and /Zp command-line option control how
variables in structures are assigned to beginning byte addresses.
The particular packing option chosen may affect how particular
variables are assigned to the same memory location.
See Also: ◄MAP...END MAP►
◄STRUCTURE...END STRUCTURE►
◄$PACK►
Example
Note how the first 40 characters in the string2 array are
assigned to four-byte integers, while the remaining 20 are
assigned to two-byte integers:
UNION
MAP
CHARACTER*20 string1, CHARACTER*10 string2(6)
END MAP
MAP
INTEGER*2 number(10), INTEGER*4 var(10), INTEGER*2
+ datum(10)
END MAP
END UNION
-♦-