Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
nutakkimurali

New User

Joined: 15 Nov 2005
Posts: 22

 Posted: Tue Feb 28, 2006 3:08 pm    Post subject: Scope of STATIC VARIABLE 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

Warnings : 1

New User

Joined: 27 Sep 2005
Posts: 16

 Posted: Tue Feb 28, 2006 5:58 pm    Post subject: Re: Scope of STATIC VARIABLE hi the values will be 7 and 9 respectively.
nutakkimurali

New User

Joined: 15 Nov 2005
Posts: 22

Posted: Tue Feb 28, 2006 6:09 pm    Post subject: Re: Scope of STATIC VARIABLE

 jawadshaik wrote: hi the values will be 7 and 9 respectively.

Thank you...
nutakkimurali

New User

Joined: 15 Nov 2005
Posts: 22

 Posted: Thu Mar 02, 2006 2:46 pm    Post subject: Re: Scope of STATIC VARIABLE [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
Warnings : 1

New User

Joined: 27 Sep 2005
Posts: 16

 Posted: Thu Mar 02, 2006 4:14 pm    Post subject: 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
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us