TOLABEL stage v1.1

Pipelines v2.0

 

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

Home

 

Syntax

 

                              _STRing__
>>__TOLABel__ ____________ __|_________|__ ________ ___________________________________><
             |_CASEI(...)_|  |_REGexp__|  |_string_|
             |_ZONE(...)__|  |_PATtern_|

 

Purpose

 

Use the TOLABEL stage to select records from the primary input stream. The records selected are determined by the string you specify. The specified target string must begin in the first column of an input record. TOLABEL writes to its primary output stream, if connected, the records that are before the record that begins with the target string.

 

Unless the CASEI or ZONE pre-process option specifies a different column range, string must begin in the first column of an input record. If the secondary output stream is connected, the record that begins with the target string and the following records in the primary input stream are written to the secondary output stream. If the secondary output stream is not connected, the TOLABEL stage stops once the record beginning with the target string has been read.

 

Operands

 

    

CASEI

perform a non-case-sensitive comparison between the target string and the input record.

 

    

ZONE

restrict data selection to a specific column, word or field range.

 

    

STRing

specifies that the string operand is a literal string of characters to locate.

 

    

REGexp

specifies that the string operand is a regular expression of characters to locate.

 

    

PATtern

specifies that the string operand is a pattern of characters to locate.

 

    

string

is a string to locate.

 

If string is not specified, TOLABEL writes any leading null records to its primary output stream. TOLABEL then writes all its remaining input records to its secondary output stream, if it is connected.

 

Streams used

 

The following streams are used by the TOLABEL stage:

 

Stream

Action

 

 

Primary input stream

TOLABEL reads records from its primary input stream.

Primary output stream

TOLABEL copies input records that do not begin with the specified target string to its primary output stream until a record is found that begins with the target. The record containing the target is not copied to the primary output stream.

Secondary output stream

If its secondary output stream is connected, TOLABEL copies to its secondary output stream all input records not copied to its primary output stream.

 

Usage notes

 

     1)

TOLABEL does not delay the records.

 

     2)

If the TOLABEL stage discovers that all of its output streams are not connected, the TOLABEL stage ends.

 

     3)

If you specify the ZONE pre-process function, the target string must begin in the first column of the specified column range instead of the first column of the input record. To be selected, the target string must be completely located within the column range; therefore, the length of the target string must be less than or equal to the width of the column range.

 

     4)

If the secondary output stream is not connected, the TOLABEL stage stops once the record beginning with the target string has been read.

 

     5)

TOLABEL verifies that its secondary input stream is not connected and then begins execution.

 

Examples

 

The following pipeline selects only those records up to, but not including the target string all.

 
**** Top of file ****
01 Address Rxpipe
02
03 ‘pipe literal /Now is the time for all good men/’,
04    ‘| split’,
05    ‘| tolabel /all/’,
06    ‘| console
07
08 Exit 0
**** End of file ****
 
Output:
Now
is
the
time
for
 

See also

 

Reference the following links for additional information:

 

CASEI, DROP, FROMLABEL, TAKE, ZONE

 

History of change

 

Version

Action

Description

 

 

 

1.1

Added

Support for the REGEXP operand; which specifies that the string operand is interpreted as a regular expression.