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
 

 

Copybook in Many times in a pgm

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
gigs

New User


Joined: 08 Aug 2005
Posts: 27
Location: USA

PostPosted: Mon Sep 05, 2005 11:41 am    Post subject: Copybook in Many times in a pgm
Reply with quote

Hi All,

Can I place a Copybook(file Lay out ) in two different output file in same cobol pgm. If possible , How?



Regards,
Sumanta
Back to top
View user's profile Send private message

ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Mon Sep 05, 2005 12:57 pm    Post subject: Re: Copybook in Many times in a pgm
Reply with quote

You can use COPY with REPLACING to have the multiple copies of copybook with the same layout in a COBOL program...

For example, write in the FD section in place of file-record as,
COPY EMPLCPBK REPLACING ALL "XX" BY "EMPL".
COPY EMPLCPBK REPLACING ALL "XX" BY "HEAD".

where, EMPLCPBK is the output layout in COBOL program. you can have fields within EMPLCPBK as, XX-ID, XX-NAME, XX-PHONE etc.

And within the program you can use these fields as, EMPL-ID, EMPL-NAME, EMPL-PHONE and HEAD-ID, HEAD-NAME, HEAD_PHONE etc...

Thanks
Kumar.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Sep 05, 2005 10:51 pm    Post subject:
Reply with quote

Sorry Kumar,

You can't replace a prefix (e.g. abc-) the way you show it. That only allows you to replace "words" not "strings" (parts of "words"). A word would be something like PIC or ZEROS; a string, something like XYZ- or OS (the last part of ZEROS).

You must design the original copybook using "separarors", something like :TAG: as the variable you want to REPLACE in the copy stmt. For example a copybook written as:
Code:

01  :TAG-:oh-one-level.
    05  :TAG-:oh-5-level      pic x(003) value all "A".

can be used in a pgm as follows:
Code:

COPY tagcpybk replacing ==:TAG:== by ==FD-==

this produces:
Code:

01  FD-oh-one-level
    05  FD-oh-5-level      pic x(003) value all "A".

and
Code:

COPY tagcpybk replacing ==:TAG:== by ==WS-==

produces:
Code:

01  WS-oh-one-level.
    05  WS-oh-5-level      pic x(003) value all "A".
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Wed Sep 07, 2005 7:23 pm    Post subject: Re: Copybook in Many times in a pgm
Reply with quote

Sorry, I forgot to use the seperators, Thanks:)

To the original poster,
you can use seperators like :TAG: or (TAG)...etc...please correct.
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 Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Geneartion of COBOL copybook structre... murugan_mf COBOL Programming 3 Fri May 20, 2016 12:48 pm
No new posts View Copybook having COPY statement i... nkumar Compuware & Other Tools 6 Mon May 16, 2016 7:28 pm
No new posts OMEGAMON to see In-DB2 times and Wait... Archana89 IBM Tools 4 Fri Mar 04, 2016 11:28 am


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