| HWN( ) | Highest Unused Window Number | 
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. | 
Highest unused window number.
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.