Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Scope of STATIC VARIABLE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
nutakkimurali

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Tue Feb 28, 2006 3:08 pm    Post subject: Scope of STATIC VARIABLE
Reply with quote

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
View user's profile Send private message

jawadshaik
Warnings : 1

New User


Joined: 27 Sep 2005
Posts: 16

PostPosted: Tue Feb 28, 2006 5:58 pm    Post subject: Re: Scope of STATIC VARIABLE
Reply with quote

hi

the values will be 7 and 9 respectively.
Back to top
View user's profile Send private message
nutakkimurali

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Tue Feb 28, 2006 6:09 pm    Post subject: Re: Scope of STATIC VARIABLE
Reply with quote

jawadshaik wrote:
hi

the values will be 7 and 9 respectively.



Thank you...
Back to top
View user's profile Send private message
nutakkimurali

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Thu Mar 02, 2006 2:46 pm    Post subject: Re: Scope of STATIC VARIABLE
Reply with quote

[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
View user's profile Send private message
jawadshaik
Warnings : 1

New User


Joined: 27 Sep 2005
Posts: 16

PostPosted: Thu Mar 02, 2006 4:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us