Application Development and Automation 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: 
Read only

diffrence b/w USING AND CHANGING

Former Member
0 Likes
1,265

can any one tell me diffrence between USING and CHNAGING.

whether USING a (or) CHANGING a are equevalent?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,236

hi PRSHANTH,

Hope you dint look at my eaerlier reply..

ie..

if you pass a value as CHANGING VALUE()..

the change is not reflected within the FORM ..ENDFORM for the actual parameter.. ie in case you call another PERFORM like follows..

b=5.

PERFORM a CHANGING B.

FORM a CHANGING VALUE(B)

b=10.

PERFORM C.

ENDFORM.

FORM c.

write : /b.

endform.

......

now

in the form c.

the value of b is still unchanged since the endform of FORM a is still encountered..

14 REPLIES 14
Read only

Former Member
0 Likes
1,236

i am not asking the result. i want to know the way they are processing. i.e. by reference or by value and return?

Read only

Former Member
0 Likes
1,236

USING is that you are using a parameter but not trying to changfe the value.

CHANGING is that the parameter value can be changed.

Read only

0 Likes
1,236

You can pass both USING and CHANGING parameter as either pass by value or by reference.

But it depends on how you should use it.

Use USING if you dont want to read the values not to change them.

Read only

0 Likes
1,236

hi prasanth,

see there r 3 types of psaaing rt

1.pass by value

2. pass by reference

3. pass by value and return

1.using value(a)----


this is pass by value

2.using (a) or changeing (a) -


this is pass by reference

3. changing value(a) -


this is pass by value and return.

pass by value and return -


this is pass by reference only if u dont exit from the subrotune expicitly. means if inside the form, there is exit statement or any other statement which forcibly returns from the control from the form with out reaching the end of the form, then it acts as pass by value else it acts as pass by refernce.

Read only

Former Member
0 Likes
1,236

hi,

they are not same.

suppose take...

using a

you cannot modify a value.

changing a.

you can modify the value of a. inside the perform.

regards

vijay

Read only

Former Member
0 Likes
1,236

USING p_name1

values are initial,after changing value will not be affected

CHANGING p_name2

values may or may not be initial,after changing the value gets affected

Read only

Former Member
0 Likes
1,236

Hi prashanth,

1. Good Question.

2. Theoretically, their

PURPOSE is different.

3. BUT

We can even use them INTER-CHANGE ABLY

4. Changing is meant for changing purpose.

5. But even in USING u can change the values !

regards,

amit m.

Read only

Former Member
0 Likes
1,236

USING and CHANGING..works almost the same ..as call by refernce..except that in using..

1. you can pass the value by VALUE() addition to keep the original value unchanged.

2. in CHANGING if you pass it as VALUE() ..the value remains unchanged until it encounters an endform statement.. but gets changed when the value is returned..

which we call as <b>pass by value and result</b>.

Read only

Former Member
0 Likes
1,236

HI prashant.

Using and Changing has the same effect when it is passed by reference.

During call by value.

USING pass the value of the variable. it will act as a local variable in the form. the change will not affect the passed value outside the form.

Changing will change the value in both the methods but the change will not occur untill endform

Message was edited by: Harikishore Sreenivasulu

Message was edited by: Harikishore Sreenivasulu

Read only

Former Member
0 Likes
1,236

hi friends,

thanks for u r answers,but still i had one doubt.

changing value(a) and changing a are effected same way.

then which one to use when. explain according to memory issues.

Read only

0 Likes
1,236

Use changing value(a) when you want to pass by value. And the value is reflected on ENDFORM. Use Changing a when you want to call across programs.

Read only

Former Member
0 Likes
1,237

hi PRSHANTH,

Hope you dint look at my eaerlier reply..

ie..

if you pass a value as CHANGING VALUE()..

the change is not reflected within the FORM ..ENDFORM for the actual parameter.. ie in case you call another PERFORM like follows..

b=5.

PERFORM a CHANGING B.

FORM a CHANGING VALUE(B)

b=10.

PERFORM C.

ENDFORM.

FORM c.

write : /b.

endform.

......

now

in the form c.

the value of b is still unchanged since the endform of FORM a is still encountered..

Read only

Former Member
0 Likes
1,236
Read only

Former Member
0 Likes
1,236

hi prashanth,

the use of USING & CHANGING depend on the program's requirement.e.g when there is a need for passing two parameters & calculating or manipulating some other , then u go for USING . whereas sometimes u require to change a parameter based on some other condition then u have to go for CHANGING . Both can be passed by value & by reference depending upon the scope of the logic.