The Varchar column in DB2 has significant benefits 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 Field in COBOL
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