title: IBMDB2 simple query error 901 - system error
body: <p>I'm working on a IBM iseries v6r1m0 system.</p>
  
  <p>I'm trying to execute a very simple query : </p>
  
  <pre><code>select * from XG.ART where DOS = 998 and (DES like 'ALB%' or DESABR like 'ALB%')
  </code></pre>
  
  <p>The columns are: </p>
  
  <pre><code>DOS -&gt; numeric (3,0)
  DES -&gt; Graphic(80) CCSID 1200
  DESABR -&gt; Garphic(25) CCSID 1200
  </code></pre>
  
  <p>I get :</p>
  
  <pre><code>SQL State : 58004
  SQL Code : -901
  Message : [SQL0901] SQL System error. 
  Cause . . . . . :  An SQL system error has occurred. The current SQL statement cannot be completed successfully. The error will not prevent other SQL statements from being processed. Previous messages may indicate that there is a problem with the SQL statement and SQL did not correctly diagnose the error. The previous message identifier was CPF4204. Internal error type 3107 has occurred. If precompiling, processing will not continue beyond this statement.
  Recovery . . . : See the previous messages to determine if there is a problem with the SQL statement. To view the messages, use the DSPJOBLOG command if running interactively, or the WRKJOB command to view the output of a precompile. An application program receiving this return code may attempt further SQL statements. Correct any errors and try the request again.
  </code></pre>
  
  <p>If I change DES into REF (graphic(25)), it works...</p>
  
  <p>EDIT : </p>
  
  <p>I run some tests this afternoon, and it is very strange : </p>
  
  <p>Just after the creation of the table/indexes, I have no errors.</p>
  
  <ul>
  <li>If I insert some datas : error</li>
  <li>If I clear the table : error</li>
  <li>If I remove an index (see below) : it works (with or without datas)
  !!</li>
  </ul>
  
  <p>The index is : </p>
  
  <pre><code>create index XG.GTFAT_ART_B on XG.ART(
  DOS,
  DESABR,
  ART_ID
  )
  </code></pre>
  
  <p>Edit 2 : </p>
  
  <p>Here is the job log (sorry, it is in French...)
  <img src="https://i.stack.imgur.com/QCezw.png" alt="joblog"></p>
  
  <p>It sais :</p>
  
  <pre><code>Function error X'1720' in machine instruction. Internal snapshot ID 01010054
  Foo file created in library QTEMP.
  *** stuff with the printer
  DBOP *** FAILED open. Exception from call to SLIC$
  Internal error in the query processor file
  Sql system error
  </code></pre>