Call by reference : - address of the parameters will be passed to the sub-program. Changes to the parameter in the called program affect the corresponding argument in the calling program. Default is call by reference
Call by value:
-only the copy of the contents will be passed to the sub-program.The called program cannot change the value of this parameter as referenced in the CALL statement's USING phrase.
This is default in cobol no need to specify the call by value. The changes to the variable in the called program in reflected back in the calling program.
Call by content:
This should be specified along with call and here the content of the variable is passed to the called program but the changes in the called programwill not be relected in the calling program.
Call by Value: In call by value both the actual and dummy parameters will occupy different memory space. so the changes made in the subprog will not affect(/modify) the actual parameters in the main prog.
Call by ref: In call by reference both the actual and dummy parameters will occupy the same memory location. so the changes made in the subprog will modify the actual parameters in the main program.
What is the difference between the 'call by value' and 'call by reference'?