Skip to Content
0
Nov 04, 2015 at 03:39 AM

Difference between Using and Changing in Subroutines

238 Views

Hi All,

I am using a Subroutine Example in My Program. I know the basic differences between using and changing each pointing to Call by value and Call by reference respectively. I know that using Call by Value in Subroutines won't change change the values in Actual parameters whatever happens to formal parameters. I am using the following code,

DATA : A TYPE I,

B TYPE I,

C TYPE I,

D TYPE I,

E TYPE I,

F TYPE I.

A = 3.

B = 4.

D = 5.

E = 7.

PERFORM ADD USING A B C.

PERFORM ADD USING D E F.

FORM ADD USING P_A TYPE I

P_B TYPE I

P_C TYPE I.

P_C = P_A + P_B.

ENDFORM.


Using this code, as per definition in Call by value whatever changes happen to Formal Parameter (P_C) , Value of Actual Parameter (C or F) shouldn't change. But the values of actual parameters ( C and F ) are changing after 'Perform' statement even if I use that in after 'Using' in Subroutine call.


Kindly help me understand this.


Thanks & Regards,


Jai.