C
C	CONVERT.FOR
C
	BYTE FNAME(30)
	DIMENSION ICV(400)
	LOGICAL*1 JBUF(128)
C
	DO 100 I=1,377
100	ICV(I)=-1
C
	CALL ASSIGN(1,'EBCDIC.FIX',10)
	CALL FDBSET(1,'READONLY')
200	READ(1,1000,END=300) IDEC,IEBC
1000	FORMAT(I3,34X,I3)
C	WRITE(5,6000) IEBC,IDEC
C6000	FORMAT(' ICV(',I3,') = ',I3)
	ICV(IEBC)=IDEC
	GOTO 200
300	CALL CLOSE(1)
C
	WRITE(5,7000)
7000	FORMAT('$INPUT FILE NAME  ?')
	READ(5,7100) IFN,FNAME
7100	FORMAT(Q,30A1)
	CALL ASSIGN(2,FNAME,IFN)
	WRITE(5,7200)
7200	FORMAT('$OUTPUT FILE NAME ?')
	READ(5,7100) IFN,FNAME
	CALL ASSIGN(3,FNAME,IFN)
C
1800	READ(2,1900,END=5000) LJBUF
1900	FORMAT(1X,I6)
	ILEFT=LJBUF
	IREAD=128
2000	IF(ILEFT.LT.IREAD) IREAD=ILEFT
	READ(2,2100,END=5000) (JBUF(IRJBUF),IRJBUF=1,IREAD)
2100	FORMAT(128A1)
D	WRITE(5,6100) (JBUF(IRJBUF),IRJBUF=1,IREAD)
D6100	FORMAT(8(16(1X,O3),/))
C
	DO 3100 I=1,IREAD
	JJ=JBUF(I).AND.255
	J=ICV(JJ)
C	WRITE(5,6200) I,JBUF(I),JJ,J
C6200	FORMAT(' I,JBUF(I),JJ,J ',I6,6X,O6,6X,I6,6X,I6)
	IF(J.EQ.-1) GOTO 3000
	JBUF(I)=J
	GOTO 3100
3000	JBUF(I)=63
3100	CONTINUE
C
D	WRITE(5,6100) (JBUF(IRJBUF),IRJBUF=1,IREAD)
D	WRITE(5,6300) (JBUF(IRJBUF),IRJBUF=1,IREAD)
D6300	FORMAT(1X,128A1)
	WRITE(3,3200) (JBUF(IRJBUF),IRJBUF=1,IREAD)
3200	FORMAT(1X,128A1)
	ILEFT=ILEFT-IREAD
	IF(ILEFT.GT.0) GOTO 2000
	GOTO 1800
C
5000	CALL CLOSE(2)
	CALL CLOSE(3)
C
	STOP
	END
