Changing records between labels

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline reads the file: stock quotes.xml and changes the pricing entries in the
.* XYZ stock_quote section to zero. The price_type values are set to zero without altering their
.* precision. The BETWEEN stage ensures that only the records in the XYZ section are selected
.* and changed.
 
pipe (endchar @ comment //)
     < &installdrive:\&installpath\Examples\Input\stock quotes.xml // Read input file.
     | f: between casei( zone w1-* )                    // Select records in the..
          '<symbol>xyz</symbol>' '</stock_quote>'       // ..XYZ quote section.
     | b: locate anycase /<price type=/                 // Select pricing records.
     | xlate ws /=/ w3 1-9 0                            // Translate the price to zero.
     | c: faninany                                      // Read from any stream.
     | cons                                             // Display on the console.
     @
     f:                                                 // Unslected records from Between.
     | take *                                           // Select all records.
     | c:                                               // Route back to Faninany stage.
     @
     b:                                                 // Unselected records from Locate.
     | take *                                           // Select all records.
     | c:                                               // Route back to Faninany stage.