View previous topic :: View next topic |
Author |
Message |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Wed Apr 11, 2007 4:13 am Post subject: Copybooks with the same 01 level.. |
|
|
Hi,
I have a strange issue in my requirement.
I have two copybooks.
CPYBK1 and CPYBK2.
The fields are defined as follows:
CPYBK1
Code: | 01 SERVICE-AREA.
10 VAR1 PIC X(10).
10 VAR2 PIC X(10). |
CPYBK2
Code: | 01 SERVICE-AREA.
10 VAR1 PIC X(10).
10 VAR2 PIC X(10).
10 VAR3 PIC X(10).
10 VAR4 PIC X(10). |
I need to initialize all the fields in both of the copybooks.
My question is that can we qualify the fields at the member level?
i.e., is MOVE SPACES TO SERVICE-AREA OF CPYBK1 valid?
Please suggest me of how to go about this issue.
Thanks in advance.
Vivek G |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Apr 11, 2007 4:54 am Post subject: |
|
|
Quote: | My question is that can we qualify the fields at the member level? |
member is not a term associated with structures (group items and elementary items). member refers to a Partitioned Dataset, of which your copybook could be a member.
Quote: | i.e., is MOVE SPACES TO SERVICE-AREA OF CPYBK1 valid? |
You can only qualify up-to the 01 level. as far as your COBOL prgm is concerned, it knows nothing of CPYBK1 or 2.
You should not have two structures with the same Reference at the 01 level. chg the 01 references to SERVICE-AREA-1 and -2 or something. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed Apr 11, 2007 4:54 am Post subject: |
|
|
Before coding any MOVE statements, try compiling with those 2 copy books as specified and you will answer your own question. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Wed Apr 11, 2007 4:59 am Post subject: |
|
|
dbzTHEdinosauer, Nic Clouston,
Thanks for your quick responses.
Regards,
Vivek G _________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay) |
|
Back to top |
|
 |
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Wed Apr 11, 2007 6:00 am Post subject: |
|
|
can you not use the COPY REPLACING for the second copybook |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 11, 2007 8:22 am Post subject: |
|
|
Nic Clouston wrote: |
Before coding any MOVE statements, try compiling with those 2 copy books as specified and you will answer your own question. |
The code DOES compile without any problems. It will compile fine as long as you don't refer those items in your procedure division.
Vivek,
As DBZ already mentioned ,COBOl does not have this member concept, once you use the COPy or include statement , it is embedded into the code and everthing is treated as 1 single program. As sreejith pointed out you can replace one of the copy book to make them unique at 01 level.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|