Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

selecting few fields from copybook

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: selecting few fields from copybook
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    Post subject: Re: selecting few fields from copybook
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    Post subject: Re: selecting few fields from copybook
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    Post subject: Re: selecting few fields from copybook
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: 1452
Location: Chicago, IL

PostPosted: Wed Sep 06, 2006 10:50 am    Post subject: Re: selecting few fields from copybook
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    Post subject: Re: selecting few fields from copybook
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    Post subject: Re: selecting few fields from copybook
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    Post subject: Re: selecting few fields from copybook
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
No new posts Geneartion of COBOL copybook structre... murugan_mf COBOL Programming 3 Fri May 20, 2016 12:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us