Change record field contents

Filter:

CHANGE

Syntax:

CHANGE [columnrange] (delimiter) old_string (delimiter) new_string (delimiter) [repetitor]

Operands:

columnrange :: start_column '-' end_column
columnrange :: start_column '.' number_of_columns
old_string :: textstring | hexstring
new_string :: textstring | hexstring
delimiter :: any character not used in the change strings
textstring :: a string of clear text characters
hexstring :: X||*hex_number
repetitor :: * | (none)
start_column :: integer | *
end_column :: integer | *
hex_number :: 2-digit number comprised of 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F (Capitalized)
Regular_Expression :: re: PERL_type regexp
or RE: PERL_type regexp

Functional Description:

Use the CHANGE stage to replace a string of characters with another string of characters of the same or a different length. CHANGE reads records from its primary input stream, replaces any specified strings that are found within the specified column range, and then writes the records to its primary output stream if it is connected. If the target string does not appear in an input record, CHANGE writes the record unchanged to its primary output stream also.

The repetitor if specified tells the stage to replace all occurences found within the record bounds specified. No repetitor will allow only the first occurence to be changed on any line.

HexStrings:
defines a delimited target string of hexadecimal characters to be changed, following the X or H. The X must be specified in uppercase. You must not specify any spaces or non-hex characters in the string. There must be an even number of hexadecimal characters in the old and new strings. All characters must be in uppercase.

Both the old and new strings must use the same hex formats.

Secondary Input/Output:

OUTPUT

Synonyms:

none

Usage Notes:

The following example will change all occurences of ABC to XYZ in record columns 20 through the end of the record:

| CHANGE 20-* /ABC/XYZ/* |

The following example will change all occurences of ABC to 123 in record columns 10 through 40 of the record and write the succesfully changed records to the primary output and the unsuccessfully changed records to the secondary output stream.

|a: CHANGE 20-* /ABC/123/* | ..... a:

The following examples will change all occurences of hex string x'2021' to x'5341' occuring between columns 1 and 40 of the record.

| CHANGE 1.40 /X2021/X5341/* |

The following examples will change all occurences of hex string x'AAC1' to x'B27F' occuring between columns 1 and 40 of the record.

| CHANGE 1.40 /XAAC1/XB27F/* |

The following pipe segment will change all tabs to spaces occuring between columns 1 and the end of the record.

| CHANGE 1.40 /X09/X20/* |

The following example will locate all strings using regular expression, and change to "JUNKYARD".

| CHANGE 1-* /re: /"JUNKYARD"/ |


JAVA Pipelines

Cullen Programming logo