View previous topic :: View next topic
|
Author |
Message |
pankajayee
New User
Joined: 20 Sep 2005 Posts: 26
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
pankajayee
New User
Joined: 20 Sep 2005 Posts: 26
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Pankaj,
It is still not clear. Please make your example more clear. |
|
Back to top |
|
|
kussu Warnings : 1 New User
Joined: 16 May 2007 Posts: 33 Location: India
|
|
|
|
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 |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Geez, if he meant at run-time, no way.
I'd hope he can tell the difference between compile-time and run-time..... |
|
Back to top |
|
|
|