UNION and MAP
The UNION @ statement
defines groups of fields that share memory at runtime.
The syntax of a UNION declaration
is as follows:
A MAP statement
defines alternate groups of fields in a union. During execution,
one map at a time is associated with a shared storage location.
When you reference a field in a map, the fields in any previous map
become undefined, and are succeeded by the fields in the map of the
newly referenced field. Also:
A UNION declaration
can appear only within a STRUCTURE declaration.
The amount of memory used by a
union is that of its biggest map.
Within a UNION declaration,
the order of the MAP statements
is not relevant.
The UNION line
is part of an inherently multiline group of statements, and neither
the UNION line
nor the END UNION line
has any special indication of continuation. You do not put a
nonblank in column six, nor an & in
Each field-declaration in
a map declaration can be one of
structure /STUDENT/ to
contain either NAME, CLASS,
and MAJOR, or NAME, CLASS, CREDITS,
RECORD /STUDENT/ PERSON
In the above example, the
variable PERSON has
the structure /STUDENT/,
If the variables of the second map
field are initialized, and then the program references the
the first map becomes active, and the variables of the second map
<!-- 正文结束 -->
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/23260549/viewspace-1115853/，如需转载，请注明出处，否则将追究法律责任。