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
 

 

Significance of Static in variable initialization

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

New User


Joined: 18 Oct 2005
Posts: 5

PostPosted: Fri Nov 25, 2005 12:05 pm    Post subject: Significance of Static in variable initialization
Reply with quote

Hi,

What is significance of following:

DCL Var FIXED BIN(15) STATIC INIT(100);

Is it this static like in C language?
Back to top
View user's profile Send private message

nutakkimurali

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Fri Nov 25, 2005 1:25 pm    Post subject: Re: Significance of Static in variable initialization
Reply with quote

Variables declared with the STATIC attribute are allocated storage prior to
program execution. They remain allocated until the program terminates.

Noe it down one more thing that,STATIC is the default for external variables.

Where you want variables to retain their value from one invocation of the procedure to another declare them with the static attribute

DCL Var FIXED BIN(15) STATIC INIT(100);

In above staement the value of Var remains the same throughout the program.

*******************************************************
MAIN: PROCEDURE OPTIONS(MAIN);
DCL 1 STRUCTURE,
2 A FIXED DEC (6,2),
2 B CHAR(20);
.
.
P1: PROC;
DCL Name CHAR(10) STATIC init('muralee');
END P1;
P2: PROC;
DCL LIST(500) FIXED STATIC;
.
END P2;
END MAIN;
*********************************************************
Try to print the value of name in P2 and it'll give you the idea about the STATIC.

Muralee
Back to top
View user's profile Send private message
surendra_mainframe

New User


Joined: 18 Oct 2005
Posts: 5

PostPosted: Fri Nov 25, 2005 1:31 pm    Post subject: Re: Significance of Static in variable initialization
Reply with quote

Thanx
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 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
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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