UNT & HFN returning -1

Started by Peter.Higgins, July 21, 2022, 03:27:27 PM

Previous topic - Next topic

Peter.Higgins

This is a new one in my experience.  I'm wondering why I am getting this from these two functions.  It is 5 levels into an object stack when the file handles appear to run out, but chn doesn't span more than 1 and half lines.  Same code has been running for a week with this object on thousands of imports for another project without this error occurring.

James Zukowski

Are you running with the 'XF' parameter set? If not, you're limited to 63 channels open at a time. If you hit the limit, that probably explains the -1...none left to give you.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Peter.Higgins

James,  -'XF' at the time and place of the -1

James Zukowski

That means you're running with a limit of 63 local channels (+ console), and 64 globals. If you set_param 'XF', that will open the channel numbers to about 32k each (though documentation indicates a total limit of 500 open per session).
Beware if you have any old code that relies on 2- or 3-digit channel numbers, especially in strings. HFN with 'XF' will start at 32767 instead of 63. UNT will always count up from 1.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Peter.Higgins

Thanks James,
You are correct.  I followed the example in HFN below and it is messed up.  Its been a long time, maybe 20 years since I've had to explicitly set XF.

set_param -'XF'
?hfn
32767