Teknologi

LightBlog

Breaking

LightBlog

Wednesday, 29 August 2012

Relational Operators


  • Comparison between Data Types.
    EQ (or) =
    Equal To
    NE (or) <> (or) ><
    Not Equal To
    LT (or) <
    Less Than
    LE (or) <=
    Less Than or Equal to
    GT (or) >
    Greater Than
    GE (or) >=
    Greater Than or Equal To

    Comparison between Strings.
    CO
    Contains Only
    CN
    Contains Not Only
    CA
    Contains Any
    NA
    Contains Not Any
    CS
    Contains String
    NS
    Contains No String
    CP
    Matches pattern
    NP
    Does not Matches pattern

    The special statements for processing strings, there are special comparisons that you can apply to strings with types C, D, N, and T.  
    There are no conversions with these comparisons. Instead, the system compares the characters of the string.  

    <f1>
    <operator>
    <f2>
    Result
    SY-FDPOS
    'BD '
    CO
    'ABCD '
    true
    5
    'BD '
    CO
    'ABCDE'
    false
    2
    'ABC12'
    CN
    'ABCD '
    true
    3
    'ABABC'
    CN
    'ABCD '
    false
    5
    'ABcde'
    CA
    'Bd '
    true
    1
    'ABcde'
    CA
    'bD '
    false
    5
    'ABAB '
    NA
    'AB '
    false
    0
    'ababa'
    NA
    'AB '
    true
    5
    'ABcde'
    CS
    'bC '
    true
    1
    'ABcde'
    CS
    'ce '
    false
    5
    'ABcde'
    NS
    'bC '
    false
    1
    'ABcde'
    NS
    'ce '
    true
    5
    'ABcde'
    CP
    '*b*'
    true
    1
    'ABcde'
    CP
    '*#b*'
    false
    5
    'ABcde'
    NP
    '*b*'
    false
    1
    'ABcde'
    NP
    '*#b*'
    true
    5


  • Comparing Bit Sequences
    O
    bits are one
    Z
    bits are Zero
    M
    bits are Mixed      
    The above three operators to compare the bit sequence of the first operand with that of the second.
    The second operand must have type X.
    The comparison takes place over the length of the second operand.
    The first operand is not converted to type X.


    Example : 
    REPORT demo_log_expr_bits .
    DATA: text(1) TYPE c VALUE 'C',
          hex(1) TYPE x,
          i TYPE i.

    hex = 0.

    DO 256 TIMES.
      i = hex.
      IF text O hex.
        WRITE: / hex, i.
      ENDIF.
      hex = hex + 1.
    ENDDO.

    The output is as follows: 

    00          0 
    01          1 
    02          2 
    03          3 
    40         64 
    41         65 
    42         66 
    43         67

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Adbox