Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

subroutines using and changing

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.