REPLACING in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Sunita R
New Member
Posts: 9
Joined: Mon Jan 19, 2015 10:39 pm

REPLACING in COBOL.

Post by Sunita R »

Hi,

How to understand this syntax
Copy AAAAAAAA REPLACING ==:BBBBBBBB:== BY ==:CCCCCCCC:==
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: REPLACING in COBOL.

Post 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.
Sunita R
New Member
Posts: 9
Joined: Mon Jan 19, 2015 10:39 pm

Re: REPLACING in COBOL.

Post by Sunita R »

Does it need to be SYSLIB member always?

And what is SYSLIB?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: REPLACING in COBOL.

Post 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).
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”