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
 

 

Is it possible to use macro substitution in cobol?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Is it possible to use macro substitution in cobol?
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

Site Director


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

PostPosted: Tue Jun 12, 2007 8:20 am    Post subject:
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    Post subject:
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    Post subject: Re: Is it possible to use macro substitution in cobol?
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Jun 12, 2007 5:14 pm    Post subject:
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

Active Member


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

PostPosted: Tue Jun 12, 2007 5:22 pm    Post subject:
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    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 RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


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