C***
C       TITLE   XMTTST
C
C       Version 1.0     AUG0382
C
C
C    FACILITY:
C   TEST PROGRAMS FOR THE COMMUNICATIONS DRIVER PACKAGE CDPACK
C
C
C    ABSTRACT:
C   MAKES CALLS TO THE ROUTINES OF CDPACK TO TRANSMIT MESSAGES
C
C
C    AUTHOR     MARK PYATETSKY
C               Computing Department,
C               Fermi National Accelerator Lab
C
C   CREATION DATE: AUG0382
C
C   MODIFIED BY:
C
C***
	IMPLICIT INTEGER(A-Z)
	INTEGER*2  CHAN
      	INTEGER*2  SIGNAL
	DIMENSION RBUF(4000)
	DIMENSION STAT(2)
	DATA MAXWC/4000/
C
   	TYPE	*, 'TEST SIGNALS'
   	ACCEPT	14, TSTSIG
	I=IGETC()
	I=IGETC()
        CALL CDASGN(CHAN,'CD',0,STAT)
	TYPE	*, 'ASSIGN STATUS'
	TYPE	12, STAT(1),STAT(2)
	IF  (STAT(1) .NE. 1)  STOP 'CDASGN PROBLEM'
	CALL CDOPEN(CHAN,1,STAT)
   	IF  (STAT(1) .EQ. 1)  GOTO 5		!IF NE - NO SIGNAL TEST
   	TSTSIG = 'N'
 5 	MBNOPN = STAT(2)			!SAVE 'OPEN' MESSAGE BLK NO
	TYPE	*, 'OPEN STATUS'
	TYPE	12, STAT(1),STAT(2)
10	CALL CDXMTW(CHAN,1,RBUF,MAXWC,STAT)	!XMIT A MESSAGE
	TYPE	*, 'TRANSMIT STATUS'
	TYPE	12, STAT(1),STAT(2)
   	IF  (TSTSIG .EQ. 'N')  GOTO 11		!IF EQ - NO SIGNAL TEST
   	SIGNAL = 33
   	CALL CDSIGW(CHAN,1,SIGNAL,STAT)         !SEND SIGNAL
   	TYPE	*, 'SEND SIGNAL'
   	TYPE	12, STAT(1),STAT(2)
   	CALL CDSTAT(MBNOPN,INF,STAT)            !SIGNAL RECEIVED?
   	IF  (INF .NE. 6)  GOTO 11		!IF NE - NOT YET
   	TYPE	*, 'SIGNAL RECEIVED'
   	TYPE	12, STAT(1),STAT(2)
11	CONTINUE
	TYPE	*, 'CONTINUE?'
	ACCEPT	14, TEST
	IF  (TEST .EQ. 'Y')  GOTO 10
	STOP 'END OF PROGRAM'
12	FORMAT(O7,O7)
14	FORMAT(A1)
	END
