C
C SUBROUTINE 'CCPII2'
C ===================
C
C Copy an array of integers into an array of INTEGER*2 elements. 
C NOTE: No overflow checking is done.
C
C (Must be implemented if ccpbyt function returns .TRUE.)
C
      SUBROUTINE CCPII2(I2,IA,NE,SIGNED,SWAPB)
C
C Parameters
C
C      I2 (O)   Array returning INTEGER*2 data (may be an INTEGER array for 
C               example with data packed into adjacant INTEGER*2 elements
C      IA (I)   Array holding INTEGER values
C      NE (I)   The number of elements to be copied
C  SIGNED (I)   Logical flag =.TRUE.  Copy as signed integer*2 values
C                            =.FALSE. Copy as unsigned integer*2 values
C   SWAPB (I)   Logical flag =.TRUE.  Swap bytes in the integer*2 elements
C                            =.FALSE. Do not swap bytes
C
C ***VAX VERSION***
C
C====== Specification statements
C
      LOGICAL SIGNED, SWAPB
      INTEGER IA(*)
      INTEGER*2 I2(*)
      INTEGER*2 J2(2)
      INTEGER*2 IEIGHT
      EQUIVALENCE (JA,J2(1))
C
C====== Copy data
C
      IEIGHT = 8
      IF (SIGNED) THEN
         DO 10 I=1,NE
            I2(I) = IA(I)
10       CONTINUE
      ELSE
         DO 20 I=1,NE
            JA=IA(I)
            I2(I)=J2(1)
20       CONTINUE
      ENDIF
C
C====== Swap bytes if required
C
      IF (SWAPB) THEN
         DO 30 I = 1,NE
            I2(I) = IOR(IAND(ISHFT(I2(I),-IEIGHT),255),
     +              ISHFT(I2(I),IEIGHT))
30       CONTINUE
      END IF
      RETURN
      END
