FROMLABEL stage v1.2

Pipelines v2.1

 

Purpose, Operands, Streams, Usage, Examples, Related

Home

 

Syntax

 

                                   ┌─STRing──┐
>>───FROMLABel─────────────────┼─────────┼─────────────────────────────────────><
    └─FRLABel───  CASEI(...)─  REGexp──  └─string─┘
                   └─ZONE(...)──┘  └─PATtern─┘

 

Purpose

 

Use the FROMLABEL stage to select records from its 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. Once the record that begins with the target string is found, the record that begins with the target string and the following records are written to the primary output stream.

 

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, FROMLABEL writes the records that are before the record that begins with the target string to its secondary output stream. If the secondary output stream is not connected, FROMLABEL discards these records.

 

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, FROMLABEL writes any leading null records to its secondary output stream, if it is connected. FROMLABEL then writes all its remaining input records to its primary output stream.

 

Streams

 

The following streams are used by the FROMLABEL stage:

 

Stream

 

Action

 

 

Primary input stream

FROMLABEL reads records from its primary input stream.

Primary output stream

FROMLABEL copies the first input record that begins with the specified target string and all the remaining input stream records to its primary output stream.

Secondary output stream

If its secondary output stream is connected, FROMLABEL copies all input records up to but not including the first record matching the specified target string to its secondary output stream. FROMLABEL copies the remaining records that do not match the specified target string to its primary output stream

 

Usage

 

1.

FROMLABEL does not delay the records.

 

2.

If the FROMLABEL stage discovers that all of its output streams are not connected, the FROMLABEL 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.

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

 

Examples

 

1.

The following pipeline selects only those records starting at, and including, the target string all.

 
   **** Top of file ****
 1 Address Rxpipe
 2
 3 'pipe literal /Now is the time for all good men/',
 4    '| split',
 5    '| fromlabel /all/',
 6    '| console'
 7
 8 Exit 0
   **** End of file ****
 
output:
all
good
men
 

2.

Removing a block of records

 

This example pipeline uses the FROMLABEL stage twice in order to isolate and remove a block of records from its input.

 

3.

Sorting a paragraph

 

This example pipeline shows how the FROMLABEL and TOLABEL stages, used in combination; isolate a selection of records which are then sorted and fed back in to the main pipeline stream.

 

Related

 

CASEI, DROP, TAKE, TOLABEL, ZONE

 

History

 

Version

 

Date

Action

Description

Pipelines

1.2

??.??.2025

changed

Application-wide rewrite.

2.1

1.1

04.02.2012

added

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

2.0

1.0

06.09.2007

created

First version.

1.0