Actually, neither your version nor my altered one gives correct results. It 
also requires adding a "select second" to my earlier update. get the correct 
answer:                                                     
  

 '| spec select second nowrite a: 1-8 1 b: 10-* . set #0+=b break a print #0 10 
write . set #0:=0'  
      
                                                                                
                                                                               
Regards, 
Richard Schuh 

 

> -----Original Message-----
> From: CMSTSO Pipelines Discussion List 
> [mailto:[email protected]] On Behalf Of Glenn Knickerbocker
> Sent: Tuesday, October 12, 2010 10:04 PM
> To: [email protected]
> Subject: Re: Summing fields in a record
> 
> On Tue, 12 Oct 2010 16:38:12 -0700, Richard Schuh wrote:
> >Is there any good pipe solution for transforming these records to 
> >"Header sum" where sum is the total of all of the fn fields
> 
> I'd use CHOP|SPLIT|JUXTAPOSE to break each field out into its 
> own record, then SPECS to add them up, something like:
> 
>   (end /) ...
>     | header: chop n
>     | field: juxtapose
>     | specs nowrite a: 1-n 1 b: N-* . set #0+=b break a print 
> #0 N write
>     | ...
>     / header:
>     | split
>     | field:
> 
> (where N = n+1).
> 
> ¬R
> 

Reply via email to