DEC DATATRIEVE allows you to join value expressions to form a
concatenated expression. You can use a concatenated expression
anywhere the syntax of a DEC DATATRIEVE statement allows a
character string literal. When DEC DATATRIEVE concatenates
value expressions, it converts their values to character string
literals.
DEC DATATRIEVE provides three types of concatenated expressions:
o value-expression | value-expression
o value-expression || value-expression
o value-expression ||| value expression
In each case, DEC DATATRIEVE converts the values of each value
expression to a character string literal and joins the literals
to form a longer literal. The differences among the three forms
of concatenated expression lie in the way they treat trailing
spaces of the first literal, and whether they add any spaces
between the literals:
o A single bar leaves the literals as they are. For example:
"ABC"|"DEF" "ABC "|"DEF" "ABC"|" DEF" "ABC "|" DEF"
ABCDEF ABC DEF ABC DEF ABC DEF
o A double bar suppresses trailing spaces of the first literal
and does nothing to the leading spaces of the second literal.
For example:
"ABC"||"DEF" "ABC "||"DEF" "ABC"||" DEF" "ABC "||" DEF"
ABCDEF ABCDEF ABC DEF ABC DEF
o A triple bar suppresses trailing spaces of the first literal,
inserts one space, and does nothing to the leading spaces of
the second literal. For example:
"ABC"|||"DEF" "ABC "|||"DEF" "ABC"|||" DEF" "ABC "|||" DEF"
ABC DEF ABC DEF ABC DEF ABC DEF
You can use concatenated expressions for assigning values to
lengthy fields or variables. Concatenated expressions provide
the only method for assigning values to fields or variables whose
lengths exceed 255 characters. The following example combines
the T edit string, *.prompt value expressions, and character
string literals to assign a value to a long variable. You can use
similar assignment statements in the USING clauses of the STORE
and MODIFY statements:
DTR> DECLARE STR PIC X(300) EDIT_STRING IS T(50).
DTR> STR = *.L1|*.L2|*.L3|*.L4|*.L5
Enter L1: This string contains the first part of a long character
Enter L2: string. This string is so long that you can't use just
Enter L3: one character string literal to assign a value to it.
Enter L4: You need concatenated expressions to increase the length
Enter L5: of this string beyond the limit of 255 characters.
DTR> PRINT STR
STR
This string contains the first part of a long
character string. This string is so long that you
can't use just one character string literal to
assign a value to it. You need concatenated
expressions to increase the length of this string
beyond the limit of 255 characters.
DTR>