OUTSIDE stage v1.1

Pipelines v2.0

 

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

Home

 

Syntax

 

                              _STRing__                _STRing__
>>__OUTSIDE__ ____________ __|_________|__fromstring__|_________|__ _tostring_ ________>< 
             |_CASEI(...)_|  |_REGexp__|              |_REGexp__|  |_numrecs__|
             |_ZONE(...)__|  |_PATtern_|              |_PATtern_|
                             |_ANYof___|              |_ANYof___|

 

Purpose

 

Use the OUTSIDE stage to select groups of records from its primary input stream, starting with records preceding the first record that begins with fromstring. OUTSIDE writes a group of records to its primary output stream ending a group with the record following the record containing tostring, or with all remaining records once the specified number of records that won’t be selected is reached. Each group of records is written in the order found in the input stream. Both fromstring and tostring must begin in the first column of an input record.

 

Unless the CASEI or ZONE pre-process option specifies a different column range, each specified target string must begin in the first column of an input record. If the secondary output stream is connected, OUTSIDE writes the records that are not selected to its secondary output stream. These include the records beginning with fromstring and either all the records up to and including the record containing tostring or the record corresponding to the number specified. If the secondary output stream is not connected, OUTSIDE discards the records that are not selected.

 

Operands

 

    

CASEI

perform a non-case-sensitive comparison between the target strings 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. A null string matches a null input record.

 

    

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.

 

    

ANYof

specifies that the string operand is a list of characters; any of which are to be located.

 

 

fromstring

tostring

are the starting string to locate fromstring and the ending string to locate tostring, respectively.

 

If tostring is specified and it consists of only decimal numbers (0-9), you cannot specify a number as the delimiting character.

You cannot use a B, b, H, h, X or x for a delimiting character.

 

    

numrecs

is an unsigned integer which specifies the number of records to be written to the secondary output stream, starting with and including the record that begins with fromstring. OUTSIDE writes numrecs records each time fromstring is located. numrecs cannot be less than 2. If the number of records remaining in the input stream is less than numrecs, the remaining records are written to the secondary output stream.

 

Streams used

 

The following streams are used by the OUTSIDE stage:

 

Stream

Action

 

 

Primary input stream

OUTSIDE reads records from its primary input stream.

Primary output stream

OUTSIDE writes selected input records that are not located between records with the specified target strings to its primary output stream.

Secondary output stream

If its secondary output stream is connected, OUTSIDE writes all input records not selected to its secondary output stream.

 

Usage notes

 

     1)

OUTSIDE does not delay the records.

 

     2)

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

 

     3)

If tostring is specified and it consists of only decimal numbers (0-9), you cannot specify a number as the delimiting character. For example:

 

outside /a/ /7/

 

is not equivalent to

 

outside 1a1 171

 

The first OUTSIDE stage selects records not between records beginning with the targets a and 7. The second stage selects records that precede a record that begins with a, and writes all remaining records once 171 unselected records is reached. That is, 171 is processed as the number of records that won’t be selected as numrecs rather than as a delimited string.

 

     4)

If the input stream does not contain a record that begins with the ending target string tostring, OUTSIDE writes all the records in its input stream to its primary output stream, starting with the records preceding the first record that contains fromstring. For example, after issuing the following pipe command:

 

**** Top of file ****
01 Address Rxpipe
02
03 ‘pipe < abc.txt’,
04    ‘| outside /ccc/ /rrr/’,
05    ‘| console
06
07 Exit 0
**** End of file ****

 

the contents of the primary input stream (which is the data from the file abc.txt), the primary output stream, and the secondary output stream are:   

 

 

     5)

If multiple sets of the target strings are found, OUTSIDE will complete the first group before writing the second group. For example, if you specify the starting and ending target strings and a second occurrence of fromstring is found before tostring, OUTSIDE writes the records preceding the first record that begins with fromstring and all records succeeding the first record that begins with tostring to its primary output stream. This does not include the second record that begins with fromstring. OUTSIDE writes this record and the other unselected records to its secondary output stream. For example, after issuing the following pipe command:

 

**** Top of file ****
01 Address Rxpipe
02
03 ‘pipe < abc.txt’,
04    ‘| outside /aaa/ /ccc/’,
05    ‘| console’
06
07 Exit 0
**** End of file ****

 

the contents of the primary input stream (which is the data from the file abc.txt), the primary output stream, and the secondary output stream are:

 

 

Similarly, if you specify fromstring and numrecs and a second occurrence of fromstring is found within the selected group of records, OUTSIDE writes numrecs records starting with the record that begins with fromstring to its secondary output stream, if it is connected. OUTSIDE writes the remaining records, including the record that begins with the starting target fromstring to its primary output stream. For example, after issuing the following pipe command:

 

**** Top of file ****
01 Address Rxpipe
02
03 ‘pipe < abc.txt’,
04    ‘| outside /aaa/ 4’,
05    ‘| console’
06
07 Exit 0
**** End of file ****
 

the contents of the primary input stream (which is the data from the file abc.txt), the primary output stream, and the secondary output stream are:

 

 

     6)

If you specify the ZONE pre-process option of the OUTSIDE stage, each 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.

 

     7)

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

 

Examples

 

See: Usage notes, above.

 

See also

 

Reference the following links for additional information:

 

BETWEEN, CASEI, FROMLABEL, INSIDE, TOLABEL, 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.