10-12-2008 2:16 PM
Hi All,
I am using a subroutines like this.
data num1 type i.
data num2 type i.
data res type i.
num1 = 10.
num2 = 20.
perform add.
form add.
res = num1 + num2.
write : res.
endform.
This returns the result.
But what are the changes if I use changing and using parameters and how do i use it in the current context.
Regards.
Sagar
10-12-2008 2:55 PM
hi,
in ur code ur r passing static local data to subroutine.
data num2 type i.
data res type i.
num1 = 10.
num2 = 20.
perform add.
form add.
res = num1 + num2.
write : res.
endform.
but if u use using and changing formal parameters ,then they can behave as dynamic local objects to the subroutine:
the code will look like:
perform add using num1 num2 changing res.
form add using x type i
y type i
changing z type i.
10-12-2008 2:56 PM
perform add.
form add.
res = num1 + num2.
write : res.
endform.
replace with this logic
perform add using num1 num2 changing res.
form add using num1 num2 changing res..
res = num1 + num2.
write : res.
endform.