System Functions

HWN( )

Highest Unused Window Number

Format

HWN(chan[,ERR=stmtref])
 
Where:

chan

Channel or logical file number of the terminal device whose highest unused window number is to be reported (usually device (0) or the console).

stmtref

Program line number or statement label to which to transfer control.

Returns

Highest unused window number.

Description

The HWN( ) function returns an integer, reporting the highest unused window number for a given file. If all window numbers are in use, this function will return -1. If the file is not open or not a terminal, PxPlus returns Error #13: File access mode invalid.

You can use the window number returned by the function in a subsequent 'WINDOW' mnemonic to create a new window. If no window number is passed to the 'WINDOW' mnemonic, it will utilize the lowest unused window number.

The maximum number of windows allowed on a terminal device is 250.

Note:
The HWN( ) function is affected by your setting for the 'B0' system parameter.