All about Mainframe DB2 VARCHAR Field

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 fileds while using in COBOL. This can be avoided at DBA level also.Read additional info.

How we can give VARCHAR Column in COBOL:

01 payee-name.
49 L PIC S9(4) COMP-5.
49 D PIC X(150).

While moving values into these fields in COBOL program, need to move length value into length filed ‘L’ and Data value into data field ‘D’.

Handling DB2 VARCHAR filed in COBOL.



Author: Srini

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