      SUBROUTINE RECUP2 (LCM,IBUF)
C 
C     * JUL 07/03 - A.IRWIN,F.MAJAESS (REVISED FOR F90 AND LINUX PLATFORMS)
C     * MAR 05/02 - F.MAJAESS- REVISE FOR "CHAR" KIND RECORDS.
C     * DEC 08/95 - F.MAJAESS- REVISE TO HANDLE TRUNCATION > 99.
C     * JUL 23/92 - E.CHAN   - ENSURE THAT DATA IS EXTRACTED FROM IBUF
C     *                        BEGINNING AT WORD 9.
C     * APR  1/92 - J.STACEY - MODIFIED TO RUN ON BOTH 32- AND 64-BIT
C     *                        MACHINES.
C     * JAN 20/83 - R.LAPRISE, J.F.FORTIN.
C     *
C     * IBUF CONTAINS THE IMAGE OF BOTH THE LABEL AND DATA RECORDS.
C     * IBUF (1-8) CONTAINS THE LABEL.
C     * THE DATA IS MOVED TO LCM AND UNPACKED IF NECESSARY. 
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      DIMENSION LCM(*),IBUF(*)
CCRN  INTEGER DECODR
      LOGICAL SF
      COMMON /MACHTYP/ MACHINE,INTSIZE
      DATA LHEAD,NBW/8,64/
C --------------------------------------------------------------------- 
C     * GET LABEL INFORMATION.
C 
      CALL LBLCHK(LEN,NWDS,NPACK,IBUF) 
C 
C     * IF DATA IS NOT PACKED, TRANSFER TO LCM AND RETURN.
C 
      IF (NPACK .NE. 0 .AND. NPACK .NE. 1) GO TO 150
C
C     * NPACK=0: DATA IS STORED IN NATIVE FORMAT.  THIS IS HIGHLY NON-PORTABLE
C     * DATA AND IS USED ONLY FOR TESTING PURPOSES.
C
      IF (NPACK .EQ. 0) THEN
          IF (IBUF(1).EQ.NC4TO8("CHAR")) THEN
           NNWDS=NWDS*MACHINE
          ELSE
           NNWDS=NWDS*INTSIZE
          ENDIF
          DO 100 N=1,NNWDS
  100     LCM(N) = IBUF(8+N)
      END IF
C
C     * NPACK=1: DATA IS STORED IN IEEE 64-BIT FLOATING POINT.
C
      IF (NPACK .EQ. 1) THEN
        IF (IBUF(1).EQ.NC4TO8("LABL").OR.IBUF(1).EQ.NC4TO8("CHAR")) THEN
          IF (IBUF(1).EQ.NC4TO8("CHAR")) THEN
           NNWDS=NWDS*MACHINE
          ELSE
           NNWDS=NWDS*INTSIZE
          ENDIF
          DO 125 N=1,NNWDS
  125     LCM(N) = IBUF(8+N)
        ELSE
          CALL IEEEUP(NWDS,LCM,IBUF(9))
        END IF
      END IF
      RETURN
C 
C     * IF DATA IS PACKED, UNPACK IT INTO LCM.  *** NOTE THAT THE 8-WORD
C     * HEADER IN "IBUF" IS NOW IN NATIVE WORD SIZE. ***
C 
  150 SF = (IBUF(1) .EQ. NC4TO8("SPEC"))
      NPACK = ABS(IBUF(8)) 
      NFW = LHEAD + 2*MACHINE + 1
      IF (SF) NFW = NFW + MACHINE
CCRN  IXMIN = DECODR (IBUF(LHEAD+1))
CCRN  IXSCAL = DECODR (IBUF(LHEAD+2)) 
CCRN  IF (SF) LCM(1) = DECODR (IBUF(LHEAD+3)) 
      CALL DECODR2(IBUF(LHEAD+1),XMIN)
      CALL DECODR2(IBUF(LHEAD+MACHINE+1),XMAX)
      IF (SF) CALL DECODR2(IBUF(LHEAD+2*MACHINE+1),LCM(1))
      NBITS = NBW/MAX(1,NPACK)
      J = 1 
      IF (SF) J = J + INTSIZE 
      IF (SF) NWDS = NWDS-1 
      CALL PACCRN(LCM(J),LCM(J),IBUF(NFW),NWDS,NBITS,XMIN,XMAX,-1)
C 
C     * RESET IMAGINARY PART OF M=0 COMPONENTS TO ZERO. 
C     * THE WAY IT IS DONE ASSUMES THAT AN INTEGER ZERO IS A VALID
C     * FLOATING POINT NUMBER OF VALUE ZERO.
C     *
C     * NOTE: IF MACHINE USES 32-BIT INTEGERS AND 64-BIT REALS THEN EACH
C     * FLOATING POINT VALUE CORRESPONDS TO 2 INTEGERS IN LCM, BOTH
C     * OF WHICH MUST BE SET TO ZERO.
C 
      IF(IBUF(1).NE.NC4TO8("SPEC")) GO TO 210
CBUG  LM2=2*(IBUF(7)/1000)
      IF ( IBUF(7) .LE. 99999 ) THEN
C       * TRUNCATIONS <= 99
        LM2=2*(IBUF(7)/1000)
      ELSE
C       * TRUNCATIONS > 99
        LM2=2*(IBUF(7)/10000)
      ENDIF
      
      DO 200 N=2*INTSIZE,LM2*INTSIZE,2*INTSIZE
      LCM(N-INTSIZE+1) = 0
  200 LCM(N)           = 0
C 
  210 IF(IBUF(1).NE.NC4TO8("FOUR")) GO TO 260
      LM2=2*IBUF(5) 
      LNT=LM2*IBUF(6) 
      DO 250 N=2*INTSIZE,LNT*INTSIZE,LM2*INTSIZE
      LCM(N-INTSIZE+1) = 0
  250 LCM(N)           = 0
C 
  260 CONTINUE
C                                                                                 
      RETURN
C ------------------------------------------------------------
      END
