DROP
v1.1
v2.1

Purpose, Argument, Streams, Usage, Examples, Related

Syntax

            ┌─FIRST─┐  ┌─1───────┐
>>──DROP──┬─┼───────┼──┼─────────┼──┬───────┬─┬──────────────────────────────────────>< 
          │ └─LAST──┘  └─numrecs─┘  ├─BYTES─┤ │
          │                         └─CHARS─┘ │
          └─┬─ALL─┬───────────────────────────┘
            └─*───┘
Purpose

Use the DROP stage to discard one or more records at the beginning or end of its primary input stream. DROP selects the remaining records, copying them to its primary output stream. If its secondary output stream is connected, DROP passes any unselected records to its secondary output stream.

Argument
Streams

Stream
Action
Primary input
DROP reads records from its primary input stream.
Primary output
Any records that are not dropped are copied to the primary output stream.
Secondary output
DROP passes any unselected records to its secondary output stream, if it is connected.

Usage
  1. DROP FIRST does not delay the records. DROP LAST delays numrecs records.

  2. DROP LAST stores the specified number of records in a buffer. For each subsequent input record (if any), DROP LAST writes the record residing longest in the buffer to the primary output stream. Otherwise, it discards the record. The input record is then stored in the buffer, queued on a first-in, first-out basis. When end-of-file is reached on the primary input stream, DROP LAST writes numrecs records from the buffer to the secondary output stream, if it is connected, otherwise it discards the records.

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

  4. DROP FIRST disconnects its secondary output stream before it writes the records to its primary output stream. DROP LAST disconnects its primary output stream before it writes the unselected records to its secondary output stream.

  5. DROP verifies that its secondary input stream is not connected and then begins execution.
Examples
  1. The following pipeline reads the file in.txt and displays on the console only record number 10.

    **** Top of file ****
    Address Rxpipe
    
    'pipe < in.txt',
        '| drop first 9',
        '| take 1',
        '| console'
    
    Exit 0
    **** End of file ****
    
Related

STEM, VARIABLE

History

Version
Date
Action
Description
Pipelines
1.1
??.??.2025
changed
Application-wide rewrite.
2.1
1.0
06.09.2007
created
First version.
1.0