On Fri, 12 Oct 2018 10:33:54 +0800, David Crayford wrote:
>>
>>> That code looks dodgy!  Unless I'm losing my marbles the test 
>  ((APPID <> 'VI01') | (APPID <> 'VI02')) will always be true.
>
>I've found in REXX it's better to use something like:
>if wordpos(appid, "VI01 VI02") = 0 then ...
>
>instead of complicated boolean expressions.
> 
o That closely reflects the casual English convention.

o But some will want to consider the probably poorer performance of a
  function call/return compared to inline tests.

o Note that the original does numeric comparisions if some of the operands
  are numeric (not in this case); WORDPOS does string comparisons.  It may
  not matter; the original coder was probably unaware.  But there's a cliché
  of astonishment among these lists when Rexx takes an intended hex
  constant as a floating point number.

o The WORDPOS technique presumes that no operand consists of
  multiple words.  Know your data.

o Some might prefer \((APPID == 'VI01') | (APPID == 'VI02')),
  even as the common English factors out the "not" rather than
  distributing it.

-- gil

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

Reply via email to