View previous topic :: View next topic
|
Author |
Message |
siva2 Warnings : 1 New User
Joined: 10 Feb 2006 Posts: 7
|
|
|
|
hii ..
can u please tell about COPY BOOK ..
what is it use ..
where it residue..
all stuff regd copy book.. |
|
Back to top |
|
|
Nirmala
New User
Joined: 13 Feb 2006 Posts: 3
|
|
|
|
Hi,
I guess u r very new to Mianframe.. copy book generally contains date fileds or procedure code which can be used in more than one program in common. And whereever we require the same data fields or code just we will specify the copy book as
COPY < copy book name >
If u will observe after compilation the given copy book will expand and we can those fields or code as if it is declared in the currently used program itself..
Best regards
Nirmala |
|
Back to top |
|
|
Nirmala
New User
Joined: 13 Feb 2006 Posts: 3
|
|
|
|
Morover when we declare fields in the copy book (EMPTABL) like below
01 EMP-TABLE;
03 EMP-NAME; PIC X(10).
03 EMP-CODE; PIC 9(5).
Pls note ; (semi colon), then in the program where u r using this we can rename that fileds by using REPLACE command.
Ex. COPY EMPTABL REPLACING ==;== BY ==-TCS==.
Then that copy bok when it got expanded after compilation in ur program
the fileds wil be defined as
01 EMP-TABLE-TCS
03 EMP-NAME-TCS PIC X(10).
03 EMP-CODE-TCS PIC 9(5).
That is the main advantage also..
without having declared copy book varaible by ending ; (semi colon) also we can REPLACE by using the coomands like
Copy Book Name: EMPTABL
01 EMP-TABLE
03 EMP-NAME PIC X(10).
03 EMP-CODE PIC 9(5).
COPY Example REPLACING LEADING ==EMP== BY ==TCS-EMP==.
But all the compliers doesn't support this option.
Cheers
Nirmala |
|
Back to top |
|
|
harshavmr Currently Banned New User
Joined: 10 Jun 2005 Posts: 3 Location: Hyderabad
|
|
|
|
Do we have to compile the copy books? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Copybooks are inserted into your program during compilation. Actually, it's one of the compiler's functions - insert copybooks into the source. After that, there is no 'copybook', you have just your full source. Take a look at the listing of the compiler.
O. |
|
Back to top |
|
|
smiley Warnings : 1 New User
Joined: 08 Feb 2006 Posts: 27
|
|
|
|
Apart from variables and datanames we can use copybook for code which are being used in many programs. |
|
Back to top |
|
|
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
harshavmr wrote: |
Do we have to compile the copy books? |
In most of the big applications , there are large no. of programs
and maximum of them use a particular record structures and routines such as date validation routines are generally used by several programs.In such cases its important to ensure that each program has the same file description, record structure or code. And maintaining several copies of the same thing leads to errors and also time consuming.
Each time you modify one copy , you also modify all tha other copies. So to avoid all these we use COPYBOOK. The COPY statement inserts the copybook from the copylibrary into the source program during compilation. Your Compiler option "LIB" should be in effect. |
|
Back to top |
|
|
Mane Sagar
New User
Joined: 12 Jul 2005 Posts: 41 Location: mumbai
|
|
|
|
Hi,
Copybooks are like defining the variables we wanna use in the pgm in copies tha are copied to the program duriing compilation.. Copybooks are generally used when there are large number of variables to be used and are easier to modify.
Regds,
Sagar. |
|
Back to top |
|
|
|