changing-records-between-labels.rex

Pipelines v2.1

 

.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...

Home

     **** Top of file ****
   1
   2 /* The following pipeline reads the file: stock.xml and changes the pricing entries in the
   3    XYZ stock_quote section to zero. The price_type values are set to zero without altering their
   4    precision. The BETWEEN stage ensures that only the records in the XYZ section are selected
   5    and changed. */
   6
   7 Address Rxpipe
   8
   9 'pipe (endchar @)',
  10      '< &installdrive:\&installpath\examples\input\stock.xml',
  11      '| f: between casei( zone w1-* )',               /* Select records in the.. */
  12           '\<symbol>xyz</symbol>\ \</stock_quote>\',  /* ..XYZ quote section. */
  13      '| b: locate anycase /<price type=/',            /* Select pricing records. */
  14      '| xlate ws /=/ w3 1-9 0',                       /* Translate the price to zero. */
  15      '| c: faninany',                                 /* Read from any stream. */
  16      '| cons',                                        /* Display on the console. */
  17      '@',
  18      'f:',                                            /* Unselected records from Between. */
  19      '| take *',                                      /* Select all records. */
  20      '| c:',                                          /* Route back to Faninany stage. */
  21      '@',
  22      'b:',                                            /* Unselected records from Locate. */
  23      '| take *',                                      /* Select all records. */
  24      '| c:',                                          /* Route back to Faninany stage. */
  25
  26 Say 'Hit Enter to close..'
  27 Parse Pull
  28
  29 Exit 0
     **** End of file ****
 

Console output

 
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
   1 <stock_quotes>
   2
   3    <stock_quote>
   4       <symbol>XYZ</symbol>
   5       <date>12/16/1999</date>
   6       <time>4:40PM</time>
   7       <price type="ask" value="000.000"/>
   8       <price type="open" value="000"/>
   9       <price type="high" value="000.0"/>
  10       <price type="low" value="0"/>
  11       <change>+2.1875</change>
  12       <volume>7050200</volume>
  13    </stock_quote>
  14
  15    <stock_quote>
  16       <symbol>ABC</symbol>
  17       <date>12/16/1999</date>
  18       <time>4:01PM</time>
  19       <price type="ask" value="113.6875"/>
  20       <price type="open" value="109.25"/>
  21       <price type="high" value="115"/>
  22       <price type="low" value="108.9375"/>
  23       <change>+5.25</change>
  24       <volume>64282200</volume>
  25    </stock_quote>
  26
  27    ...
  28
  29 </stock_quotes>
  30
  31
  32 Hit Enter to close..