Page 1 of 1

How a copybook is expanded using COBOL compiler

PostPosted: Mon Aug 04, 2008 11:32 am
by smithabg
Hello,

I have been compiling COBOL program in OS390 with by invoking the program "IGYCRCTL". I want to know how this works. The area of particular interest is how it expands the copybooks included in the COBOL programs (COPY statements). In the compiler listing, we can see the expanded copybooks. How the compiler does this? Can you please provide me with the details.

Thanks,
Smitha

Re: How a copybook is expanded using COBOL compiler

PostPosted: Mon Aug 04, 2008 11:54 am
by dick scherrer
Hello Smitha and welceom to the forums,

One of the datasets known to the compile process is known as the "copy lib".

When you specify COPY SOMENAME in cobol code, the content of the SOMENAME member of the copy lib is copied nto the source code at that point.

Re: How a copybook is expanded using COBOL compiler

PostPosted: Tue Aug 05, 2008 11:14 am
by smithabg
Hello Dick,

Thank you for the reply.
Will there be some subroutine or so to copy the content of "SOMENAME" to the source code? If so, can you please provide that.
Else, can I have the code of the compiler which does this part of the compile procedure.
In which language is this part written for the compiler? Can you please help in this regard?

Thanks,
Smitha

Re: How a copybook is expanded using COBOL compiler

PostPosted: Tue Aug 05, 2008 9:49 pm
by dick scherrer
Hello,

Will there be some subroutine or so to copy the content of "SOMENAME" to the source code? If so, can you please provide that.
This is an internal part of the compiler. It is not something you can "work with".

Else, can I have the code of the compiler which does this part of the compile procedure.
In which language is this part written for the compiler? Can you please help in this regard?
Why do you want compiler code? I suspect you are looking for "something" but have not yet clarified what you are looking for. Last i actually looked, the compiler was written in assembler. That was long, long ago. I've heard that there are now pieces written in C and PL/I.

If you explain just what you are trying to find/learn, we may have better suggestions.

Re: How a copybook is expanded using COBOL compiler

PostPosted: Thu Aug 07, 2008 3:27 pm
by smithabg
Hello,

My problem is:
I have an Assembler program (which is part of a tool) which expands the copy statements in a COBOL program. But the current problem with this Assembler program is that it cannot handle nested COPY statements i.e. COPY statement within a copybook is handled incorrectly. We are looking for a solution for this.
The compiler handles this part correctly. So, I am looking for the compiler code.
If I get this code in Assembler, it'll be of great help.
Can you help me in this regard?

Thanks,
Smitha.

Re: How a copybook is expanded using COBOL compiler

PostPosted: Fri Aug 08, 2008 2:40 am
by dick scherrer
Hello,

Can you help me in this regard?
No longer. . . Once upon a time IBM made things like the compiler and operating system components code available on tape/microfiche. I have seen nothing like it for many years.

Depending on how you've approached the task, you are basically looking at a "bill of materials" process (bomp) or "parts explosion" routine that recursively nests down and then steps back up as each lower layer is resolved.

If you explain what your current code does and what is not happening correctly (or abending), someone may have suggestions.