      SUBROUTINE PKGR2(IXPAK,J,IXROW,LON,NPACK,NLATJ)
C
C     * OCT 12/93 - M.LAZARE. DATA RE-ARRANGED IN S-N PAIRS FOR MODEL
C     *                       OPTIMIZATION.
C     * JUN 01/92 - M.LAZARE. PREVIOUS VERSION PKGR.
C 
C     * PACK "ROW" ARRAY IXROW INTO PACKED ARRAY IXPAK.
C     * THE DATA IN IXPAK MUST BE UNPACKED, SINCE THIS IS OPTIMUM
C     * ANYWAY FOR MODEL EFFICIENCY (PROGRAM UNPAKRS RUN FIRST),
C     * OR ROUTINE ABORTS.
C     * IF NLATJ=1, THE ROUTINE PACKS ONE GRID SLICE AT LATITUDE J 
C     * OF IXROW INTO IXPAK.
C     * FOR NLATJ>1, IT TAKES THE DATA FROM IXROW IN S-N PAIRS FOR
C     * OPTIMUM MODEL PERFORMANCE, I.E. (1,ILAT) FOR NLATJ=2,
C     * (1,ILAT,2,ILAT-1) FOR NLATJ=4, ETC, AND STORES IT INTO
C     * IXPAK IN THE USUAL S-N CONTIGUOUS ORDER.
C     * NLATJ MUST ALWAYS BE EVEN AND DIVIDE ILAT EXACTLY, AS IN
C     * THE PRE-PROCESSOR PROGRAM GCMPAR_.
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)

      DIMENSION IXPAK(1),IXROW(LON)
C
      COMMON /SIZES/  LONSL,ILAT,ILEV,LEVS,LRLMT,ICOORD,LAY,PTOIT,MOIST
C
C     * THE FOLLOWING COMMON BLOCK HOLDS INFORMATION ON THE MACHINE
C     * TYPE (32 OR 64 BIT INTEGERS) AND THE RATIO OF FLOATING POINT
C     * SIZE TO INTEGER SIZE.
C
      COMMON /MACHTYP/ MACHINE,INTSIZE
C---------------------------------------------------------------------
C     * ABORT CONDITIONS.
C
      IF(NPACK.NE.0)                         CALL XIT('PKGR2',-1)
      IF(NLATJ.GT.1 .AND. MOD(NLATJ,2).NE.0) CALL XIT('PKGR2',-2)
C
      IF(NLATJ.EQ.0 .OR. NLATJ.EQ.1)                              THEN
C---------------------------------------------------------------------
C         * NO MULTIPLE LATITUDES.
C         * "N" HOLD THE LOCATION IN NATIVE MACHINE WORD LENGTH OF
C         * THE LAST ELEMENT OF THE PREVIOUS MOST SOUTHERN ROW.
C
          N = (J-1)*LON*INTSIZE
          DO 100 I=1,LON*INTSIZE 
              IXPAK(N+I) = IXROW(I)
  100     CONTINUE  
      ELSE
C---------------------------------------------------------------------
C         * THERE ARE "NLATJ" S-N PAIRS OF MULTIPLE LATITUDES TO BE
C         * TAKEN FROM "IXROW".
C         * "N" HOLD THE LOCATION IN NATIVE MACHINE WORD LENGTH OF
C         * THE LAST ELEMENT OF THE PREVIOUS MOST SOUTHERN ROW.
C         * "NR" HOLDS THE LOCATION IN NATIVE MACHINE WORD LENGTH OF
C         * THE MIRROR IMAGE (ABOUT THE EQUATOR) OF THE LAST ELEMENT
C         * OF THE PREVIOUS MOST NORTHERN ROW.
C
          JSLAST=(J-1)*NLATJ/2
          JNLAST=ILAT-JSLAST-1 
          N=JSLAST*LON*INTSIZE
          NR=JNLAST*LON*INTSIZE
          NI = 0
C
          DO 300 NJ=1,NLATJ/2
              DO 200 I=1,LON*INTSIZE
                  IXPAK(N+I) = IXROW(NI+I)
  200         CONTINUE
              N = N + LON*INTSIZE
              NI=NI + LON*INTSIZE
C
              DO 250 I=1,LON*INTSIZE
                  IXPAK(NR+I) = IXROW(NI+I)
  250         CONTINUE
              NR=NR - LON*INTSIZE
              NI=NI + LON*INTSIZE
  300     CONTINUE
      ENDIF
C
      RETURN
C-----------------------------------------------------------------------
      END 
