View previous topic :: View next topic
|
Author |
Message |
obner
New User
Joined: 18 Jan 2006 Posts: 11
|
|
|
|
i have the following codes below...
WORKING STORAGE SECTION...
01 WS-VAR-1 pic x(3).
01 WS-VAR-2 pic x(3).
PROCEDURE DIVISION...
MOVE 'AAA' TO WS-VAR-1
MOVE 'WS-VAR-1' TO WS-VAR-2
Is it possible to get the value of "WS-VAR-1" thru "WS-VAR-2" using macro substitution? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post an example of what you would like to happen. When we see what you want to happe, we may be able to offer suggfestions.
COBOL supports "copybooks" with a "replace" feature, but this may not be what you are looking for. If you look in the COBOL manual linked to from this site, you can check these out. |
|
Back to top |
|
|
obner
New User
Joined: 18 Jan 2006 Posts: 11
|
|
|
|
I want to get the actual value of WS-VAR-1 thru WS-VAR-2... let say
DISPLAY 'output : ' WS-VAR-2.
Correction of Working storage section...
01 WS-VAR-1 pic x(8).
01 WS-VAR-2 pic x(8). |
|
Back to top |
|
|
shanudarling Warnings : 1 New User
Joined: 20 Dec 2006 Posts: 55 Location: noida
|
|
|
|
hi obner,
you wrote...
01 WS-VAR-1 pic x(8).
01 WS-VAR-2 pic x(8).
move 'AAA' to WS-VAR-1.
now you want to get the actual value of WS-VAR-1 thru WS-VAR-2.
move WS-VAR-1 TO WS-VAR-2.
it shows
output:- AAA............... (value of WS-VAR-2)
while you are doing.....
move 'WS-VAR-1' TO WS-VAR-2.
it move a string.
i think you get it.... if not plz do rply...
thanks...... |
|
Back to top |
|
|
obner
New User
Joined: 18 Jan 2006 Posts: 11
|
|
|
|
hi shanudarling,
Thanks for your comments but...
move 'WS-VAR-1' TO WS-VAR-2 is true, I move the variable name 'WS-VAR-1' as string to WS-VAR-2 and I was thinking or asking of any possible way to evaluate WS-VAR-2 to get the value 'AAA'. |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Quote: |
MOVE 'AAA' TO WS-VAR-1
MOVE 'WS-VAR-1' TO WS-VAR-2
|
As you have moved value 'AAA' to WS-VAR-1 it will contain 'AAA' for sure but as you have moved 'WS-VAR-1' to WS-VAR-2, it will contain only the value 'WS-VAR-1' but in no way be refereced as the variable WS-VAR-1. The only way you can get the value stored in a variable from another variable is by using redefines clause, had you redefined WS-VAR-1 with WS-VAR-2 , you would have 'AAA' even in WS-VAR-2. |
|
Back to top |
|
|
obner
New User
Joined: 18 Jan 2006 Posts: 11
|
|
|
|
Hi All,
Thanks! I do appreciate your comments and suggestions.
Regards,
obner |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
So, have you found what you need?
If not and you will do what i requested in the first reply (showing what you have and what you want from it), i suspect ther is a way to get what you want.
Thus far, your question will not be clear for a lot of the people who read this topic. This
Quote: |
asking of any possible way to evaluate WS-VAR-2 to get the value 'AAA'. |
just offers confusion.
There are several ways to get "AAA" to be the value contained in the variable WS-VAR-2.
As mentioned previously, if you'll show the variables that need some kind of action, the valus from wherever they are, and what the result should be we will show you alternatives. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
I think he wants indirection. Try FoxPro - a great language. |
|
Back to top |
|
|
|