And although this change would not be needed for the code to work, for
consistency and to actually use the outstem.0 value as a constraint the
EXECIO should probably be changed to
"EXECIO" outstem.0 "DISKW Pdsout (STEM outstem. FINIS"
That way the code could even be re-executed without having to Drop prior
outstem values each time.
        JC Ewing

On 08/26/2013 08:57 PM, Joel C. Ewing wrote:
> The problem is
> outstem.=0
> which sets an infinite number of instances of outstem.x to the non-null
> value "0" for all "x".   DISKW from a stem variable does not stop based
> on a count in outstem.0, it stops when the first null outstem.n value
> for n=1, 2, ...  is found, which is "never" in this case.  I suspect
> "outstem.0 = 0" is what was intended.  Or if this were in a section of
> code that is repeated, you might need to also do a "Drop outstem." first
> to insure you don't pick up records from a previous usage.
> 
> The parse is clever, but also much more obscure than a simple loop with
> counter and setting outstem.0 to the counter on loop exit.  (I would
> still be inclined to set outstem.0 for tracking purposes even though the
> EXECIO doesn't use it in the code shown)
>    Joel C. Ewing
> 
> On 08/26/2013 01:21 PM, George Shedlock wrote:
>> Gentle Listers;
>>
>> I am trying to write a Rexx routine that takes in 3 arguments. First is DSN, 
>> second is Member name, third is a string of text. The string of text is the 
>> concatenation of lines delimited by a ";". (ex. "line1;line2;line3").
>>
>> This code fails:
>>
>> Write_Member:                                                           
>>   MyDSN = ARG(1)                                                        
>>   MyMember = ARG(2)                                                     
>>   MyArg = ARG(3)                                                        
>>   outstem.=0                                                            
>>   dsnname = MyDSN || '(' || MyMember || ')'                             
>>   Say 'The dsname is: {'dsnname'}'                                      
>>   do forever                                                            
>>       parse var MyArg  thisword ';' MyArg                               
>>       if thisword='' then leave                                         
>>       thisword = Left(thisword,80)                                      
>>       parse value outstem.0+1 thisword with t outstem.t =1 outstem.0 .  
>>       end                                                               
>>   Say 'Number of lines written: 'outstem.0                              
>>   "ALLOC DA('"dsnname"') F(Pdsout) OLD REUSE"                           
>>   "EXECIO * DISKW Pdsout (STEM outstem. FINIS"                          
>>   "FREE F(Pdsout)"                                                      
>>   Return                                                                
>>
>> Failure:
>>
>> The dsname is: :HLQ.TEST(MEM3):                                              
>>  
>> Number of lines written: 3                                                   
>>     
>> ACC20210-A ADDVOL FOR DD=PDSOUT DSN=HLQ.TEST VOL=S92248 POOL=TSOPOOL EXT=16  
>>  
>> ACC20628-A DATA SET IS PARTITIONED                                           
>>     
>> System abend code E37, reason code 00000004.                                 
>>     
>> Abend in host command EXECIO or address environment routine TSO.             
>>     
>> EXECIO error while trying to GET or PUT a record.                            
>>     
>>
>> This code works:
>>
>> Write_Member:                                                              
>>   MyDSN = ARG(1)                                                           
>>   MyMember = ARG(2)                                                        
>>   MyArg = ARG(3)                                                           
>>   outstem.=0                                                               
>>   dsnname = MyDSN || '(' || MyMember || ')'                                
>>   Say 'The dsname is: {'dsnname'}'                                         
>>   "ALLOC FI(PDS) DA('"dsnname"') OLD reuse"                                
>>   do forever                                                               
>>       parse var MyArg  thisword ';' MyArg                                  
>>       if thisword='' then leave                                            
>>       thisword = Left(thisword,80)                                         
>>       parse value outstem.0+1 thisword with t outstem.t =1 outstem.0 .     
>>       PUSH thisword                                                        
>>       "EXECIO 1 DISKW PDS "                                                
>>       end                                                                  
>>   "EXECIO 0 DISKW PDS (FINIS"                                              
>>   Say 'Number of lines written: 'outstem.0                                 
>>   "FREE FI(PDS)"
>>    Return            
>>
>> The objective is to pass a stem for the third argument. 
>>
>> Any suggestions on how to use the Execio with the stem value?
>>
>> Show me the error of my ways.
>>
>> George                                                          
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>>
> 
> 


-- 
Joel C. Ewing,    Bentonville, AR       [email protected] 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to