Locate fields in records

Filter:

LOCATE

Syntax:

LOCATE [ [separator] inputrange] (delimiter) expression

Operands:

separator :: (WORDSEPARATOR | WORDSEP | WS ) (BLANK | SPACE)
inputrange :: Word wordnumberrange | columnrange
wordnumberrange :: start_wordnumber '-' end_wordnumber
columnrange :: start_column '-' end_column (DEFAULT 1-*)
columnrange :: start_column '.' number_of_columns
delimiter :: any character not used in the locate strings
expression :: string | hexstring | Regular_Expression
string :: a string of clear text characters
hexstring :: X||*hex_number
start_column :: integer | 1
end_column :: integer | *
Regular_Expression :: re: PERL_type regexp

Functional Description:

Use the LOCATE stage to select all records containing a specified string or strings determined by an expression. The expression can be a character string or hexadecimal character string.

All records that contain the string or strings determined by the expression are written to the primary output stream in the order found in the input stream.

If the secondary output stream is connected, this filter writes all the records that do not contain the string by the expression to its secondary output stream. If the secondary output stream is not connected, this filter discards these records .

When LOCATE is used to search for a string, uppercase and lowercase representations of the same characters do not match. A match is found only if the data in the input records matches the target string you specify, including blank characters. Blank characters contained in the input stream must match the blank characters specified in the target string.

If a Regular Expression is used then the match will be the result of the regexp match.

HexStrings:
defines a target string of hexadecimal characters, following the X or H, that defines a target string of characters to be located. The X or H can be specified in uppercase or lowercase. You must not specify any spaces in the string. There must be an even number of hexadecimal characters in the string.

FIELDSEPARATOR is not supported.

negative locations on column range is not supported.

Secondary Input/Output:

OUTPUT

Synonyms:

ALL

Usage Notes:

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

| LOCATE 20-* /ABC/ |

The following example will locate all occurences of ABC in record columns 10 through 40 of the record and write the succesfully matched records to the primary output and the not successfully matched records to the secondary output stream.

| a: LOCATE 20-* /ABC/ | ..... a:

The following example will locate all occurences of hexstring x'E2E3E4' in record columns 1 through 50 of the record and write the succesfully matched records to the primary output.

| LOCATE 1.50 /XE2E3E4/ | | LOCATE 1-50 /HE2E3E4/ |

The following example will locate all strings that are encapsulated in brackets, using regular expressions.

| LOCATE 1-* re: <.*> |


JAVA Pipelines

Cullen Programming logo