On Tue, 28 Nov 2006 15:32:08 -0600, Patrick O'Keefe 
<[EMAIL PROTECTED]> wrote:

>On Tue, 28 Nov 2006 08:08:04 -0600, Tom Marchant <m42tom-
>[EMAIL PROTECTED]> wrote:
>
>>
>>Second, the number of cases where multiple decisions need to be made
>>based upon a single one character variable are rare.
>
>That's a red herring.  The TR simply screens out those comparisons
>already doomed to failure, and points to they list keys to compare -
>those starting with the matched character.  It's obviously best if
>there is only one.
>

Not a red herring at all.  Again I'll quote from John's original post:

On Tue, 28 Nov 2006 13:12:00 +0000, john gilmore wrote:

>
>declare c1 character(1) ;
>. . .
>select(c1) ;
>  when('a') . . . ;
>  when('b', 'c', 'd') . . . ;
>  when('x') . . . ;
>  when('n') . . . ;
>  otherwise . . . ;
>end ;
>
>It is sometimes implemented [very] badly, but it can be implemented using a
>TR instruction and 256-byte table in such a way that
>
>'a' ==> 00000001b = 1
>'b', 'c', 'd' ==> 00000010b = 2
>'x' ==> 00000011b = 3
>'n' ==> 00000100b = 4
>
>and all other single-character/byte values are translated to 00000000b = 0.
>Translated values can then be multiplied/shifted appropriately to yield
>multiples of 4 [or 8] for use in a classical branch table.  Moreover, the
>same code can be reused [with different TR and  branch tables] in all such
>situations.

John was clearly talking about using a single one character variable to 
make multiple decisions.

-- 
Tom Marchant

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to