%CHOPEN

Determine if an I/O channel is open

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %CHOPEN(channel)

Return value

status

One of the following values: (n)

1 = The specified channel is currently open.

0 = The specified channel is closed.

Arguments

channel

The number of the channel in question. (n)

Discussion

%CHOPEN determines whether or not an I/O channel has been opened.

Examples

The following function builds a channel-in-use table for the first 10 channels.

function chn_tbl
literal
    bits                ,10i4, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
record flags
    chn                 ,i4
    chn_tbl             ,i4
proc
    clear chn_tbl
    for chn from 1 thru 10
      if (%chopen(chn)) 
        chn_tbl = (chn_tbl .bor. bits(chn))
    freturn (chn_tbl)
endfunction