	PROGRAM SENDTM
C
C  This program updates the system time and date on
C  a LABSTATION 23 node from the host.
C
	INTEGER*2 TIME(8),RETURN_STATUS
	BYTE TIMBUF(8),RETURN_BUFFER(2),SEND_BUFFER(16)
C
	EQUIVALENCE (TIME(1), SEND_BUFFER(1))
	EQUIVALENCE (RETURN_STATUS, RETURN_BUFFER(1))
C
C  Establish the connection with the remote node.
C
	OPEN (UNIT=1, FILE='NODENAME',
	1 STATUS='OLD', FORM='FORMATTED',
	2 ACCESS='SEQUENTIAL',RECL=512, BLOCKSIZE=600, ERR=45)
	TYPE *,'Connection established'
C
C  Get the current host system time and date and put it
C  into the SETTIM directive call format that RSX expects.
C
	CALL IDATE ( TIME(2), TIME(3), TIME(1) )
C
	CALL FOR$TIME ( %REF(TIMBUF) )
	DECODE (8, 15, TIMBUF) TIME(4), TIME(5), TIME(6)
15	FORMAT (I2,1X,I2,1X,I2)
	TIME(8)=-1
	WRITE (1,20) SEND_BUFFER
20	FORMAT(16A1)
C
C  Wait for the status return from the remote node.
C
	READ (1,25) RETURN_BUFFER
25	FORMAT(2A1)
C
	IF(RETURN_STATUS.NE.1)GOTO 30
	TYPE *,'Time has been set on specified node.'
	GOTO 40
30	TYPE *,'Unable to set time on node specified.'
40	CLOSE(UNIT=1)
	CALL EXIT
45	TYPE *,'Unable to connect with the node specified.'
	CALL EXIT
	END	
