[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

647.0. "String comparison with 8-bit characters" by TAV02::GALIA (Galia Reznik, Israel Software Support) Mon May 26 1997 11:24

    Hi,
    
    Our customer found out a strange behaviour of the following command:
    
    $ IF "�" .LTS. " " THEN ......
    
    where "�" is 8-bit character, ASCII 224 and " " is a space, ASCII 32.
    The result is true, and the 'THEN' part is executed.
    
    The documentation states, that the comparison criteria are the ASCII
    values of the characters. It seems, that characters with ASCII code
    between 128 and 255 are refferenced as negative numbers.
    	
    Is it a 'bug' or a 'feature'?
    
    Thanks,
    Galia Reznik,
    MCS, Israel.
T.RTitleUserPersonal
Name
DateLines
647.1AUSS::GARSONDECcharity Program OfficeMon May 26 1997 22:045
    re .0
    
    Looks buggy. IPMT and HOPE.
    
    I tested VAX VMS V6.2 and Alpha VMS V6.2 and they both behave this way.
647.2TAV02::GALIAGalia Reznik, Israel Software SupportTue May 27 1997 02:385
    Hi,
    
    It goes all the way up to V7.1 .
    
    Galia.
647.3not ASCIICOMEUP::SIMMONDSloose canonTue May 27 1997 03:268
    Re: .0
    
    But codes with values > 127 are not in the ASCII character set!
    If a workaround is acceptable, try f$cvui(0,8,ch0) .LT. f$cvui(0,8,ch1)
    for example..
    
    Fwiw,
    John.
647.4TLE::REAGANAll of this chaos makes perfect senseTue May 27 1997 10:394
    Exactly what "ASCII" are you talking about?  I've assumed that DCL
    strings conform to ISO Latin-1.
    
    				-John
647.5IPMTXDELTA::HOFFMANSteve, OpenVMS EngineeringTue May 27 1997 11:3710
   Use the NCS or multinational comparison routines and a program image,
   if possible.

   DCL and other low-level and/or older OpenVMS components are not designed
   for eight-bit (or Unicode) operations.  We are in the process of adding
   some Unicode support for an upcoming OpenVMS release, but I do not know
   if this includes enhancements to DCL.

   You can try that IPMT...
647.6QUARK::LIONELFree advice is worth every centTue May 27 1997 12:057
This makes no sense to me.  VMS has been supporting the "DEC Multinational
Character Set" for just about its entire life.  The character compare 
instruction on VAX (and I would hope the equivalent Alpha code) properly
handles comparisons of 8-bit characters using an unsigned comparison.  This
sounds like an outright bug to me.

				Steve
647.7AUSS::GARSONDECcharity Program OfficeTue May 27 1997 20:1113
    additional to .6
    
    Furthermore the VMS doco explicitly states that DCL strings can contain
    MCS characters. What it doesn't state is what collating sequence is
    used in comparisons. In the absence of any statement one would expect
    direct ordinal value comparison (i.e. no funny language specific rules)
    and with the accompanying text talking about values 0..127 and values
    128..255 one might reasonably expect the non-ASCII part of the MCS to
    compare above the ASCII part.
    
    It is true that DCL (VMS in general) OOTB has never supported other
    character sets fully but vanilla comparison should have the expected
    behaviour.
647.8COMEUP::SIMMONDSloose canonWed May 28 1997 04:5315
    Re: .6
    
    The DCL module involved does indeed use CMPC5, but this instruction has
    never performed strictly unsigned comparison.. both C _and_ N condition
    code are changed so that you can choose the following conditional branch
    appropriately..
    
    The 'bug' seems to be that there is a common path after integer and
    string compares which only does a signed test.. (a previous instance of
    this reply blamed D. N. CUTLER, but there's evidence that his original
    intentions have been altered somewhat..)
    
    (Alpha V7.1: module EXPRESS.MAR, listing line 1501)
    
    John.
647.9TAV02::GALIAGalia Reznik, Israel Software SupportThu May 29 1997 04:4811
    Hi,
    
    It seems to me, that a common sense expectation for an unsigned 
    comparison in this case is much stronger than the definition of what
    is ASCII and what not in DEC Multonational Character Set. 
    From .8 it is clear, that I should QAR it.
    
    Thanks to you all for your comments.
    
    Galia Reznik,
    MCS, Israel.