On Mon, 26 Aug 2013 21:27:42 -0500, Joel C. Ewing wrote:

>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.
>        
Actually, it might be needed to avoid premature termination at an
empty record.

OK.  Suppose the OP is 100.00% certain that his data contain no empty
records (is he willing to test for this condition and report it as an error?)
But code snippets have a tendency to be recycled far beyond their
original intended purpose.  Strive for generality, even needless generality.

similarly:
    ...
>>>       if thisword='' then leave
>>>
The "=" operator is a fuzzy comparison.  It will match if thisword contains
any number of blanks and nothing else.  Better to use "==" even if he's
certain that his data contain no blank lines.

So:
    ...
    do t = 1
        if MyArg == '' then leave t
        parse var MyArg  outstem.t ';' MyArg                      
        outstem.t = Left(oustem.t,80)  /* Or should >80 be reported as an 
error?  */ 
        end t
    outstem.0 = t-1 
    Say 'Number of lines written: 'outstem.0 
    "ALLOC DA('"dsnname"') F(Pdsout) OLD REUSE"                           
    "EXECIO" outstem.0 "DISKW Pdsout (STEM outstem. FINIS"        
    "FREE F(Pdsout)"
    Return

This leaves a nonuniformity; a lurking astonishment factor.  If the last
record is empty and not followed by a ";" it will be written unless it is
empty, in which case it will not be written.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to