Syntax
ATTACH string_expression variable
Parameters
Attach can be abbreviated as ATT.
string_expression
The text or numeric value to attach to the following result qualifier. If a numeric value is used, it is converted to text.
If it is a number-primitive variable, it cannot declare the decimals.
variable
The result variable.
Description
The Attach logic command concatenates the value of a variable or literal to that of a second variable after the last non-whitespace character, and stores the result in the second variable. Embedded whitespace characters in both variables are retained.
Note: Sign and separator characters in number variables are ignored when the value is attached.
The behavior of the Attach logic command can be replicated using the '&' concatenation operator. Use of operators, where possible, rather than manipulative logic commands, is the LDL+ preferred format.
Data truncation
The following data truncation issues apply to use of the Attach logic command:
The Glb.Length built-in segment attribute is set to the untruncated length of the result, ignoring trailing spaces.
If the result qualifier is not sufficiently long to receive the result, it is truncated. If truncation occurs, it is set to the truncated value and the Glb.Length built-in segment attribute is set to the untruncated length, but no error message is given.
If a national string value is input to a national string-primitive variable, the value is moved character-by-character, and truncated to the length of the variable.
If a national string value is input to a string-primitive variable, the value is moved byte-by-byte, and truncated to the length of the variable. This truncation might occur after the first byte of a double-byte character, resulting in an invalid character.
Restrictions
The following restrictions apply to the use of the Attach logic command:
In Developer, there is no practical limit to the size you can define a variable. It is generated successfully, however at runtime in Windows if the internal buffer is limited to 2000 bytes, it will not perform correctly.
For MCP-based systems, the maximum length of an item created with the Attach and AttachAndSpace logic commands is 32000 characters (or 16000 Kanji characters).
Note: For an MCP-based system, where numeric attributes containing separators are used with the Attach or AttachAndSpace commands, the effective length of the attribute includes separators. For example, a numeric data item with length 5 and a comma separator can have an effective length of 6, with an included leading zero.
Example
This example uses two result variables, Surname of length 10, and Firstname of length 20.
Surname := "Williams" Firstname := "Henry" Attach Surname Firstname : Sets Firstname to "HenryWilliams", Glb.Length to 13. Attach "Henry" Surname : Sets Surname to "WilliamsHe", Glb.Length to 13. : Glb.Length is 13, even though the actual length : of Surname is 10, because truncation has occurred.