PIPE CHOP
Syntax
Command Description
The CHOP stage truncates lines after a specified column, character, or string.
The data kept by CHOP is passed to the primary output stream. The data discarded by CHOP is passed to the secondary output stream, if connected.
Streams
| Stream Type | Number Supported |
|---|---|
| Input | 1 |
| Output | 2 |
Termination Conditions
CHOP terminates when the input stream or both output streams disconnect.
Operand Descriptions
- AFTER
- Specifies that the offset refers to the number of positions after the end of the matching string or character.
- ANYof
- Specifies that CHOP searches for the first occurrence of any character in /string/.
- BEFORE
- Specifies that the offset refers to the number of positions before the beginning of the matching string or character. This is the default value.
- column
- The column after which truncation is to occur.
- NOT
- Specifies that truncation is relative to the first character or string that does not match the specified target.
- offset
- The truncation column relative to the beginning or end of the matching string or character. This can be a negative value. The default value is zero.
- STRing
- Specifies that CHOP searches for the first exact occurrence of /string/.
- /string/
- A character string enclosed in delimiters.
- width
- The default column. For OST tasks, the screen width is used. For automation tasks and other tasks, zero is used.
Usage Notes
CHOP cannot be the first stage.
Example: Truncating Lines
The following example truncates all
lines after column 44.
PIPE NETV QRYGLOBL COMMON VARS=*
| SEPARATE
| LOCATE /BNH039/
| CHOP 44
| CONS ONLY
---> BNH039I SMFVPD
---> BNH039I CGAUTHID2
---> BNH039I LONGONE
...Example: Truncating Text
The
following example truncates all text from the character before the
first number.
PIPE LITERAL /GOOD STUFF 00001204/
| CHOP 1 BEFORE ANYOF /1234567890/
| CONSOLE
---> GOOD STUFFExample: Isolating Text Within a Line
Coded as a REXX example:
'PIPE NETV necessary command ',
' | SEPARATE',
' | LOCATE 1.7 /IST486I/',
' | CONSOLE',
' | NOT CHOP AFTER STRING /STATUS= /',
' | CHOP BEFORE STRING /,/',
' | VAR state'
SAY 'The value of state is ' state
---> IST486I STATUS= ACTIV , DESIRED STATE= ACTIV
---> The value of state is ACTIV