PROGRAM SNDRCV IMPLICIT INTEGER (A-Z) INTEGER FLOW ! 1 FOR TO10, 2 FOR TOVAX. INTEGER MODE ! 1 FOR ASCII, 2 FOR SYSGEN. LOGICAL COMP INTEGER TYPE(6), ASCII(5), SYSGEN(6) INTEGER DIRCTN(5), TO10(4), TOVAX(5) DATA ASCII/1HA,1HS,1HC,1HI,1HI/, SYSGEN/1HS,1HY,1HS,1HG,1HE,1HN/ DATA TO10/1HT,1HO,1H1,1H0/, TOVAX/1HT,1HO,1HV,1HA,1HX/ C GET THE DIRECTION OF TRANSFER. 1 READ (5,9901) DIRCTN IF ( .NOT. COMP(DIRCTN,TO10,4)) GO TO 2 FLOW = 1 GO TO 10 2 IF (.NOT. COMP(DIRCTN,TOVAX,5)) GO TO 3 FLOW = 2 GO TO 10 3 CALL SNAK GO TO 1 C GET THE TYPE OF TRANSFER. 10 CALL SACK 11 READ (5,9901) TYPE 9901 FORMAT (10A1) IF (.NOT. COMP(TYPE,ASCII,5)) GO TO 20 MODE = 1 GO TO 40 20 IF (.NOT. COMP(TYPE,SYSGEN,6)) GO TO 30 MODE = 2 GO TO 40 30 CALL SNAK GO TO 11 C DISPATCH ON THIS INFORMATION. 40 CALL SACK GO TO (41,42), FLOW 41 CALL GETA STOP 42 GO TO (421,422), MODE 421 CALL SENDA STOP 422 CALL SENDB STOP END LOGICAL FUNCTION COMP(OP1,OP2,LEN) C COMPARES TWO ARRAYS EACH LEN WORDS LONG. INTEGER OP1(1), OP2(1), LEN COMP = .FALSE. DO 10 I=1,LEN 10 IF (OP1(I) .NE. OP2(I)) RETURN COMP = .TRUE. RETURN END SUBROUTINE SACK C SENDS 1HY FOR ACK, 1HN FOR NAK. INTEGER ACK, NAK DATA ACK/1HY/, NAK/1HN/ WRITE (5,10) ACK 10 FORMAT (1H+,A1) RETURN ENTRY SNAK WRITE (5,10) NAK RETURN END SUBROUTINE SENDA C TRANSMITS AN ASCII FILE TO THE VAX. IMPLICIT INTEGER (A-Z) INTEGER LINE(40), UPLINE(200), BLANKS INTEGER LINECT, CHECK DATA BLANKS/5H / READ (5,9901) LINE OPEN (UNIT=1, ACCESS='SEQIN', DIALOG=LINE, ERR=1000) CALL SACK C SYNCHRONIZE WITH VAX 5 READ(5,9902) LINE(1) 9902 FORMAT(A1) IF(LINE(1).EQ.1HZ)GO TO 7 CALL SNAK GO TO 5 7 CALL SACK 10 READ (1,9901,END=200,ERR=200) LINE ! READ THE NEXT LINE. 9901 FORMAT (40A5) CHECK = 0 ! INITIALIZE CHECKSUM. C STRIP TRAILING BLANKS FROM THE LINE. LINECT = 200 DO 20 I = 40,1,-1 IF (LINE(I) .NE. BLANKS) GO TO 30 20 LINECT = LINECT-5 GO TO 70 30 CALL UNPACK(LINECT,LINE,UPLINE) J = LINECT DO 40 I=J,1,-1 IF (UPLINE(I) .NE. "40) GO TO 50 40 LINECT = LINECT-1 GO TO 70 C COMPUTE THE CHECKSUM. 50 DO 60 I=1,LINECT 60 CHECK = CHECK + UPLINE(I) C AND WRITE OUT THE LINE. 70 CALL WRITIT( LINECT, CHECK .AND. "777, UPLINE ) GO TO 10 C WRITE OUT THE TERMINATOR. 200 CALL WRTEND RETURN C SEND THE ERRSNS MESSAGE BACK TO THE VAX. 1000 CALL OPERR RETURN END SUBROUTINE SENDB C TRANSMITS A SYSGEN-FORMATTED BINARY FILE TO THE VAX. IMPLICIT INTEGER(A-Z) INTEGER LINE(6) INTEGER BUFF(1024), TENBUF(256) INTEGER GETFLD INTEGER LINECT, CHECK READ (5,9901) LINE 9901 FORMAT(6A5) OPEN (UNIT=1, ACCESS='SEQIN', DIALOG=LINE, MODE='BINARY', 1 ERR=1000) CALL SACK C SYNCHRONIZE WITH VAX 5 READ(5,9902) LINE(1) 9902 FORMAT(A1) IF(LINE(1).EQ.1HZ) GO TO 7 CALL SNAK GO TO 5 7 CALL SACK 10 READ (1,END=200,ERR=200) LINECT,J READ (1, END=200, ERR=200) (BUFF(J),J=1,LINECT) BUFIDX = 0 CHECK = 0 DO 20 J=1,LINECT DO 30 K=1,4 TENBUF(BUFIDX+K) = GETFLD(BUFF(J), 4*(K-1), 4) .OR. "100 CHECK = CHECK + TENBUF(BUFIDX+K) TENBUF(BUFIDX+K+4) = GETFLD(BUFF(J), 12+4*K, 4) .OR. "100 30 CHECK = CHECK + TENBUF(BUFIDX+K+4) BUFIDX = BUFIDX+8 IF (BUFIDX .LT. 256) GO TO 20 CALL WRITIT( 256, CHECK .AND. "777, TENBUF) CHECK = 0 BUFIDX = 0 20 CONTINUE IF (BUFIDX .NE. 0) CALL WRITIT(BUFIDX, CHECK .AND. "777, TENBUF) GO TO 10 200 CALL WRTEND RETURN 1000 CALL OPERR RETURN END SUBROUTINE WRITIT(COUNT,CHECK,BUFF) INTEGER COUNT, CHECK, BUFF(1) INTEGER YESNO 10 IF (COUNT .EQ. 0) GO TO 20 WRITE (5,9901) COUNT,CHECK,(BUFF(I),I=1,COUNT) 9901 FORMAT (1H+,I4,I3,300R1) GO TO 30 20 WRITE (5,9901) COUNT, CHECK 30 READ (5,9902) YESNO 9902 FORMAT (A1) IF (YESNO .EQ. 1HY) RETURN GO TO 10 END SUBROUTINE WRTEND INTEGER MONE DATA MONE/-1/ 1 WRITE (5,9901) MONE,MONE 9901 FORMAT(1H+,I4,I3) READ (5,9902) YESNO 9902 FORMAT(A1) IF (YESNO .EQ. 1HY) RETURN GO TO 1 END SUBROUTINE GETA IMPLICIT INTEGER(A-Z) INTEGER DSIZE, CHECK, INLINE(256) INTEGER SUM READ (5,9901) (INLINE(I),I=1,10) 9901 FORMAT (10A5) OPEN (UNIT=1,ACCESS='SEQOUT',DIALOG=INLINE,ERR=1000) CALL SACK 10 READ (5,9902,ERR=100) DSIZE, CHECK, (INLINE(I),I=1,DSIZE) 9902 FORMAT (I4,I3,256R1) IF (DSIZE .LT. 0) GO TO 99 ! CHECK FOR EOT. SUM = 0 IF (DSIZE .EQ. 0) GO TO 30 ! SPECIAL CASE EMPTY LINE. DO 20 I=1,DSIZE 20 SUM = SUM + (INLINE(I) .AND. "177) SUM = SUM .AND. "777 30 IF (SUM .NE. CHECK) GO TO 100 IF (DSIZE .EQ. 0) GO TO 40 WRITE (1,9903) (INLINE(I),I=1,DSIZE) 9903 FORMAT (256R1) GO TO 50 40 WRITE (1,9903) 50 CALL SACK GO TO 10 100 CALL SNAK GO TO 10 99 CALL SACK CLOSE (UNIT=1) RETURN 1000 CALL OPERR RETURN END SUBROUTINE GETS RETURN END SUBROUTINE OPERR CALL ERRSNS(I,J) WRITE (5,9901) I,J 9901 FORMAT('+ERROR - ERRSNS NUMBERS ARE: ',I4,I4) RETURN END