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

Actual and formal

Former Member
0 Likes
1,139

What are Actual and formal Parameters?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,080

Dear Balu,

Actual and formal parameters are used in modularization technique while calling a subroutine. Generally we use subroutines using PERFORM statement and the functionality of this subroutine is defined at the end of the program using FORM and ENDFORM statements. The variables used in perform statement are called ACTUAL PARAMETERS and the variables used in form, endform statements are called FORMAL parameters. During the program execution these actual parameters are passed to the formal parameters. We can use the same variable name for both actual and formal parameters.

EXAMPLE:

data: n3 type i.

parameters: n1 type i,

n2 type i.

perform addition using n1 n2 n3. " n1, n2, n3 are actual parameters.

write:/ n3.

form addtion using a b c. " a, b and c are formal parameters.

c = a + b.

endform.

Regards

Biswaranjan.

5 REPLIES 5
Read only

Former Member
0 Likes
1,081

Dear Balu,

Actual and formal parameters are used in modularization technique while calling a subroutine. Generally we use subroutines using PERFORM statement and the functionality of this subroutine is defined at the end of the program using FORM and ENDFORM statements. The variables used in perform statement are called ACTUAL PARAMETERS and the variables used in form, endform statements are called FORMAL parameters. During the program execution these actual parameters are passed to the formal parameters. We can use the same variable name for both actual and formal parameters.

EXAMPLE:

data: n3 type i.

parameters: n1 type i,

n2 type i.

perform addition using n1 n2 n3. " n1, n2, n3 are actual parameters.

write:/ n3.

form addtion using a b c. " a, b and c are formal parameters.

c = a + b.

endform.

Regards

Biswaranjan.

Read only

Former Member
0 Likes
1,080

hi,,

Actual parameters r those values wht we pass they n formal parameters r those that r created as refernce paramenetrs for actuall parameters....

for eg;

parameters : a type i,

b type i.

data : c type i.

perform add using a b. ( Here a b r the actualparameters.

form add using x y. (Here x y r the formal parameters taken as reference of a b parameters.)

c = x + y.

write 😕 c.

endform.

After writing perform statement just double click on add n click on continue it will cretaed the formal parameters on it own.

with regards,

madhuri. n if useful reward with points.

Read only

Former Member
Read only

Former Member
0 Likes
1,080

hi,

parameters defined in FORM/ENDFORM are formal parameters.

else are actual parameters.

thanks and regards

shyam

Read only

Former Member
0 Likes
1,080

HI,

The Actual params are the one which u actually send to the subroutine..

See here..

data: a,b,c

perform data_process using a b c.

"a, b, c are actual parameters.they forward the values into the subroutine..

This parameters should be define before itself as above

When comes to Formal.. The formal parameters are the one formal to actual..

FORM data_PROCESS using f_a type char

f_b type char

f_c type char.

"f_a, f_b, f_c are forma paramss./

remember one this these F_A,f_b, f_c are not defined so we need to define their character type as above..

Using -- is just for using the value.

Changing-- it uses the value and changes too..

reward if useful

regards,

nazeer