Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Static variable are global ?

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

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Tue May 11, 2010 3:09 pm    Post subject: Static variable are global ?
Reply with quote

If I have a main proc called M,
In M, I have A proc and B proc.
Now, if I declare a variable 'x' in A proc as Static. Can I use it in the main proc M without having declared it in M ??

If not, then please let me know, is there anything like global variable where the above should be possible.

Please advice.
Back to top
View user's profile Send private message

prino

Active Member


Joined: 07 Feb 2009
Posts: 989
Location: Oostende, Belgium

PostPosted: Tue May 11, 2010 3:32 pm    Post subject:
Reply with quote

No.

Variables are only know in the procedure in which they are declared and in all procedures contained in that procedure. Whether they are STATIC or AUTOMATIC has absolutely no relevance.

If you want a global variable, declare it in the outermost block, and it will be visible in all internal procedures, unless any of the internal procedures declares a variable with the same name, in which case you have no way of accessing the same named variable in the outer procedure.
Back to top
View user's profile Send private message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Tue May 11, 2010 3:36 pm    Post subject:
Reply with quote

Great... Thanks a lot Prino
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 Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am
No new posts File Manager with Variable Length File ahabib IBM Tools 10 Thu Mar 31, 2016 11:00 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us