SUBROUTINE ASCBCD(NBYTES,ASCII,BCD) C C Routine to convert an ASCII buffer to a BCD buffer C C NBYTES is the number of ASCII bytes input (number of bytes output C is half that) C C Maximum input buffer size is 1000 bytes (therefore max out = 500) C BYTE BCD(500),ASCII(1000),BCDBYT(2) EQUIVALENCE (IWORD,BCDBYT(1)) C DO 10 I=1,NBYTES,2 IWORD = ASCII(I)-'0' JWORD = ASCII(I+1)-'0' IF (IWORD.LT.0.OR.IWORD.GT.9) IWORD = 0 IF (JWORD.LT.0.OR.JWORD.GT.9) JWORD = 0 IWORD = IWORD*16+JWORD J = I/2+1 BCD(J) = BCDBYT(1) D WRITE (5,1) ASCII(I),ASCII(I+1),BCD(J) D1 FORMAT (' Debug ASCBCD - ASCII codes,BCD = ',2A1,' = ',O8, D $ ' (octal)') 10 CONTINUE RETURN END