If there are two copybooks which have same variables and we
are using both the copybooks in our program. will there be
an error and if i move values to the variable which copybook
varibales gets the values i move in.

Answers were Sorted based on User's Feedback



If there are two copybooks which have same variables and we are using both the copybooks in our pro..

Answer / lu

you write like this :
01 Copybook1.
02 ADDRESS pic x(03).
01 Copybook2.
02 ADDRESS pic x(03).

move 'AAA' to ADDRESS OF copybook1
move 'BBB' to Address OF copybook2

never forget the 'OF'

Is This Answer Correct ?    17 Yes 1 No

If there are two copybooks which have same variables and we are using both the copybooks in our pro..

Answer / arpan

Or we can use replace option with the copybook in the COBOl
PGM.

For e.g..
Copy Copybook1.
Copy Copybook2 replacing ADDRESS with ADDRESS1.

Correct me if I am wrong.

Is This Answer Correct ?    9 Yes 2 No

If there are two copybooks which have same variables and we are using both the copybooks in our pro..

Answer / jagan

There won't be any error if we have similar variables in
different copybooks and use them in a same program. One
thing i would like to ensure here is before using a copybook
variable in a program , you will need to mention the name of
the copybook followed by the variable...
eg., there are 2 copybooks. RESIDENT and OFFICE and both
of them have the variable ADDRESS in it .


(i) RESIDENT
(ii) OFFICE

We need to refer them in the program by


RESIDENT-ADDRESS and OFFICE-ADDRESS.

In case any data is to be moved to these fields then you can
do it by below stmts.

MOVE PERM-ADD TO RESIDENT-ADDRESS
MOVE TEMP-ADD TO OFFICE-ADDRESS

Hence there shouldn't be any problem in referring to similar
fields in different copybooks .

Is This Answer Correct ?    10 Yes 6 No

Post New Answer

More COBOL Interview Questions

i want a program using by if, evaluate , string, unstring, perform, occurs?

1 Answers  


What are ISOLATION LEVELS? Where do we need to specify them?

3 Answers   EXL,


What are 77 levels used for?

0 Answers  


What is a scope terminator give example?

0 Answers  


Can we dynamically increase the size of occurs clause? i.e In case I an not sure of the size of array and want to increase the size at run time.If yes , how?

1 Answers  






Can anyone please give the example of Inline Perform.

6 Answers   TCS,


what happens of we dont give time stamp in precompilation process

2 Answers  


In EBCDIC, how would the number 1234 be stored?

2 Answers   TCS,


When and how can we use index & subscript ?

2 Answers  


maximum of how many screens we can open in emulator

2 Answers  


Why we need to use redefine clause when we can define the variable seperately... what is actual need....

5 Answers   Accenture,


What is the difference between next sentence and continue in cobol programing language?

0 Answers  


Categories