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

COPY REPLACING - different prefixes


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

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Sat Oct 28, 2006 1:44 am
Reply with quote

Hi all,

I have this copy book which has two different prefixes. How do I replace each prefix with a different string.

This is the copy book.
05 :A03:-POS1.
10 :A03:-PRODUCT PIC X(3).
10 :A03:-CLIENT PIC X(3).

05 :A05:-POS1 REDEFINES :A03:-POS1.
10 :A05:-PRODUCT PIC X(3).
10 :A05:-CLIENT PIC X(3).


Now in cobol I replaced them as below
COPY copybook REPLACING ==:A03:== BY ==NEW==,
==:A05:== BY ==OLD==.

Now this gives me error.

Can someone tell me what's wrong and how exactly I should do this?

Thanks in advance,
Daphne
Back to top
View user's profile Send private message
MFRASHEED

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Sat Oct 28, 2006 2:12 am
Reply with quote

What error message are you getting?

Looks nothing wrong with COPY statement you have it should work if there is a preceding 01 level before copybook declaration.
Back to top
View user's profile Send private message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Sat Oct 28, 2006 3:05 am
Reply with quote

Hi,

Thanks for the reply.
I am getting the following error message.

IGYDS1089-S "REPLACING" was invalid.


Yes I have the 01 level before copy.

Thanks,
Daphne
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat Oct 28, 2006 3:33 am
Reply with quote

Daphne,

worked file for me. What compiler version are you using?

Code:

01  DATA-RECORD-1.                               
    COPY TESTCB1 REPLACING ==:A03:== BY ==NEW==,
         ==:A05:== BY ==OLD==.                   
    05 NEW-POS1.                                 
    10 NEW-PRODUCT PIC X(3).                     
    10 NEW-CLIENT PIC X(3).                     
    05 OLD-POS1 REDEFINES NEW-POS1.             
    10 OLD-PRODUCT PIC X(3).                     
    10 OLD-CLIENT PIC X(3).                     


Dave
Back to top
View user's profile Send private message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Mon Oct 30, 2006 7:55 pm
Reply with quote

Hi,

Fault was mine. I had missed a blank there. It is working fine now.

Thank you guys for your time.

Daphne
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 Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts DB2 Table - Image copy unload IBM Tools 2
Search our Forums:

Back to Top