ZONE Pre-process v1.0

Pipelines v1.9

 

Purpose, Operands, Streams used, Usage notes, Examples, See also

Home

 

Syntax

 

>>__stage__ZONE(_ ____________ __ _______ __ _________ _)__ __________ ________________><
                 |_inputrange_|  |_CASEI_|  |_REVerse_|    |_operands_|

 

Purpose

 

Use the ZONE pre-process function to alter the input records read by the stage from any of its input streams. The ZONE function operates on the input records before they are presented to the stage.

 

There are a number of stages that permit the use of the ZONE function and these are stages that do not perform any translation of their input records. They are purely filter type stages that simply select input records based on some criteria.

 

The ZONE function instructs the manager to extract a substring of the record, determined by the column, word or field range, and optionally; to translate both the stage operands and the content of the input records to uppercase, and present this altered record to the stage when a read-record is requested. The ZONE function does not alter the way in which a stage processes its input and output records, it only alters the format of the record which is presented to the stage. When the stage performs a subsequent write-record request, the manager writes the original unmodified input record to the specified output stream.

 

Operands

 

    

stage

is the name of a stage that reads records from any of its connected input streams and writes records to any of its output streams. A stage that supports the ZONE function does not delay the records.

 

    

inputrange

is an integer column, word or field range on which to operate.

 

    

CASEI

perform a non-case-sensitive selection comparison.

 

    

REVerse

reverses an input record before it is presented to the stage. Only the characters in the specified range are reversed.

 

    

operands

are the operands required by the specified stage.

 

Streams used

 

None.

 

Usage notes

 

    1)

You cannot specify the ZONE pre-process function with a stage that does not support it.

 

    2)

The CASEI function translates input records to uppercase before they are presented to the stage. As such, if the stage searches for a hexadecimal or binary representation of a lowercase character; the stage will not find the character because the input record has already be translated to uppercase, as in the following example:

 

C:\>pipelit /aBbCc def ghi/ | split | between zone( 3-* casei ) x62 /b/ | cons

 

The lowercase b (x’62’) in the literal string is not found because it was translated to an uppercase B before BETWEEN processed its input record.

 

Similarly, if the stage specifies a word or field range with a word or field separator string in hexadecimal or binary format, then the extracted range may not be as expected as the record presented to the stage will have been translated to uppercase.

 

    3)

Stages that allow the use of the ZONE function do not delay the records.

 

Examples

 

    1)

In the following example, the pipeline specifies only word number 2 as the input location.

 

C:\>pipe “lit /a-B-c c-b-A/ | split | fromlab zone( wordsep /-/ w2 casei ) /b/ | cons”
a-B-c
c-b-A

 

    2)

The following pipeline specifies the third-from-last to the second-from-last columns as the input location.

 

C:\>pipe “literal /ABCDE FGHIJ/ | split | tolabel zone( -3;-2 casei ) /hi/ | console”

ABCDE

 

See also

 

Reference the following links for additional information:

 

BETWEEN, CASEI, FROMLABEL, INSIDE, LOCATE, NLOCATE, OUTSIDE, TOLABEL