Copybook is a bunch of source code statements.
Lets take an example:
I have around 100 programs which are doing addition for two numbers.
Now in this scenario I can write logic of adding two numbers but instead of writing same code in alll programs I can create a member and put the code for adding two numbers into it and just copy that member into the programs where I want to implement this logic.
The source of this copy book can be seen into the spool file of the program in which you ha ve included it.
let me know if you stilll need any more explanation.
A /COPY member is a source member that contains a set of source statements that you expect to use over and over in many programs. Instead of having the same source in each of those programs, you have a single source line with a /COPY directive. The compiler then inserts the statements from the /COPY member in place of the /COPY directive.
If you need to change the statements at a future time, you only change the one source member. When you recompile all of the programs, the new source is automatically “copied” into the source that is compiled.
In earlier versions of languages, you might copy data definitions or standard subroutines. Now, with ILE, /COPY members are best suited for data structures or prototype definitions. Use prototyped procedures instead of subroutines. The only time prototype /COPY members would change would be if you had to change the parameters for the prototype.