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

Is it possible to use macro substitution in cobol?


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

New User


Joined: 18 Jan 2006
Posts: 11

PostPosted: Tue Jun 12, 2007 7:03 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 12, 2007 8:20 am
Reply with quote

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
View user's profile Send private message
obner

New User


Joined: 18 Jan 2006
Posts: 11

PostPosted: Tue Jun 12, 2007 9:03 am
Reply with quote

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
View user's profile Send private message
shanudarling
Warnings : 1

New User


Joined: 20 Dec 2006
Posts: 55
Location: noida

PostPosted: Tue Jun 12, 2007 9:20 am
Reply with quote

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
View user's profile Send private message
obner

New User


Joined: 18 Jan 2006
Posts: 11

PostPosted: Tue Jun 12, 2007 10:19 am
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Tue Jun 12, 2007 10:41 am
Reply with quote

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
View user's profile Send private message
obner

New User


Joined: 18 Jan 2006
Posts: 11

PostPosted: Tue Jun 12, 2007 12:17 pm
Reply with quote

Hi All,

Thanks! I do appreciate your comments and suggestions.

Regards,
obner
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 12, 2007 5:14 pm
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue Jun 12, 2007 5:22 pm
Reply with quote

I think he wants indirection. Try FoxPro - a great language.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top