The MERGE command copies a variable and all its descendants into another variable. MERGE does not delete the destination variable, nor any of its descendants.
The format of MERGE command is:
M[ERGE][:tvexpr] glvn1=glvn2[,...]
The optional truth-valued expression immediately following the command is a command post conditional that controls whether or not GT.M executes the command.
When both glvn1 and glvn2 are local variables, the naked indicator is not changed.
If glvn2 is a global variable and glvn1 is a local variable, then the naked indicator references glvn2.
When both are global variables, the state of the naked indicator is unchanged if glvn2 is undefined ($DATA(glvn2)=0).
In all other cases including $DATA(glvn2)=10, the naked indicator takes the same value that it would have if the SET command replaced the MERGE command and glvn2 had a value.
If glvn1 is a descendant of glvn2, or if glvn2 is a descendant of glvn1; GT.M generates an error.
An indirection operator and an expression atom evaluating to a list of one or more MERGE arguments form a legal argument for a MERGE.
MERGE simplifies the copying of a sub-tree of a local or global variable to another local or global variable. A sub-tree is all global or local variables that are descendants of an specified variable. MERGE offers a one-command alternative to the current technique for doing sub-tree copy (that is, a series of SET commands with $ORDER references).
GT.M may permit certain syntax or actions that are described by the standard as in error. For example, a MERGE command that specifies an operation where the source and destination overlap but $DATA(source)=0 does not produce an error (which is equivalent to a no-operation). |