title: How to calculate maximum length of VARCHAR type in DB2?
body: <p>According to <a href="http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2z10.doc.intro/src/tpc/db2z_stringdatatypes.htm" rel="nofollow">this</a>: </p>
  
  <blockquote>
    <p>VARCHAR(n)    Varying-length character strings with a maximum length of
    n bytes. n must be greater than 0 and less than a <strong>number that depends
    on the page size of the table space</strong>. The maximum length is 32704.</p>
  </blockquote>
  
  <p>If I correctly understand this definition, maximum length can be anything less then 32704, according to the configuration of database.</p>
  
  <p>I wonder, how to calculate the <em>current</em> maximum length of VARCHAR type for a <em>specific</em> DB2-database using SQL commands? </p>
  
  <p>Please note: the solution must include automatic determination of page size; this value can not be a parameter of suggested code. </p>
  
  <p>Thanks in advance!</p>