View previous topic :: View next topic
|
Author |
Message |
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Whether is it possible for me to implement the concept of Call by value and call by reference in COBOL? If yes, explain with an example. |
|
Back to top |
|
|
nitin_agr
New User
Joined: 06 Sep 2005 Posts: 28 Location: Minneapolis US
|
|
|
|
Yes, This is possible in COBOL.
Refer to following....
CALL PGM1 USING parm1
This parm1 can be passed either by value or by reference (address) as follows:
CALL PGM1 USING BY REFERENCE parm1
CALL PGM1 USING BY CONTENT parm1
CALL PGM1 USING BY VALUE parm1
Guys, Do correct if I am wrong at any point...
Nitin |
|
Back to top |
|
|
wattamwar rakeshkumar
New User
Joined: 22 Nov 2007 Posts: 2 Location: pune
|
|
|
|
CALL PGM1 USING BY VALUE parm1
I am doubtfull for this statment.
Even if the meaning off call by value & content is same
call by value is used in c language.
Wheather u have used it(above statement) practically,
Thanx & regards
Rakesh |
|
Back to top |
|
|
ramesh_ibm
New User
Joined: 17 Nov 2007 Posts: 16 Location: banglore
|
|
|
|
Call By Reference is Default means the sub program changes are shared by the main program
Code: |
MOVE '10' TO VAR-1
CALL SUB-PGM-A USING VAR-1
IN SUB-PGM-A MOVE '20' TO VAR-1
COME OUT OF THE SUB-PGM
DISPLAY VAR-1 IN MAIN PROGRAM
VAR-1 = '20' |
Call By Content or Value means the sub program changes are local to the sub program only
The same code above displays VAR-1 = '10' if you
code CALL SUB-PGM-A BY CONTENT USING VAR-1 |
|
Back to top |
|
|
wattamwar rakeshkumar
New User
Joined: 22 Nov 2007 Posts: 2 Location: pune
|
|
|
|
my q is can we code in mainframe Rejion
CALL SUB-PGM-A BY VALUE USING VAR-1
can we use VALUE VERB IN COBOL
IS IT CORRECT AS PER ANSI STANDERD?
THANKS
RAKESH |
|
Back to top |
|
|
kovur
New User
Joined: 15 Nov 2007 Posts: 36 Location: India
|
|
Back to top |
|
|
|