View previous topic :: View next topic |
Author |
Message |
mfuser Banned
Joined: 01 Mar 2005 Posts: 105 Topics: 58
|
Posted: Tue Nov 28, 2006 10:47 pm Post subject: passing values from subprogram to main program |
|
|
Members,
I am passing two values from a main program to subprogram and in the subprogram i am calculating the sum and displaying it.Is it possible to return the summed value from sub program to main program and then display the sum in the main program. Please help me if any syntax is available if not how to pass values from subprogram to main program. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Wed Nov 29, 2006 6:20 am Post subject: |
|
|
Hi mfuser,
As you are not mentioned about the language, I am explaning with PL1.
Mostly we will use functions for returning values to the calling programs.
For example, you want to calculate X1+X2 and want return the value in SUM1
Code: | RESULT = SUM_FUNCTION(X1,X2,SUM1)
...
...
SUM_FUNCTION:PROC(X1,X2,SUM1) ;
DCL X1 DEC FIXED;
DCL X2 DEC FIXED;
DCL SUM1 DEC FIXED;
SUM1 = X1+X2;
RETURN(SUM1);
END; |
Hope this will help you... |
|
Back to top |
|
 |
|
|