
Yigal G. answered 04/06/22
Experienced COBOL Language Tutor
COBOL allows for variable length fields similar to SQL VARCHAR using level 49. The following example shows how to define the variable length field. Before using the Data field, the program must update the Length field.
03 varchar1.
49 varchar1-len pic s9(4) comp.
49 varchar1-data pic x(2000).