Beginning in Visual COBOL V7.0 support for dynamic length data-items has been added to the COBOL language.
You can specify a data item as follows where the limit phrase is optional and defines the maximum size of the data-item.
01 my-field pic x dynamic length limit is 15.
The length of this field will change dynamically depending on it's current contents.
Example:
move "larger value" to my-field
display length of my-field
move "small" to my-field
display length of my-field
move space to my-field
display length of my-field
move "12345678901234567" to my-field
display length of my-field
The lengths that will be displayed are:
12
5
1
15
Please see the full documentation here
#SupportTips/SupportTips/KnowledgeDocs
#dynamiclength
#limitis
#VisualCOBOL
#SupportTips/KnowledgeDocs
#COBOL
#HowTo-BestPractice
#VisualCOBOL