Friday, September 4, 2009

The STRING Statement

The STRING Statement
Syntax
Format
STRING {{ identifier-1
literal-1 } ... DELIMITED BY { identifier-2
literal-2 }} ...
INTO identifier-3
[WITH POINTER identifier-4]
[ON OVERFLOW imperative-statement-1]
[NOT ON OVERFLOW imperative-statement-2]
[END-STRING]
Description
The STRING statement is used to concatenate non-numeric items together. Any number of items can be concatenated. Entire or partial strings may be concatenated. To use the entire string, delimit it by size. To use only a portion of a string, delimit it by whatever character indicates the end of the data you want to concatenate.
The POINTER clause can be used to start in a position other than 1. For example, if the POINTER variable has a value of 3, character 1 and 2 of the receiving item will remain unchanged, and the stringing operation will proceed from the third character of the receiving field. As each character is inserted into the receiving field, the value of the POINTER variable will be incremented, so that the POINTER variable may be used to STRING in more values where the previous STRING operation left off.
Only as much of the value in the receiving field will be changed as is necessary to hold the newly assembled string, for example, in the statement
STRING A B DELIMITED BY SIZE INTO C.
If A is a one character string with a value of A and B is a one character string with a value of B and C is a five character string with an original value of CCCCC, after the STRING statement is executed, C will have a value of ABCCC.