Skip to main content

Problem:

How do I do string manipulation in Cobol?

Resolution:

To move selected characters from one alphanumeric field to another, try using reference modification.

For example, to get the 2nd through 4th characters of a PIC X(5) field into a PIC X(3) use the following:

MOVE FIELD1(2:3) TO FIELD2.

If FIELD1 contained 'ABCDE', this statement would put BCD in FIELD2.

    

Old KB# 6116