Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Difference between call by value and call by reference

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
varun kumar

New User


Joined: 20 Oct 2005
Posts: 1

PostPosted: Thu Oct 20, 2005 1:20 pm    Post subject: Difference between call by value and call by reference
Reply with quote

what is the difference between call by value and call by reference.
Back to top
View user's profile Send private message

sairam

New User


Joined: 30 Aug 2005
Posts: 58
Location: Kolkata

PostPosted: Thu Oct 20, 2005 1:40 pm    Post subject:
Reply with quote

Hi Varun

Call by value means the values will be passed in the calling function.The called function uses this values.The original variable doesnot change.It's value remain unchanged.

Ex
main function {
.
int a,b;
.
Call fun(a,b)
.
.


}

fun(int c,int d)
{

c=c+1;d=d+1;

}

here the changes of value will not be reflected in the variable passed as
parameter in calling function in main.

In case of call by reference the address of variable is passed,so change in the called function will be reflected in called function.

Hi if any doubt please let me know,i explained it shortly
Back to top
View user's profile Send private message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Fri Oct 21, 2005 11:33 am    Post subject: Re: Difference between call by value and call by reference
Reply with quote

Hi Varun


This question has been answered so mny times.
Plz do search in the forum before ask questions.

Answer for ur question is

Parameters can be passed either by reference or conten(value).
If a paremeter is passed by reference both the called and calling program share the same storage space, so if any changes in the formal parameters (Called pgm parameters) will reflect in the actual paramers (calling pgm).

If a parameter is passed by content , calling and called do not share the same storage, so any changes in the called pgm will not reflect in the calling pgm . This is the difference.

Call by reference is default.

If you knw C language , thr is a concept called pointer which uses addressing. (means call by reference)

Corrections are welcome.


Karthi G.
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 Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts StreamWeaver language reference chetanambi Compuware & Other Tools 1 Wed Jul 05, 2017 12:50 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Need help in triggering a PL1 module ... Varungv99 IMS DB/DC 0 Fri Apr 07, 2017 10:01 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us