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
 

 

Retain the variable value in PL1

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

New User


Joined: 23 May 2007
Posts: 26
Location: hyderabad

PostPosted: Wed Sep 16, 2009 2:20 pm    Post subject: Retain the variable value in PL1
Reply with quote

Hi,

I have to retain a variable value , if i come out from a module.

For example.

A is calling B.

B is calling C.

In module C I need to perform some paragraph only once, that is when i entered first time into the module C. If i came to module 'C' next time i should not perform that paragraph. For this I did

I have declared a variable as extern.

Module c:
DCL Flag char(1) extern;

If flag not= 'Y' then
do process;
flag = 'Y';
end;
do next process;
return;

When i am coming first time from module B to C, flag is not having any value it is executed, i return back to B i did some process and return back to A. This process is in loop. I came next time to b, b once again called to C, by this time flag didn't have value 'Y'. As of extern or static it should have value until end of the unit.

Please let me know if any other way we can achieve this. with out doing any changes in module 'A'.
Back to top
View user's profile Send private message

prino

Senior Member


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

PostPosted: Wed Sep 16, 2009 2:54 pm    Post subject:
Reply with quote

Code:
dcl first bit(1) init('1'b) static;
if first then
  do;
    first = '0'b;
    whatever-else...
  end;


Should be OK.

Might need special compiler options if this needs to be re-entrant.
Back to top
View user's profile Send private message
bauer

New User


Joined: 03 Mar 2009
Posts: 26
Location: germany

PostPosted: Mon Sep 21, 2009 12:23 pm    Post subject: Reply to: Retain the variable value in PL1
Reply with quote

Or use a controlled variable in modul C and builtion function allocation to check if the variable was initialized already.
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 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
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
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


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