Collapsing duplicate record sets

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline reads the file: NYSE-Tick.txt and collapses each set of duplicate 
.* records. The pipeline formats the date and time fields and then selects the data section of
.* each record to determine which records are contiguous duplicates.
 
.* The pipeline illustrates how you can use the UNIQUE stage to operate on input data; selecting
.* a specific input range on which to test for duplicate data.
 
pipe (endchar ?)
     < &installdrive:\&installpath\Examples\Input\NYSE-Tick.txt .* Read input file.
     .* Format the date and time fields.
     | specs 7-8 1 '/' n 5-6 n '/' n 1-4 n 10-11 nw /:/ n 12-13 n /:/ n 14-15 n ws ';' w2-* nw
     .* Format the data columns.
     | specs ws / ;/
             w1-2 1
             w3 nw.5 right
             w4 nw.5 right
             w5 nw.5 right
             w6 nw.5 right
             w7 nw.5 right
     | a: unique count w3-* collapse                  .* Collapse duplicates.
     | b: faninany                                    .* Read from both streams.
     | cons                                           .* Display the result on the console.
     ?
     a:
     | specs /---/ 1 1-* strip nw /duplicate ---/ nw  .* Create the duplicate output message.
     | b: