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

This is about COPY REPLACING OPTION


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

New User


Joined: 24 Jan 2007
Posts: 1
Location: chennai

PostPosted: Tue Apr 10, 2007 9:55 am
Reply with quote

Hi,

I have a COPYBOOK for input layout whose length in total is 2355. And i have two output files whose layout is same as input .My requirement is that i need to use only single copybook for three of them.Could you please help me how to declare that in the program.

Thanks
Siva
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Apr 10, 2007 10:03 am
Reply with quote

Hi Siva,

Please read forum rules.Do not shout.
Let's take your copybook name as COPYA which is declared as below
Code:
     01  COPYBOOK-A.
           10 COPYA-POLICY         PIC X(11).
           --


Then we can use

Code:
COPY COPYA                               
     REPLACING COPYBOOK-A BY FIRST-FILE.
COPY COPYA                               
     REPLACING COPYBOOK-A BY SECOND-FILE.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Mon Jan 14, 2008 12:35 pm
Reply with quote

But this is not a good option ekta. In the program you would have to use var-1 of first-file to associate variable with first-file and similalrly for second-file. Can't we have a better option than this ?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Jan 14, 2008 12:44 pm
Reply with quote

niks,

You are replying to year old (nearly) topic. If you have something to ask, why dont you start new topic?
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Mon Jan 14, 2008 1:28 pm
Reply with quote

I was just going thru some old topics. I thought why not pick this one as I thought the answer was not very impressive.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 14, 2008 1:34 pm
Reply with quote

niks_jude,
your answer was impressive. It showed what little experience you have.

as far as the OP's question, guptae's answer was very good and is a normal solution for this situation.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jan 15, 2008 12:55 am
Reply with quote

This is a better answer:

Code your copybook variable/condition names with prefixes, e.g.:

02 :PFX-:FILE.
05 :PFX-:FLD1 PIC X.
88 :PFX-:OEF VALUE 'E'.
etc.

In your pgm code:

01 IP-FILE-1.
COPY SAMECBK REPLACING ==:PFX-:== BY ==IP1-==.
01 OP-FILE-1.
COPY SAMECBK REPLACING ==:PFX-:== BY ==OP1-==.
01 OP-FILE-2.
COPY SAMECBK REPLACING ==:PFX-:== BY ==OP2-==.

All the fields in IP-FILE-1 will begin w/IP1-
All the fields in OP-FILE-1 will begin w/OP1-
All the fields in OP-FILE-2 will begin w/OP2-

PS It's been a while so the syntax may not be 100%.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts SCOPE PENDING option -check data DB2 2
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts CICS vs LE: STORAGE option CICS 0
Search our Forums:

Back to Top