Source Text Manipulation

Source text manipulation allows you to include text from one or more COBOL source libraries in your program. COBOL source libraries are collections of source text that programmers can use in many different programs, reducing effort and promoting consistency between programs. Any suitable source text editor can be used to create the source text.

You use the COPY statement to include source text from a library in your program. The effect of the COPY statement is to insert text into the compilation group, where it is treated by the COBOL system as part of the compilation group. All occurrences of a given literal, identifier, word or group of words in the library text can be replaced with alternative text during the copy process.

ANS85 Source text manipulation also allows you to replace source text in your program. You use the REPLACE statement to replace source text. The effect of the REPLACE statement is to replace source text in your program by new text supplied in the REPLACE statement; the COBOL system treats the new text as part of the compilation group.