View previous topic :: View next topic
|
Author |
Message |
muppanenidilip Warnings : 1 New User
Joined: 06 Jun 2007 Posts: 5 Location: Bangalore
|
|
|
|
I have a question regarding COBOL sub programs.
I have a working-storage variable of main program say WS-VAR1 which is also used in the sub program. So can I change that variable in the sub program say WS-VAR2?
Dilip. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Yes and no. For a more precise answer please provide more information..... |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
Do you want to change the variable name or the content of the variable.
Changing variable name
if u want to change the variable name you can change, but there must be one-one mapping in linkage section of main program and sub program.
It doesnot depends on working-storage variable, because WS variables are local to main and subprogram.
Changing content of variable in subprogram
You can go for
Code: |
CALL 'SUBPROGRSM' using BY REFFERENCE LN-VAR1 |
and then you can hange the content of variable in SUBPROGRAM it reflects in MAINPROGRAM too. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
dilip,
Quote: |
I have a working-storage variable of main program say WS-VAR1 which is also used in the sub program. So can I change that variable in the sub program say WS-VAR2? |
As CICS Guy pointed out, please explain your requirement.
What actually is WS-VAR2? shd it not be WS-VAR1 as you have said that you uise same workinig storage in both the programs. |
|
Back to top |
|
|
muppanenidilip Warnings : 1 New User
Joined: 06 Jun 2007 Posts: 5 Location: Bangalore
|
|
|
|
when we use " call by content " & "call by reference"
can any body help me? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
muppanenidilip wrote: |
when we use " call by content " & "call by reference" |
This would have been a lot quicker if you had started with this question...
With the BY REFERENCE phrase, yes....
With the BY CONTENT phrase, no....
And with the BY VALUE phrase, I'll leave that for you to decide....Please post back your answer. |
|
Back to top |
|
|
|