I don't know how directly related this is to your situation, but I was 
SELECTing stream 1 (which would unknowingly fail because secondary was not 
connected) and the OUTPUT after the SELECT would succeed, but actually write to 
the primary output instead.  So I had to do a STREAMSTATE to not do the write 
at all.

   /*...Determine if secondary output stream is defined/connected...*/ 
   TRACE  'O' 
   'STREAMstate OUTPUT 1'; IF (rc<0) | (rc>8) THEN o1=0;  ELSE o1=1 
   TRACE  'N'  
/* SAY '@0182 o1='o1      */   
 
   DO nobs = 0 BY 1                         /* Do until EOF      */
      'READTO record'                       /* Read from pipe    */
      IF (rc /= 0) THEN LEAVE     
      IF (...decision logic goes here...) 
      THEN DO    
         'SELECT OUTPUT 0'   /* write accepts, assume always connected */
         'OUTPUT' record 
         END 
      ELSE 
      IF (o1) THEN DO        /* Write rejects only if secondary conn */
         'SELECT OUTPUT 1'
         'OUTPUT' record  
         END  
            
      END 


-----Original Message-----
>From: Glenn Knickerbocker <[email protected]>
>Sent: Apr 16, 2010 10:11 AM
>To: [email protected]
>Subject: Re: [CMS-PIPELINES] Coding a user-written pipeline to understand NOT
>
>On Fri, 16 Apr 2010 08:51:26 -0500, Mark Wheeler wrote:
>>signal on error                                                             
>>                                                                            
>>do forever                                                                  
>>   'PEEKTO input_record'            /* Peek at the input record        */   
>>   if input_record = test_value then /* Simplistic */                         
>>                
>>      do                                                                    
>>         'SELECT OUTPUT 0'; 'OUTPUT' input_record     
>
>You're killing the stage as soon as you see a nonzero return code, but
>you've never tested whether the primary output is connected, so it dies
>as soon as you write to it.  You can do just the same as you did for the
>alternate, testing with STREAMSTATE at the beginning and writing to it
>only if it was initially connected.
>
>¬R // Failing is not just for failures, it's \\ users.bestweb.net/~notr
>for everyone.  Failures just have more experience.  \\  iamlistener.com

Reply via email to