Some confusing questions of COPYBOOKS
Is it necessary to preserve a copybook after we have compiled the main source file successfully?
Ans. - No, As soon as you compile the main source file, the copybook is no longer required. In fact you may delete the copybook. We preserve the source code in case we might need to modify it or use it in some other RPGLE program.
Is it that we can define variables and prototypes only (D-Specs Only)in a copybook?
Ans. - Absolutely not! You can define any specification in copybooks. However, defining D and C specification is sufficient for all practical purposes.
We should always include a copybook at the TOP after D specification.
Ans. - No, you can define a copybook anywhere in a source multiple no. of times. There's no problem with it. However, you should take care of duplicate definitions.
We can use either of /COPY or /INCLUDE directives to include copybooks in RPGLE program.
Ans. - True!
Nesting copybooks (Copybook in another copybook) is not allowed.
Ans. - You can nest a copybook in another any number of times you are able to. However, you should see that it does not become a circular nesting.
Can we create copybook objects? Can we compile a copybook?
Compiling a copybook is not the purpose of a copybook. Copybooks are just common portions of scripts in separate member. They are not meant to be compiled.
That's all about COPYBOOKS I am aware of. If you have any questions regarding it. Feel free to ask it in the forum. Appreciation as well as criticism is most welcome. Please leave your comment below.
- 1735 reads
