In COBOL an alternative solution is available for reference modification. In reference modification, you need to give position and length to get required length. I found one disadvantage with this usage.
MOVE MY_FIELD(2:1) TO NEW_FIELD.
Let us assume,
MY_FIELD X(20)In the above move, you are moving ‘B’ value. With 88 level only you will know the field name, but with reference modification it is hard to know.
The break-up of MY_FIELD is as follows.
Alternative solutionUse redefines in your Copy book and 88 Level fields that you want to use in your program. Define these in your COBOL copy book.
05 ORG_FIELD X(20).Then, directly you can use those fields in your program. This question was asked in COBOL screening test. So I am sharing with you.
05 MY_FIELD REDEFINES ORG_FIELD.
88 A X(01).
88 B X(01).
88 C X(18).
MOVE B TO NEW_FIELD.