Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copy statement for both input and output layout

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Copy statement for both input and output layout
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: 6970
Location: porcelain throne

PostPosted: Thu Feb 28, 2008 1:21 pm    Post subject:
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    Post subject:
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: 1248
Location: Israel

PostPosted: Thu Feb 28, 2008 4:10 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10360
Location: italy

PostPosted: Thu Feb 28, 2008 4:21 pm    Post subject: Reply to: Copy statement for both input and output layout
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    Post subject:
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: 6970
Location: porcelain throne

PostPosted: Thu Feb 28, 2008 5:00 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu Feb 28, 2008 8:22 pm    Post subject:
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    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 Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us