View previous topic :: View next topic
|
Author |
Message |
nutakkimurali
New User
Joined: 15 Nov 2005 Posts: 22
|
|
|
|
If i declare soemthing like below what is the output
MAIN : PROC OPTIONS(MAIN)
DCL A FIXED DEC(5,2) STATIC INIT('5');
B FIXED DEC(5,2) STATIC INIT('8');
.
.
.
Q : PROC
DCL A FIXED DEC(5,2) STATIC INIT('7');
PUT SKIPLIST ('A');
END Q;
Z : PROC
B FIXED DEC(5,2) INTERNAL STATIC INIT('9');
PUT SKIPLIST ('B');
END Z;
END MAIN;
I want to know what is the value of A when Q invokes and what is the value of B when Z invokes where B is declared as INTERNAL STATIC?
Plz help me on this
Regards,
Muralee |
|
Back to top |
|
|
jawadshaik Warnings : 1 New User
Joined: 27 Sep 2005 Posts: 16
|
|
|
|
hi
the values will be 7 and 9 respectively. |
|
Back to top |
|
|
nutakkimurali
New User
Joined: 15 Nov 2005 Posts: 22
|
|
|
|
jawadshaik wrote: |
hi
the values will be 7 and 9 respectively. |
Thank you... |
|
Back to top |
|
|
nutakkimurali
New User
Joined: 15 Nov 2005 Posts: 22
|
|
|
|
[MAIN : PROC OPTIONS(MAIN)
DCL A FIXED DEC(5,2) STATIC INIT('5');
B FIXED DEC(5,2) STATIC INIT('8');
.
.
.
Q : PROC
DCL A FIXED DEC(5,2) EXTERNAL STATIC INIT('7');
PUT SKIPLIST ('A');
END Q;
Z : PROC
B FIXED DEC(5,2) INTERNAL STATIC INIT('9');
PUT SKIPLIST ('B');
END Z;
END MAIN;
If i declare something as External in Proc Q and what is the output even though i declare the same variable in MAIN proc ???
Please let me know |
|
Back to top |
|
|
jawadshaik Warnings : 1 New User
Joined: 27 Sep 2005 Posts: 16
|
|
|
|
hi
the values will be 7 and 9 respectively
if static is mentioned the value the variable is having before leaving the proc will be given at the time the control again comes to the proc.
Q : PROC
DCL A FIXED DEC(5,2) EXTERNAL STATIC INIT('7');
PUT SKIPLIST ('A');
a = 10;
END Q;
call Q;
call Q;
for first call of Q a will be displayed as 7 next time when it is called the value displayed will be 10
hope you go what i was trying to convey
with reagrds,
Jawad shaik |
|
Back to top |
|
|
|