> Is there a pipe stage I can use to calculate the square root of a value?
>
> I wrote a stage that reads a stream of numbers, and I'd like to calculate
> the Std deviation.  For the last part I need to take the square root of a
> sum.

Sure, you can do that (we're talking z/VM 6.4 here)

 pipe literal 123 | spec a:w1 - set #0:=a print sqrt(#0) pic zz9.999 1 | cons

But I would let CMS Pipelines do the heavy lifting:

 pipe literal 1.1 1.2 1.3 1.25                    /* Sample data    */
     | split
     | spec printonly eof a:w1 - eof              /* Only do totals */
            print average(a) pic zzzz9.999 1
            print stddev(a) pic zzzz9.999 nw
     | cons

Happy Plumbing,
Sir Rob the Plumber

Reply via email to