%SYN_FREECHN

Get the next available channel

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
Note

%SYN_FREECHN was deprecated in Synergy/DE version 10.3.3g; we recommend you pass a variable with a value of 0 to the OPEN statement instead. This will cause the next free channel number to be used. For example,

open(var=0, i, "mylst")
channel = %SYN_FREECHN([start][, end])

Return value

channel

The number of the next available channel, or 0 if no channel is available. (n)

Arguments

start

(optional) The first channel to consider. (n)

end

(optional) The last channel to consider. (n)

Discussion

%SYN_FREECHN checks the channels between start and end, if specified, and returns the first available channel.

%SYN_FREECHN is not thread safe on Synergy .NET and should not be used in multi-threaded programs.

Examples

The example below checks the channels between 101 and 199 and returns the first available channel encountered.

record
    chn         ,i4
proc
    chn = %syn_freechn(101, 199)
    if (.not. chn)
      writes(1, "no channels available")