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

Copy statement for both input and output layout


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

New User


Joined: 02 Apr 2007
Posts: 12
Location: Chennai

PostPosted: Thu Feb 28, 2008 12:54 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Feb 28, 2008 1:21 pm
Reply with quote

ASAP? who do you think you are?

use the group reference as a qualifier.
Back to top
View user's profile Send private message
guruguha

New User


Joined: 02 Apr 2007
Posts: 12
Location: Chennai

PostPosted: Thu Feb 28, 2008 1:29 pm
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Feb 28, 2008 4:10 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Feb 28, 2008 4:21 pm
Reply with quote

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
View user's profile Send private message
k.junaid83

New User


Joined: 19 Apr 2006
Posts: 22
Location: bangalore

PostPosted: Thu Feb 28, 2008 4:28 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Feb 28, 2008 5:00 pm
Reply with quote

k.junaid83,

excellent answer.
Back to top
View user's profile Send private message
guruguha

New User


Joined: 02 Apr 2007
Posts: 12
Location: Chennai

PostPosted: Thu Feb 28, 2008 5:15 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Feb 28, 2008 8:22 pm
Reply with quote

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
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts force tablespace using LISTDEF input DB2 1
Search our Forums:

Back to Top