MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Recognizing fopen in a function call

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Nimesh Srivastava
Beginner


Joined: 22 Jul 2003
Posts: 13
Topics: 8

PostPosted: Thu Nov 18, 2004 3:09 am    Post subject: Recognizing fopen in a function call Reply with quote

Hi,
We are currently facing a problem ( an existing system with lots of fopen in functions and missing fclose at all exit conditions of those functions).
Is there a way I can recognize the number of files opened within a function, so that an inline RETURN function would close all the file handles opened only within that function.
For ex.
main()
{
funcA();
funcB();
}
funcA()
{
...
fp1 = fopen("DD:abc1",Mode);
fp2 = fopen("DD:abc2",Mode);
...
RETURN(4); // failure return would close only fp1 & fp2
...
RETURN(0); // new inline function would close only fp1 & fp2
}

funcB()
{
...
fp3 = fopen("DD:xyz1",Mode);
fp4 = fopen("DD:xyz2",Mode);
...
...
RETURN(0); // new inline function would close only fp3 & fp4
}

inline int RETURN(int a)
{
// recognize all open handles in that module
// close them one by one
return success
}

Or if any other solution can be suggested...
Thanks,
Nimesh
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group