      SUBROUTINE PLIP.BCB.SENDX(S)
*PIC-LAN
*
*MVBASE D3 UV UD UN JB QM
*PC
*N
*
*
*
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
      INCLUDE PLW.COMMON
*
      ID = ST$PLCB 'R%8' : '*OBUF'
*
      EQUATE R.TP.NONE        TO 0
      EQUATE R.TP.BIN         TO 1
      EQUATE R.TP.HEX         TO 2
*
      CNT0 = ST$OBUF.CNT
      IF NOT(NUM(CNT0)) THEN
         DELETE PL$CONN.FD , ID
         S = ''
         RETURN
      END
*
      IF CNT0 THEN
         READ SS FROM PL$CONN.FD , ID THEN
            R.TP = SS<1>
            IF R.TP = R.TP.HEX THEN
               S = DELETE(SS,1,0,0) : S
            END ELSE
               S = PL_HEX(DELETE(SS,1,0,0)) : S
            END
         END ELSE
            CNT0 = 0
            R.TP = R.TP.NONE
         END
      END ELSE
         R.TP = R.TP.HEX
      END
*
      FLG = 1
      OFFSET = 1
      T.LEN = LEN(S)
      LOOP
         W.LEN = T.LEN - OFFSET + 1
         IF W.LEN > PLIP$MAX.IO.LEN THEN
            W.LEN = PLIP$MAX.IO.LEN
         END
      WHILE FLG AND W.LEN DO
         PL_WRITEXN (S[OFFSET,W.LEN]) , (W.LEN/2) ON ST$PLCB ELSE
            ST$OBUF.CNT = '*'
            DELETE PL$CONN.FD , ID
            S = ''
            RETURN
         END
         IF RES > 0 THEN
            OFFSET = OFFSET + RES + RES
         END ELSE
            FLG = 0
         END
      REPEAT
      S = S[OFFSET,BIG.STR]
      ST$OBUF.CNT = LEN(S) / 2
      IF ST$OBUF.CNT THEN
         WRITE R.TP.HEX : AM : S ON PL$CONN.FD , ID
      END ELSE
         IF CNT0 THEN
            DELETE PL$CONN.FD , ID
         END
      END
*
      S = ''
*
      RETURN
   END
