#      SUBROUTINE XXCONV( IBUF,KREC)MC_TITLE XXCONV Swap bytes, convert ASCII, for a sector of IRTM-type database.C_ARGUMENTS!	INTEGER*2 IBUF(120)  ![B] Buffer0	INTEGER KREC	     ![I] Number of bytes to swap.GC_DESCRIPTION  The subroutine XXCONV.FOR swaps bytes, converts to ASCIIJC for a buffer of data from a sector of IRTM-type data from tape.  Data on#C tape is in the old VARIAN format.C_CALLS  ASCOFF  B2SWAP  B4SWAP3C_HISTORY  82August06  R.Mehlman  UCLA DEC version.,C          83Feb11 Chain file modifications.C_PAUSE      INTEGER*2 KPTR(5)       DATA KPTR(1) /2/, LS /120/      DO 5 K=1,5$        IF (KREC.LT.KPTR(K)) GO TO 8 5    CONTINUE	      K=6! 8    GO TO (10,20,30,40,50,30),KBC-----File header (special code for chain files - word 13 is "CF") 10   CALL B2SWAP(IBUF,60)&      IF (IBUF(13).EQ.-15418) GO TO 15      CALL ASCOFF(IBUF(61),120)      KPTR(2)=IBUF(22)      KPTR(3)=IBUF(25)      KPTR(4)=IBUF(28)      KPTR(5)=IBUF(6)+1      RETURNC-----Chain file headers. 15   CALL B2SWAP(IBUF(13),3)      CALL ASCOFF(IBUF(13),6)      CALL B2SWAP(IBUF(61),60)      KPTR(2)=2      KPTR(3)=32767      RETURNC-----Record definition (vid).	 20   J=1      DO 25 N=1,15%        CALL ASCOFF(IBUF(J),12)               CALL B2SWAP(IBUF(J+6),2)
 25     J=J+8      RETURNC-----Index or data entry. 30   CALL B2SWAP(IBUF,LS)      RETURN.C-----Orbit entry (leave 21-120 as is for now) 40   CALL B2SWAP(IBUF,20)      RETURNC-----Sequence entry. 50   CALL B2SWAP(IBUF(1),10)      CALL B4SWAP(IBUF(11),1)      CALL B2SWAP(IBUF(13),4)      CALL B4SWAP(IBUF(17),1)      CALL B2SWAP(IBUF(19),42)      CALL ASCOFF(IBUF(61),40)      RETURN	      END#      SUBROUTINE ASCOFF (IBUF,LBUF)HC_TITLE  ASCOFF  Turn off the high order ASCII bit in a character array.C_ARGUMENTS#	LOGICAL*1 IBUF(LBUF)  ![B]  Buffer5	INTEGER LBUF          ![I]    Length of buffer IBUF.EC_DESCRIPTION  The subroutine ASCOFF will turn off a high order ASCIIC bit in a character array.  #C_HISTORY  82Aug06  R.Mehlman  UCLAC_PAUSE      DO 5 I=1,LBUF 5      IBUF(I)=IBUF(I).AND.127      RETURN	      END      SUBROUTINE B2SWAP (A,N)2C_TITLE  B2SWAP  Swap bytes of an INTEGER*2 array.C_ARGUMENTS,	LOGICAL*1 A(1)  ! [B]  Array to be swapped.2	INTEGER N	! [I] Number of bytes to swap in array.@C_DESCRIPTION  The subroutine B2SWAP swaps bytes of an INTEGER*2
C array.  #C_HISTORY  82Aug06  R.Mehlman  UCLAC_PAUSE      LOGICAL*1 T      DO 5 I=1,N
        J=2*I        T=A(J-1)        A(J-1)=A(J) 5      A(J)=T      RETURN	      END      SUBROUTINE B4SWAP (A,N)>C_TITLE  B4SWAP  Swap bytes of an  INTEGER*4 or  REAL*4 array.C_ARGUMENTS+	LOGICAL*1 A(1)  ![B]  Array to be swapped.>	INTEGER N	![I]    Number of bytes to be swapped in the array.NC_DESCRIPTION  The subroutine B4SWAP swaps the high and low order bytes of an  C INTEGER*4 or a REAL*4 array.  #C_HISTORY  82Aug06  R.Mehlman  UCLAC_END      LOGICAL*1 T      DO 5 I=1,N
        J=4*I        T=A(J)        A(J)=A(J-3)        A(J-3)=T        T=A(J-1)        A(J-1)=A(J-2)        A(J-2)=T 5    CONTINUE      RETURN	      END