Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replace Command in COBOL COPY statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pankajayee

New User


Joined: 20 Sep 2005
Posts: 26

PostPosted: Tue May 29, 2007 7:27 pm    Post subject: Replace Command in COBOL COPY statement
Reply with quote

Hi,

Please anyone help us answering my question regarding the below replace command used in COBOL.

Command is: COPY COPYBOOKNAME REPLACING VALUE-A BY VALUE-B

Que: Should the level at which Value-A and Value-B are defined be same?[/b]
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue May 29, 2007 7:40 pm    Post subject:
Reply with quote

If I understand your question, they do not need to be.
If you posted an example of your question, it might make things clearer.
Back to top
View user's profile Send private message
pankajayee

New User


Joined: 20 Sep 2005
Posts: 26

PostPosted: Wed May 30, 2007 12:23 pm    Post subject:
Reply with quote

Hi,

Thanks for the reply. Please see the example below:

01 VALUE-A
05 VALUE-B
88 VALUE-C .......
88 VALUE-D .......
88 VALUE-E ........
05 ........................
05 ........................

I want to replace the VALUE-D with the values defined in the working storage. As VALUE-D is at 88 level, how can we define the value in working storage.

Could you please provide me the brief explanation on the solution.
Pankaj.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Wed May 30, 2007 12:32 pm    Post subject:
Reply with quote

Pankaj,
It is still not clear. Please make your example more clear.
Back to top
View user's profile Send private message
kussu
Warnings : 1

New User


Joined: 16 May 2007
Posts: 33
Location: India

PostPosted: Wed May 30, 2007 9:26 pm    Post subject:
Reply with quote

As per my understanding, you are asking "can we able to repalce the values of the variables which are declared at different levels" isn't it?

i think it is possible, but not with 88, 66, 77 levels

Thanks
Kussu
Back to top
View user's profile Send private message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Sat Jun 02, 2007 10:09 pm    Post subject: Re: Replace Command in COBOL COPY statement
Reply with quote

I dont think it is not possible.

It is possible for all the levels. What ever present in the copy book with matching charecter that will be replace.

05 :A:-SEARCH-PARMS.
10 :A:-SEARCH-AGENCY OCCURS 300 TIMES
INDEXED BY :A:-AGT-NDX.
15 :A:-SEARCH-OCCURS OCCURS 200 TIMES
INDEXED BY :A:-PS-NDX.
20 :A:-SEARCH-POL-NUMBER.
25 :A:-SEARCH-SYM PIC X(03).
88 :A:-CHECK VALUE '111'.

COPY PW760C REPLACING ==:A:== BY == LK ==.

It will replace all the :A: to LK. there is no constraint for replacing.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Jun 02, 2007 10:43 pm    Post subject:
Reply with quote

This is a bit of example from the Enterprise Programming Guide chapter about "Producing XML output, Example: enhancing XML output".
If this is a line in a copybook:
Code:
15 CDR-LIFE-BASE-TOT-VALUE-LINE.
   20 CDR-LIFE-BASE-TOT-VALUE PIC X(15).
This copy replacing
Code:
   ==CDR-LIFE-BASE-TOT-VALUE-LINE. 20== by ====
   ==CDR-LIFE-BASE-TOT-VALUE== by ==TotalValue==.
Will generate this
Code:
15 TotalValue PIC X(15).
I am suprised that the first line with the trailing "20" works (maybe I should test it.....)....

From what I have seen, you can replace just about anything (except the reserved work COPY), try reading a little about the COPY statement.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Jun 03, 2007 1:47 am    Post subject:
Reply with quote

Hello,

Please clarify this
Quote:
I want to replace the VALUE-D with the values defined in the working storage


Do you want to replace 88-level values at run-time with values that were not known when the program was compiled? If that is what you want, you need to implement in a different way.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Jun 03, 2007 2:01 am    Post subject:
Reply with quote

Geez, if he meant at run-time, no way.
I'd hope he can tell the difference between compile-time and run-time..... icon_rolleyes.gif
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us