View previous topic :: View next topic
|
Author |
Message |
sivakrishnaballa
New User
Joined: 24 Jan 2007 Posts: 1 Location: chennai
|
|
|
|
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 |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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 |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
niks,
You are replying to year old (nearly) topic. If you have something to ask, why dont you start new topic? |
|
Back to top |
|
|
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|