S
PL_
PL_
PL_PLCB.STATUS{%}{WTHEN\ELSE}
*
      S$ = CALLFN('00':             \
                  FNR.PLCB.STATUS:           \ ;* Function code
                  OCONV({%1},'MCDX')'R%4':   \ ;* Port number
                  '00                        \ ;* TP
                   00                        \ ;* Status
                   0000                      \ ;* Error
                   0000                      \ ;* User port number
                   0000                      \ ;* State
                   00000000                  \ ;* Connection net    number
                   000000000000              \ ;* Connection node   number
                   0000                      \ ;* Connection socket number
                   0000                      \ ;* Connection p_no
                   00                        \ ;* Connection class
                   00                        \ ;* Connection filler
                   0000                      \ ;* Connection port   number
                   00000000000000000000      \ ;* Connection name
                   00000000                  \ ;* In  character count
                   00000000                  \ ;* Out character count
                   00000000                  \ ;* Retry count
                   00000000                  \ ;* Reopen count
                   00000000                  \ ;* Packet retry count
                   000000000000              \ ;* Immediate address
                  ')[3,999999]
*
      IF S$[1,4] = IPX.SOCKET.NO THEN
         RES = OCONV(S$[5,4],'MCXD')
         IF RES > 32768 THEN
            RES = RES - 65536
         END
         ERR = 0
      END ELSE
         ERR = 1
         RES = 0
      END
*
      IF NOT(ERR) AND RES >= 0 {%2}
