Problem:
Using statements like:
COPY copyname REPLACING LEADING ==ABC== BY ==DEF==.
or
COPY copyname REPLACING TRAILING ==ABC== BY ==DEF==.
with the default Compiler options returns the compilation error:
"COBCH0776S Partial word replacement"
Resolution:
You get this compiler error in COPY REPLACING LEADING and COPY REPLACING TRAILING statements when using the default COBOL dialect which is VS COBOL II.
The reason for this is that the "LEADING" and "TRAILING" clauses of COPY...REPLACING were only introduced in the COBOL language in ISO2002. VS COBOL II is earlier than that (ANS'85).
When you use the LEADING or TRAILING clauses, it is called a "Partial word replacement", there the reason of the error message text. (See COBOL Language manual, Part 2: Program Definition, Compiler-directing Statements, Source Text Manipulation, COPY Statement).
To get your program to compile, select, or at the Project Build Settings or at the Program Build Settings, COBOL tab / General Tab, and change the COBOL dialect to Enterprise COBOL for z/OS. Enterprise COBOL supports the ISO2002.
#MFDS
#EnterpriseDeveloper




