I'm pretty new in COBOL programming, and I can't understand why my code doesn't generate what I want; which is changing the value of 'm-poem'.
data division.
working-storage section.
01 m-poem pic A(50) value 'nothing here'.
and using this:
procedure division.
initialize m-poem replacing alphanumeric data by
- "This is the way
- "I chose to take".
display m-poem.
what I get instead is : "nothing here". which is the original value of 'poem' not the replaced one.
(Thank you for my introduction to COBOL.)
The reason this isn't working is because you are attempting to replace alphanumeric data
of a record that only has alphabetic
data within it.
You can resolve this by doing either of the following:
A(50)
must be paired with replacing alphabetic data
; orreplacing alphanumeric data
must be paired with X(50)
.