CDS088

Return Unused Channel Number

Last Revised: 05/06/14

This routine can be called to obtain a unused channel number.  It is similar to the bbx UNT function except that it by default does not return a channel number below 10.  Note that most Dynamo Tools use this routine to obtain an unused channel number, including CDS095, CDS037, etc.

Dynamo Tools supports channel numbers from 0 to 32,767, but reserves channel numbers above 32,000 for its own use. Note that although bbj supports channel numbers higher than 32,767, due to limitations of the CHN system variable, Dynamo Tools limits application channel numbers to a maximum of 31,999 even when running bbj.

Calling Format:

CALL "CDS088", CHAN, { MINCHAN }

CDS088
Input Variable
MINCHAN Optional lowest channel number to return.  If not passed, or passed as zero, then CDS088 will return an unused channel number of 10 or higher. See reference to Global Variable SMS_MINCHAN to override the MINCHAN value.
Global Variable
SMS_MINCHAN Optional lowest channel number to return. Can be a number from 11 to 30000. This global will override the minimum channel number of 10, when MINCHAN is not passed to CDS088. This can be set within the CONFIG.BBX file or programmatically, to help prevent a channel number conflict that might be caused by an application using a hard-coded channel number.
Output Variable
CHAN will be set to the lowest channel number not currently being used, that is greater than the MINCHAN or SMS_MINCHAN values.
Examples
READY
>CALL "CDS088",CHAN
>?CHAN
10
>CALL "CDS088",CHAN,50
>?CHAN
50
>CALL "CDS088",CHAN,1
>?CHAN
1