title: Difference between %scan and %lookup in RPGLE?
body: <p>If I scan     'NDIA' in 'INDIAN' by using %scan(), a value greater than 0 returned. If I do same using %lookup() in an array then 0 is returned. Why?</p>
  
  <p><strong>Program 1</strong></p>
  
  <pre><code>D VAR1            s             10a   inz('INDIAN')    
  D S1              S             10S 0                  
  C     'NDIA'        SCAN      VAR1          S1         
  C     S1            DSPLY                              
   /free                                                 
    *inlr = *on;                                         
   /end-free
  </code></pre>
  
  <p><strong>Program 2</strong></p>
  
  <pre><code>D ARR1            s             10a   DIM(5)       
  D S1              S             10S 0              
  C                   EVAL      ARR1(1) = 'AMERICA'  
  C                   EVAL      ARR1(2) = 'INDIA'    
  C                   EVAL      ARR1(3) = 'CHINA'    
   /free                                             
     S1 = %LOOKUP('NDIA':ARR1);                      
     DSPLY S1;                                       
    *inlr = *on;                                     
   /end-free
  </code></pre>
  
  <p>What is difference in both programs?</p>