View previous topic :: View next topic
|
Author |
Message |
nag Warnings : 1 New User
Joined: 29 Jul 2005 Posts: 20
|
|
|
|
I have a copybook with 100 fields which are declared.
This copy book is used in lot of programs so I can't change the copybook as per my requirements and also I am not allowed to create new copybook with my fields.
I have to use existing copy book where my fields are declared and other fields are also present.
My question is I want to use the same copy book for my fields(20
) so how can I suppress the other fields? |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Why would you want to suppress the other fields? The copybook is documentation of what the record looks like. Declare the copybook and reference the fields your program needs. To alter the copybook is bad programming practice.
Dave |
|
Back to top |
|
|
sunil.sunkari Warnings : 2 New User
Joined: 06 Sep 2006 Posts: 5
|
|
|
|
one more way is to declare Working storage fileds to redefine the copybook which is already existing in the system. These redfefined variables can be used later on in the program. |
|
Back to top |
|
|
nag Warnings : 1 New User
Joined: 29 Jul 2005 Posts: 20
|
|
|
|
sunil.sunkari wrote: |
one more way is to declare Working storage fileds to redefine the copybook which is already existing in the system. These redfefined variables can be used later on in the program. |
HI sunil, can u expalin me indetail with an example? |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Did you even notice what Dave said... Even though you are redefining... How is that going to help...
Best way is to use the variables which are intended... you can not modify copybooks like that... that defeats the aim for creating copybook... |
|
Back to top |
|
|
surya_pathaus
Active User
Joined: 28 Aug 2006 Posts: 110
|
|
|
|
Hi all,
I am also with the same issue. My issue is I am not authorized to modify existing copybook but I need to use the same copybook for my fields.
But my output length is not equal to the copybook size. That is the reason I want to remove the other fields logically but not physically.
I can declare all the fields in the program directly without using copybook, but as per our standards we should use copybook.
I have seen copy option in COBOL. That replaces the prefix and suffix of the field. But I dont know how to remove the fields logically.
I dont know whether it is possible or not? but any way I have seen the same issue in the forum and I thought this is the option to know the possibilities. |
|
Back to top |
|
|
balasarathi
New User
Joined: 07 Sep 2006 Posts: 1
|
|
|
|
Hello Surya,
Lets assume your copybook holds the following structure.
01 FILE-REC.
03 FILE-DATA-01 PIC X(10).
03 FILE-DATA-02 PIC X(10).
03 FILE-DATA-03 PIC X(10).
03 FILE-DATA-04 PIC X(10).
03 FILE-DATA-05 PIC X(10).
Your requirement is to use the same copybook. Howerver you wanted to use new fields by supressing the existing fields.
In this case let us assume, you will not require the the fields
FILE-DATA-02 & FILE-DATA-03
The solution can also be,
Add a new working storage record structure.
01 WS-FILE-REC.
03 FILLER PIC X(10).
03 WS-FILE-DATA-02 PIC X(10).
03 WS-FILE-DATA-03 PIC X(10).
03 FILLER PIC X(20).
Hope this will solve your problem. |
|
Back to top |
|
|
rocksolid
New User
Joined: 29 Aug 2006 Posts: 21 Location: India
|
|
|
|
Hi,
There is no need of creating record structure again in WS. As Priyesh and Dave said, declare the copy book in program and use whatever fields you required.
Thanks,
RS |
|
Back to top |
|
|
|