IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

selecting few fields from copybook


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nag
Warnings : 1

New User


Joined: 29 Jul 2005
Posts: 20

PostPosted: Tue Sep 05, 2006 6:00 pm
Reply with quote

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

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Sep 05, 2006 7:48 pm
Reply with quote

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
View user's profile Send private message
sunil.sunkari
Warnings : 2

New User


Joined: 06 Sep 2006
Posts: 5

PostPosted: Wed Sep 06, 2006 8:27 am
Reply with quote

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

New User


Joined: 29 Jul 2005
Posts: 20

PostPosted: Wed Sep 06, 2006 10:04 am
Reply with quote

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

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed Sep 06, 2006 10:50 am
Reply with quote

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

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Thu Sep 07, 2006 10:34 am
Reply with quote

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

New User


Joined: 07 Sep 2006
Posts: 1

PostPosted: Thu Sep 07, 2006 3:01 pm
Reply with quote

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

New User


Joined: 29 Aug 2006
Posts: 21
Location: India

PostPosted: Tue Sep 12, 2006 5:29 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Trying to change copybook in online c... CICS 4
No new posts Help to Filter File Manager Copybook ... DFSORT/ICETOOL 14
No new posts Selecting the max value from a file. DFSORT/ICETOOL 3
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
Search our Forums:

Back to Top