Page 1 of 1
REPLACING in COBOL.
Posted: Wed Apr 19, 2023 10:52 am
by Sunita R
Hi,
How to understand this syntax
Copy AAAAAAAA REPLACING ==:BBBBBBBB:== BY ==:CCCCCCCC:==
Re: REPLACING in COBOL.
Posted: Wed Apr 19, 2023 7:46 pm
by Robert Sample
AAAAAAAA is a member of the copy library, which is the SYSLIB DD statement. When the copy is inserted into the COBOL source code, every occurrence of :BBBBBBBB: will be replaced by :CCCCCCCC: but this does not change the copy library member -- just the inserted text.
Re: REPLACING in COBOL.
Posted: Fri Apr 21, 2023 12:51 am
by Sunita R
Does it need to be SYSLIB member always?
And what is SYSLIB?
Re: REPLACING in COBOL.
Posted: Fri Apr 21, 2023 7:23 am
by Robert Sample
SYSLIB is a special DD statement that is used for copy books in COBOL (although it can be used with the linkage editor / binder as well as other languages). When you code COPY ABCDEFGH in COBOL, the compiler looks in the SYSLIB partitioned data set for a member named ABCDEFGH and inserts the contents of that member into the source to be compiled. This allows different programs (possibly in different applications) to use the same code (for example, to define the layout of a data set).