title: If-else statement in DB2/400
body: <p>I am trying to run an SQL that contains  if-else statement in AS400 but it doesn't work. I am creating a View using i Series Navigator in order to run it.</p>
  
  <pre><code>SELECT IF FIELD1 IS NOT NULL THEN 'AAA' ELSE 'BBB' END IF
  FROM LIB.TABLE1
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <pre><code>SQL State: 42601
  Vendor Code: -199
  Message: [SQL0199] Keyword IS not expected. Valid tokens: , FROM INTO. Cause . . 
  </code></pre>
  
  <p>I tried without writing is null but instead </p>
  
  <pre><code>SELECT IF FIELD1 ='' THEN 'AAA' ELSE 'BBB' END IF
      FROM LIB.TABLE1
  </code></pre>
  
  <p>then I get the following error:</p>
  
  <pre><code>SQL State: 42601
  Vendor Code: -104
  Message: [SQL0104] Token = was not valid. Valid tokens: , FROM INTO. Cause . . . . . :   A syntax error was detected at token =.  Token = is not a
  </code></pre>