Sei sulla pagina 1di 2

CONCATENATION & OPEN ID

*CAT/*BCAT/*TCAT
*CAT or || Joins two strings "as is"
*BCAT or |> Joins two strings with a single blank space between
*TCAT or |< Joins two strings trimming first string
'String One ' *CAT 'String Two ' Yields 'String One String Two '
'String One ' *BCAT 'String Two ' Yields 'String One String Two '
'String One ' *TCAT 'String Two ' Yields 'String OneString Two '

Character string expressions


The operands in a character string expression must be quoted or unquoted character strings, character
variables, or the substring (%SUBSTRING or %SST) built-in function.
The value associated with each variable or built-in function must be a character string. The result of
concatenation is a character string.
There are three operators that can be used in character string expressions. These operators concatenate (or
join) two character strings, but each has a slightly different function. They are:
*CAT (concatenation, symbol ||) operator
The *CAT operator concatenates two character strings. For example: ABC *CAT
DEF becomes ABCDEF
Blanks are included in the concatenation. For example: 'ABC ' *CAT 'DEF ' becomes 'ABC
DEF '
*BCAT (concatenation with blank insertion, symbol |>) operator
The *BCAT operator truncates all trailing blanks in the first character string; one blank is inserted,
then the two character strings are concatenated. Leading blanks on the second operand are not
truncated. For example: ABC *BCAT DEF becomes ABC DEF 'ABC ' *BCAT
DEF becomes'ABC DEF'
*TCAT (concatenation with trailing blank truncation, symbol |<) operator
The *TCAT operator truncates all trailing blanks in the first character string, then the two character
strings are concatenated. All leading blanks on the second operand are not truncated. For
example: ABC *TCAT DEF becomes ABCDEF 'ABC ' *TCAT DEF becomes 'ABCDEF' ABC
*TCAT ' DEF' becomes 'ABC DEF' 'ABC '*TCAT ' DEF' becomes 'ABC DEF'

All blanks that surround the concatenation operator are ignored, but at least one blank must be on
each side of the reserved value operator (*CAT, *BCAT, or *TCAT). If multiple blanks are
wanted in the expression, a quoted character string (a character string enclosed within
apostrophes) must be used.
FROM THE DESK OF N.K.ELURU

Page 1

CONCATENATION & OPEN ID


OPNID in DCLF

DCLF

Open id is an identifier for any opened file in the CL program.

FILE(AMIT/ACCOUNT) OPNID(ID1)

QUALIFIED FILE NAME - AMIT/ACCOUNT


RECORD FORMAT NAME - REC1

When we compile the program, we can see in the spool file that the
fields get pre-fixed with the ID name. Hence, each files that we
declare in CL is recognized by the unique open-id.

FROM THE DESK OF N.K.ELURU

Page 2

Potrebbero piacerti anche