IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Significance of Static in variable initialization


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top