      SUBROUTINE PUTEND(GGPAK,ILG1,NLAT,KHEM,NPGG,KOUNT,
     1             NF,NAME,LEV,GLL,WRKS)
C 
C     * MAY 29/90 - M.LAZARE. 
C     * UNPACKS A GAUSSIAN GRID IN GGPAK ROW BY ROW FROM THE GCM. 
C     * THE UNPACKED GRID IS THEN PACKED 6:1 AND SAVED ON FILE NF.
C     * THE FIRST POINT IN EACH ROW IS COPIED INTO THE LAST POINT.
C 
C     * NOTE THAT THIS ROUTINE IS ESSENTIALLY EQUIVILENT TO "PUTGGB"
C     * EXCEPT THAT THE FIELD IS PACKED AFTER. IT IS USED TO SAVE 
C     * PACKED TENDENCIES FOR THE "FIZ" OR "FIZDYN" OPTION ONTO A 
C     * SEPARATE DATASET AND BYPASS THE "PAKGCM_" PROGRAM, THEREBY
C     * AVOIDING PROBLEMS WITH LARGE FILES ASSOCIATED WITH THE
C     * "OUTGCM" DATASET OR THE "GS" FILE.
C 
C     * LEVEL 2,GGPAK,GLL 
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)

      COMMON /ICOM/ IBUF(8),IDAT(1) 
C 
      REAL GGPAK(1),GLL(ILG1,1) 
      REAL WRKS(1)
C---------------------------------------------------------------------
      IGRID=NC4TO8("GRID")
C 
C     * UNPACK NLAT ROWS OF GGPAK INTO GLL THEN WRITE PACKED TO FILE NF.
C 
      ILG=ILG1-1
      MAXX=ILG1*NLAT 
C 
      DO 210 J=1,NLAT 
      CALL UPGR(GLL(1,J),ILG,GGPAK,J,NPGG,WRKS) 
  210 GLL(ILG1,J)=GLL(1,J)
C 
      NPACK=6 
      CALL SETLAB(IBUF,IGRID,KOUNT,NAME,LEV,ILG1,NLAT,KHEM,NPACK) 
      CALL PUTFLD2(NF,GLL,IBUF,MAXX) 
      RETURN
C---------------------------------------------------------------------
      END 
