title: How do I use ROW_NUMBER in DB2 10 on z/OS?
body: <p>I am running a SQL query and trying to break the results down into chunks.  </p>
  
  <pre><code>select task_id, owner_cnum
      from (select row_number() over(order by owner_cnum, task_id)
          as this_row, wdpt.vtasks.*
              from wdpt.vtasks)
                  where this_row between 1 and 5;
  </code></pre>
  
  <p>That SQL works with DB2 10.5 on Windows and Linux, but fails on DB2 10.1 on z/OS with the following error messages:</p>
  
  <p>When I run the SQL from IBM DataStudio 4.1.1 running on my Windows machine connected to the database, I am getting:</p>
  
  <pre><code>ILLEGAL SYMBOL "&lt;EMPTY&gt;". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: CORRELATION NAME. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.18.60  
  </code></pre>
  
  <p>When I run my Java program on a zLinux system connecting to the database, I get the following error:</p>
  
  <pre><code>DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=&lt;EMPTY&gt;;CORRELATION NAME, DRIVER=3.65.97
  </code></pre>
  
  <p>Any ideas what I'm doing wrong?</p>