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

Difference between lrecl, blksize among PS, PDS issues? i.e in jcl at dcb

1 Answers  


how you will define variables length in cobol.

3 Answers   Temenos,


In the JCL, how do you define the files referred to in a subroutine ?

2 Answers  


I have a field with data type X(10). I want to perform arithmetic operation on this field? I tried doing it by moving the value into a numeric field. but it didn't work out. I am getting a S0C7 abend. Pls let me know if there is any way of getting this done?

2 Answers   ADP,


The below is the declaration for a variable ws 01 ws pic 9(3). if you want to insert space how will you do that. in which level u should do it

3 Answers   ADP,


How to convert bunch of words in a line to relvant ASCII values?

2 Answers  


WHAT IS SOC3?HOW IT CAN BE RESOLVED?

1 Answers  


I try to use some column names in my cobol progorm but these column not in db2 table ..when do i get error ..while bind time or runtime?

2 Answers  


How you can characterize tables in cobol?

0 Answers  


how will you define vsam file in select clause?

3 Answers   Patni,


How can we increase the size of an existing PDS to include more no. of modules. I tried the answer posted by Jagan(TSO PDS 'pds name') but did not find it working. The answer posted by kamal i know very well. Please suggest me a answer so that we don't need to delete the existing PDS and still we can change the size as well.

10 Answers  


What does EXIT do ?

3 Answers   Deloitte,


Categories