View previous topic :: View next topic
|
Author |
Message |
guruguha
New User
Joined: 02 Apr 2007 Posts: 12 Location: Chennai
|
|
|
|
Hi,
I am coding a program where I have to use the same copybook for both input and output layout.
to avoid ambiguity in variable names I have used the replacing statement .
like
COPY RAPCLODT REPLACING ==RAPCLODT== BY ==RAP-IN==.
The original copybook looks like:
01 RAPCLODT.
05 RAPCLODT-DB-AREA PIC S9(04) COMP.
05 RAPCLODT-DB-RAP PIC X(06).
05 RAPCLODT-ACCT-KEY.
.
.
.
But the replace stament is replacing only the first occurence of the literal.
it looks like
01 RAP-IN.
05 RAPCLODT-DB-AREA PIC S9(04) COMP.
05 RAPCLODT-DB-RAP PIC X(06).
05 RAPCLODT-ACCT-KEY.
.
.
.
Kindly tell me how do i solve this issue.
Reply ASAP.
Thanks in advance,
Karthikeyan. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
ASAP? who do you think you are?
use the group reference as a qualifier. |
|
Back to top |
|
|
guruguha
New User
Joined: 02 Apr 2007 Posts: 12 Location: Chennai
|
|
|
|
Brenholtz,
I just wanted to make the code delivery as soon as possible.
That is why i wanted the reply as soon as possible.
I am not sure if I am wrong to use ASAP.
Then I was not able to make sense in your reply: use the group reference as a qualifier.
Can u explain a bit?
Thanks,
Karthikeyan. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
The REPLACING should work on the whole copybook.
Maybe there is a misplaced letter somewhere...
dbzTHEdinosauer meant to use "RAPCLODT-DB-AREA OF RAP-IN"
That's the group reference qualifier. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
That is why i wanted the reply as soon as possible.
I am not sure if I am wrong to use ASAP. |
ASAP is the right acronym, but You are wrong in using it when asking for free/no charge/not billed/voluntary help
Your urgency is just that... Your urgency, not ours |
|
Back to top |
|
|
k.junaid83
New User
Joined: 19 Apr 2006 Posts: 22 Location: bangalore
|
|
|
|
Hi Karthikeyan,
You would require to change your orignal copy book variables.
For the replacing command to work you would need to prefix and postfix the word u want to replace by :.So your orignal copybook will look like.
01 :RAPCLODT:-RECORD.
05 :RAPCLODT:-DB-AREA PIC S9(04) COMP.
05 :RAPCLODT:-DB-RAP PIC X(06).
05 :RAPCLODT:-ACCT-KEY.
Now your copy statement for Input file will be as follows
COPY RAPCLODT REPLACING ==:RAPCLODT:== BY ==RAPIN==.
And the copy statement for the Output file will be
COPY RAPCLODT REPLACING ==:RAPCLODT:== BY ==RAPOUT==.
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
k.junaid83,
excellent answer. |
|
Back to top |
|
|
guruguha
New User
Joined: 02 Apr 2007 Posts: 12 Location: Chennai
|
|
|
|
JK,
I am sorry the copybook cannot be changed by me. It is from production and I have no authority to change it.
Moreover there are other pgms using the same copybook.
Anyway thanks for the reply.
Karthikeyan. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
As stated in the manual, the 'replacing' only replaces full words.....
As mentioned before, change the 01 level and refer to all the lower levels as 'name of 01level'.... |
|
Back to top |
|
|
|