View previous topic :: View next topic
|
Author |
Message |
roshanvarghese
New User
Joined: 15 Jul 2005 Posts: 1
|
|
|
|
hi
cud u pls explain how the call works in this case and also tell me the o/p
test: procedure options(main);
declare a fixed bin(31);
a = 100;
call subroutine(a,100);
put skip list (a,100);
end test;
subroutine: procedure(x,y);
declare (x,y) fixed bin(31);
x = 101;
y = 101;
end subroutine;
thanks
roshan |
|
Back to top |
|
|
bakarthikeyan
New User
Joined: 21 Sep 2005 Posts: 6
|
|
|
|
No. you have to use DCL <EXTERNAL PROC NAME> EXTERAL; in the calling program. So that, u can combine both. |
|
Back to top |
|
|
Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
Yep, external proc name must be declared.
The output will be 101 and 100.
Do correct me for any mistakes.
Thanks!
Sridevi. |
|
Back to top |
|
|
jawadshaik Warnings : 1 New User
Joined: 27 Sep 2005 Posts: 16
|
|
|
|
proc1: proc options(main);
dcl x bin fixed(15) init(10);
dcl sub_proc entry(fixed bin(15) , fixed bin(15));
put skip list(x,a);
end proc1;
sub_proc: proc(x,y);
dcl (x,y) fixed bin(15);
x = x + 1;
y = y + 1;
end sub_proc;
output:
101
100
hope this will be clear
regards,
jawad shaik |
|
Back to top |
|
|
jawadshaik Warnings : 1 New User
Joined: 27 Sep 2005 Posts: 16
|
|
|
|
SORRY FRIEND
CALL SUB_PROC(X,100); IS MISSED AFTER
SO
dcl sub_proc entry(fixed bin(15) , fixed bin(15));
call sub_proc(x,100);
put skip list(x,100);
AND OUTPUT IS
11
100
sorry for mistake plz dont mind |
|
Back to top |
|
|
Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
Hi jawadshaik,
Roshan wants to know the output for HIS code. YOUR code is different,fine. Even after considering your 2nd post, I couldn't predict what you are trying to convey. In your 1st code,X is initialized to 10 but the output is 101 and 100.What is variable "a"? Your 2nd code's output is 11 and 100. Please be clear on what you would like to convey.
Regards,
Sridevi. |
|
Back to top |
|
|
jawadshaik Warnings : 1 New User
Joined: 27 Sep 2005 Posts: 16
|
|
|
|
Hi,
Sorry For Confusing
Here is what I meant
PROC1: PROC OPTIONS(MAIN);
DCL X FIXED BIN(15) STATIC INIT(100);
DCL SUB_PROC ENTRY(FIXED BIN(15),FIXED BIN(15));
CALL SUB_PROC(X,100);
PUT SKIP LIST(X,100);
END PROC1;
SUB_PROC: PROC(Y,Z);
DCL (Y,Z) FIXED BIN(15);
Y = Y + 1;
Z = Z + 1;
END SUB_PROC;
OUTPUT:
101 100
Hope I am clear know
regards,
Jawad shaik |
|
Back to top |
|
|
|