One thing, John - if in an interactive session, I don't think you should try to close FDs 0, 1, or 2 - these are set by the system and correspond to input (keyboard), output (display), and error output.

In batch, you can start with FD = 0, I think.

I'm not sure how to avoid closing things you shouldn't, but if you are in a given job, you are probably safe enough to assume you are in control and not affecting other users.


On 4/15/2014 1:53 PM, John Allen wrote:
Thanks Vern, I will look into that function/API

-----Original Message-----
From: Vernon Hamberg [mailto:vhamberg@xxxxxxxxxxxxxxx]
Sent: Tuesday, April 15, 2014 2:51 PM
To: Midrange Systems Technical Discussion
Subject: Re: How can I clear/deallocate open File


You could look at the fcntl function - I was involved in a
thread a while ago here that mentioned this API - one way of
calling it (duping an FD) will get you the next available FD
- I think you could then go through from start to that
number and try to close them.

That's a very vague recollection - Chuck had some input
there, as well.


On 4/15/2014 12:10 PM, John Allen wrote:
Running V6.1 We have system that creates a lot of files in
the IFS,
recently we started getting an error (lots of them

CPF9897 socket(): Too many open files for this process.

Apparently there are a lot of File Descriptors being left
during this process.

I have not tracked down the program at issue here (I am
thinking some
program is not closing the file)

But my question is, until I can find the culprit and get
it fixed is
there a way to force all the open file descriptors to
close or
deallocate (not sure of the correct term)

99999 is the job number from the job getting this error)

A lot of foreign stuff in the report but I do see:

Max Number of Descriptors Allowed (size) 524282

Max Number of Descriptors Allocated 47

Min Deallocated Descriptor 45

1) I need something to do short term to get this
program running

2) Then I will need to track this issue down

Any Suggestions on #1 or #2 would be greatly appreciated


This is the Midrange Systems Technical Discussion
(MIDRANGE-L) mailing list To post a message email:
MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change
list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting,
please take a moment to review the archives at

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page