All about Mainframe DB2 VARCHAR Field

Varchar column in DB2 has significant benefit in DB2. You can save a lot of space and add variable length data. Brief information sharing with you to know what is VARCHAR.

VARCHAR in DB2

VARCHAR(n): Varying-length character strings with a maximum length of n bytes. n must be greater than 0 and less than a number that depends on the page size of the table-space.

  • The maximum length is 32704.
  • Handling additional data in VARCHAR fields while using in COBOL. This can be avoided at DBA level also. Read additional info.

How to use VARCHAR Column in COBOL

01 payee-name.
49 L PIC S9(4) COMP-5.
49 D PIC X(150).
  • In COBOL program you need to move length value into length field L and data value into data field D

Also Read

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.