CASEI pre-process v1.1

Pipelines v2.1

 

Need examples

 

Purpose, Operands, Streams, Usage, Examples, Related

Home

 

Syntax

 
>>──stage──CASEI(─┬─────────────────┬──┬─────────┬─)──┬──────────┬───────────────────><
                  └─ZONEinputrange  REVerse─┘    └─operands─┘

 

Purpose

 

Use the CASEI pre-process function to alter the input records read by the stage from any of its input streams. The CASEI 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 CASEI 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 CASEI function instructs the manager to; translate both the stage operands and the content of the input records to uppercase, and optionally, extract a substring of the record specified by the inputrange operand and to present this altered record to the stage when a read-record is requested. The CASEI 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 connected input stream and writes them to any connected output stream. A stage that supports the CASEI function does not delay the records.

 

ZONE

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

 

 

inputrange

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

 

REVerse

reverses an input record before it is presented to the stage. If you specify an inputrange operand, only the characters in the specified range are reversed.

 

operands

are the operands required by the specified stage.

 

Streams

 

None.

 

Usage

 

1.

You cannot specify the CASEI 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:

 

   **** Top of file ****
 1 Address Rxpipe
 2
 3 'pipe lit /aBbCc def ghi/',
 4    '| split',
 5    '| between casei( zone 3-* ) x62 /b/',
 6    '| cons'
 7
 8 Exit 0
   **** End of file ****

 

 

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 CASEI function do not delay the records.

 

Examples

 

1.

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

 

   **** Top of file ****
 1 Address Rxpipe
 2
 3 'pipe lit /a-B-c c-b-A/',
 4    '| split',
 5    '| fromlab casei( zone wordsep /-/ w2 ) /b/',
 6    '| cons'
 7
 8 Exit 0
   **** End of file ****
 
output:
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:

 

   **** Top of file ****
 1 Address Rxpipe
 2
 3 'pipe literal /ABCDE FGHIJ/',
 4   '| split',
 5   '| tolabel casei( zone -3;-2 ) /hi/',
 6   '| console'
 7
 8 Exit 0
   **** End of file ****
 
output:
ABCDE
 

Related

 

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

 

History

 

Version

 

Date

Action

Description

Pipelines

1.1

28.12.2021

changed

Application-wide rewrite.

2.1

1.0

06.09.2007

created

First version.

1.0