      SUBROUTINE PUTSET2(NF,G,LEV,NLEV,IBUF,MAXPK)
C 
C     * JUL 07/03 - A.IRWIN,F.MAJAESS (REVISED FOR F90 AND LINUX PLATFORMS)
C     * JAN 18/80 - J.D.HENDERSON 
C     * WRITES A SET OF FIELDS TO FILE NF.
C     * G CONTAINS THE SET OF NLEV FIELDS.
C     * LEV(NLEV) = LEVEL VALUES FOR THE LABELS.
C     * ALL LABEL WORDS IN IBUF(1-8) MUST BE PRESET 
C     *  EXCEPT THE LEVEL IN WORD 4.
C     * MAXPK IS THE MAXIMUM LENGTH OF A PACKED FIELD.
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      REAL G(1) 
C 
      INTEGER LEV(NLEV) 
      INTEGER IBUF(9) 
C-------------------------------------------------------------------- 
      NWDS=IBUF(5)*IBUF(6)
      IF(IBUF(1).EQ.NC4TO8("SPEC")) NWDS=NWDS*2
      IF(IBUF(1).EQ.NC4TO8("FOUR")) NWDS=NWDS*2
C 
      DO 210 L=1,NLEV 
      IBUF(4)=LEV(L)
      N=(L-1)*NWDS+1
      CALL RECPK2(IBUF,MAXPK,G(N))
      CALL RECPUT(NF,IBUF)
  210 CONTINUE
C 
      RETURN
      END 
