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

COBOL-Call by value & call by reference


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

Active User


Joined: 22 Aug 2005
Posts: 412
Location: Colarado, US

PostPosted: Thu Sep 08, 2005 3:08 pm
Reply with quote

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

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Fri Sep 09, 2005 12:00 am
Reply with quote

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

New User


Joined: 22 Nov 2007
Posts: 2
Location: pune

PostPosted: Thu Nov 22, 2007 5:05 pm
Reply with quote

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

New User


Joined: 17 Nov 2007
Posts: 16
Location: banglore

PostPosted: Thu Nov 22, 2007 8:05 pm
Reply with quote

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

New User


Joined: 22 Nov 2007
Posts: 2
Location: pune

PostPosted: Fri Nov 23, 2007 10:13 am
Reply with quote

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

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Fri Nov 23, 2007 10:35 am
Reply with quote

Hi,
Refer to the following post.
http://ibmmainframes.com/about5939.html
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 Cobol prog to put an indicator on the... JCL & VSAM 1
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts COBOL program logic for comparisipn o... COBOL Programming 2
No new posts COBOL - create and write to output fi... COBOL Programming 0
No new posts COBOL to JSON COBOL Programming 1
Search our Forums:

Back to Top