PIPE SPLIT

Syntax

SPLIT
Read syntax diagramSkip visual syntax diagram SPLIT ATAT/ // //char/charcntWITHPFIX/string/0charcntATATAFTERBEFOREANYOFSTRING/ // //string/

Synonyms

Stage Name Synonym
ANYOF ANY
STRING STR

Command Description

SPLIT divides a line of text into multiple lines.
Note: SPLIT acts only on the first line of a multiline message. If all lines are to be split, use SEPARATE prior to SPLIT.

Streams

Stream Type Number Supported
Input 1
Output 1

Termination Conditions

SPLIT terminates when either the input stream and output stream is disconnected.

Operand Descriptions

AFTER
The input line is split just after the specified string or character. Nothing is deleted from the output. The point where the split occurs can be adjusted using charcnt.

See also the BEFORE keyword.

ANYOF
Indicates that the /string/ is a list of characters. Any character contained in the list is a match.

See also the STRING keyword.

AT
The line is split where the specified string or character is found. The matching string or character is deleted from the output.
BEFORE
The line is split just before the specified string or character. Nothing is deleted from the output. The point at which the split occurs can be adjusted using charcnt.

See also the AFTER keyword.

char
A delimited character. SPLIT searches for /char/ and splits the input line at each occurrence. The default value for /char/ is a single blank.

A single character or blank must be enclosed within the delimiters. /char/ cannot be a null string (//).

See also the AT keyword.

charcnt
For the AFTER and BEFORE options, indicates an offset to the split point. For example, if /string/ is specified, the value of /string/ is found first, then the split is made charcnt characters before or after that point. The value of charcnt can be a positive number, negative number, or zero (0). The default value is zero (0). Valid values for charcnt are in the range -10000000 to +10000000.

For the WITHPFIX option, indicates the split point for a line that is longer than charcnt characters. The line is split every charcnt characters, into two or more lines. For a line that is equal to or shorter than charcnt characters, no action is taken.

When charcnt is specified alone with no other parameters or when it is specified with the the WITHPFIX option, the value of charcnt must be a positive number. Valid values are +1 to +10000000.

STRING
Indicates that the /string/ is a single string. A match occurs only when the complete string is found.

See also the ANYOF keyword.

/string/
A delimited character string containing a character list or string.

For the AFTER and BEFORE options, SPLIT searches for /string/ as indicated by the ANYOF or STRING keyword and splits the input line at each occurrence. The default value for /string/ is a single blank.

For the WITHPFIX option, /string/ is required. After the input line is split into two or more lines, the delimited string is appended to the front of each line except the first line.

One or more characters must be enclosed within the delimiters. /String/ cannot be a null string (//).

WITHPFIX
An input line that is longer than charcnt characters is split every charcnt characters into two or more lines. After the first line of output, each line starts with the string that is specified in the required /string/ argument, so that you can easily rejoin the data by using the JOINCONT LEADING stage. Every line before the last line contains exactly charcnt characters from the input data. The output for each single input line is formatted as a multi-line message.
Tip: If you have to edit the lines to pad the output data to a fixed length, use the PIPE SEPARATE stage. To be properly rejoined with the JOINCONT stage, the lines must also be separated.

Example: Splitting at Blanks

The following splits the literal string /HERE IS SOMETHING TO SPLIT/ at each blank:
PIPE LITERAL /HERE IS SOMETHING TO SPLIT./
     | SPLIT
     | CONSOLE
The output displayed on the console is:
HERE
IS
SOMETHING
TO
SPLIT.

Example: Splitting Following a String

The following splits the literal string /BUY IT, YOU'LL SPLIT AND LIKE IT BETTER./ three characters after each occurrence of the string /IT/:
PIPE LITERAL /BUY IT, YOU'LL SPLIT AND LIKE IT BETTER./
     | SPLIT 3 AFTER STRING /IT/
     | CONSOLE
 
The output displayed on the console is:
BUY IT, Y
OU'LL SPLIT AN
D LIKE IT BE
TTER.