Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What is Copy book

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
siva2
Warnings : 1

New User


Joined: 10 Feb 2006
Posts: 7

PostPosted: Mon Feb 13, 2006 3:36 pm    Post subject: What is Copy book
Reply with quote

hii ..

can u please tell about COPY BOOK ..

what is it use ..

where it residue..
all stuff regd copy book..
Back to top
View user's profile Send private message

Nirmala

New User


Joined: 13 Feb 2006
Posts: 3

PostPosted: Mon Feb 13, 2006 3:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Nirmala

New User


Joined: 13 Feb 2006
Posts: 3

PostPosted: Mon Feb 13, 2006 4:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
harshavmr
Currently Banned

New User


Joined: 10 Jun 2005
Posts: 3
Location: Hyderabad

PostPosted: Thu Feb 16, 2006 11:29 am    Post subject:
Reply with quote

Do we have to compile the copy books?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Feb 16, 2006 12:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
smiley
Warnings : 1

New User


Joined: 08 Feb 2006
Posts: 27

PostPosted: Thu Feb 16, 2006 1:29 pm    Post subject:
Reply with quote

Apart from variables and datanames we can use copybook for code which are being used in many programs.
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Sat Mar 04, 2006 2:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Mane Sagar

New User


Joined: 12 Jul 2005
Posts: 41
Location: mumbai

PostPosted: Sat Mar 04, 2006 4:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us