


      

      LINE=LINE+1
      WRITE(DATALIN(LINE),6091) helpint(95)
6091  FORMAT('TAB-END',t70,a96)    
      LINE=LINE+1
      WRITE(DATALIN(LINE),6092)  helpint(96)
6092  FORMAT('ENDGEO',t70,a96)    
      
      DO J=1,JT
        LINE=LINE+1
        IF(DELT(J) .EQ. 0  .AND. DELTM(J) .EQ. 0.  .OR.  DELT(J) .GT. 0.) THEN
          WRITE(DATALIN(LINE),6100) DELT(J),HELPTIME(1)
        ELSE
          WRITE(DATALIN(LINE),6101) DELTM(J),HELPTIME(2)  
        ENDIF
6100    FORMAT('DELTA-HR',F12.4,T70,A162)        
6101    FORMAT('DELTA-MN',F12.4,T70,A162)        
        IF(DATENDST(J) .NE. '                '  .AND.  J .GT. 1) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),6102) DATENDST(J),HELPTIME(3)
6102      FORMAT('DATE-END',4X,A16,T70,A162)
        ENDIF
        IF(IITYPE(J) .EQ. 1) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),6103),HELPTIME(4)
6103      FORMAT('Q-ITR',T70,A162)    
        ELSEIF(IITYPE(J) .EQ. 2) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),6104),HELPTIME(5)
6104      FORMAT('QSL-ITR',T70,A162)    
        ELSEIF(IITYPE(J) .EQ. 3) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),6105),HELPTIME(6)
6105      FORMAT('QTM-ITR',T70,A162)    
        ELSEIF(IITYPE(J) .EQ. 4) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),6106),HELPTIME(7)
6106      FORMAT('QSD-ITR',T70,A162)    
        ELSEIF(IITYPE(J) .EQ. 5) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),6107),HELPTIME(8)
6107      FORMAT('QST-ITR',T70,A162)    
        ENDIF
        KH=NHLIN(J)
        KQ=NQLIN(J)
        KE=NELIN(J)
        DO K=1,KH
          LINE=LINE+1
          IF(HLIN1(K,J) .GT. -9000.) THEN
            IF(HCKLIN(K,J) .EQ. 1 ) THEN
              WRITE(DATALIN(LINE),6108) IHLIN(K,J),LAYNUMH(K,J),HLIN(K,J),HLIN1(K,J),(QUALKH(K,J,KK),KK=1,3),HELPTIME(9)          
6108          FORMAT('FL-ELEVI',2I8,2F8.4,3F8.3,T70,A162)    
            ELSE
              WRITE(DATALIN(LINE),6109) IHLIN(K,J),LAYNUMH(K,J),HLIN(K,J),HLIN1(K,J),(QUALKH(K,J,KK),KK=1,3),HELPTIME(10)
6109          FORMAT('CN-ELEVI',2I8,2F8.4,3F8.3,T70,A162)    
            ENDIF
          ELSE
            IF(HCKLIN(K,J) .EQ. 1 ) THEN
              WRITE(DATALIN(LINE),6110) IHLIN(K,J),LAYNUMH(K,J),HLIN(K,J),(QUALKH(K,J,KK),KK=1,3),HELPTIME(11)
6110          FORMAT('FL-ELEVC',2I8,F8.4,3F8.3,T70,A162)    
            ELSE
              WRITE(DATALIN(LINE),6111) IHLIN(K,J),LAYNUMH(K,J),HLIN(K,J),(QUALKH(K,J,KK),KK=1,3),HELPTIME(12)          
6111          FORMAT('CN-ELEVC',2I8,F8.4,3F8.3,T70,A162)    
            ENDIF
          ENDIF
        ENDDO
        
        IF(KHCN(J) .GT. 0) THEN
          DO K=1,KHCN(J)
            L1=MIN(IHCN(K,J),9)
            LINE=LINE+1
            WRITE(DATALIN(LINE),61111) (FHCN(K,J,L),L=1,L1)
61111       FORMAT('HCN',5X,9F8.3)
            IF(IHCN(K,J) .LE. 9) CYCLE 
            L1=MIN(IHCN(K,J),18)
            LINE=LINE+1
            WRITE(DATALIN(LINE),61111) (FHCN(K,J,L),L=10,L1)
            IF(IHCN(K,J) .LE. 18) CYCLE 
            L1=MIN(IHCN(K,J),27)
            LINE=LINE+1
            WRITE(DATALIN(LINE),61111) (FHCN(K,J,L),L=19,L1)
            IF(IHCN(K,J) .LE. 27) CYCLE 
            L1=MIN(IHCN(K,J),36)
            LINE=LINE+1
            WRITE(DATALIN(LINE),61111) (FHCN(K,J,L),L=28,L1)
          ENDDO
        ENDIF    
        
        IF(WVEL(J) .NE. 0.) THEN
          LINE=LINE+1
          WRITE(DATALIN(LINE),61112) WVEL(J),WDIR(J)
61112       FORMAT('GBWIND  ',1X,2F8.3)
        ENDIF    

        DO K=1,KQ
          LINE=LINE+1
          IF(IQLIN1(K,J) .EQ. 1) ALAB='C'
          IF(IQLIN1(K,J) .EQ. 2) ALAB='F'
          IF(IQLIN1(K,J) .EQ. 3) ALAB='H'
          IF(QCKLIN(K,J) .EQ. 0) THEN
            BLAB='CN'
          ELSE
            BLAB='FL'
          ENDIF
          IF(ALAB .EQ. 'C') THEN
            IHP=13
          ELSEIF(ALAB .EQ. 'F') THEN
            IHP=14
          ELSE
            IHP=15
          ENDIF
          WRITE(DATALIN(LINE),6112) BLAB,ALAB,IQLIN(K,J),LAYNUMQ(K,J),QLIN(K,J),QDLIN(K,J),(QUALKQ(K,J,KK),KK=1,3),HELPTIME(IHP)      
6112      FORMAT(A2,'-Q',A1,3X,2I8,2F10.2,3F8.3,T70,A162)          
        ENDDO
        
        DO K=1,KE
          IF(ECKLIN(K,J) .EQ. 1) THEN
            BLAB='FL'
          ELSE
            BLAB='CN'
          ENDIF
          LINE=LINE+1
          IF(IETP(K,J) .EQ. 4) THEN
            WRITE(DATALIN(LINE),6113) BLAB,ELIN(K,J),(QUALKE(K,J,KK),KK=1,3),HELPTIME(16) 
6113        FORMAT(A2,'-RAIN ',F8.4,3F8.3,T70,A162)
          ELSEIF(IETP(K,J) .EQ. 1) THEN
            IF(IELIN(K,J) .GT. 0) THEN  
              IF(ECKLIN1(K,J) .EQ. 1) THEN  
                WRITE(DATALIN(LINE),6116) BLAB,IELIN(K,J),LAYNUME(K,J),ELIN(K,J),(QUALKE(K,J,KK),KK=1,3),HELPTIME(19)
6116            FORMAT(A2,'-ELMET',2I8,F8.4,3F8.3,T70,A162)
              ELSE
                WRITE(DATALIN(LINE),6117) BLAB,IELIN(K,J),LAYNUME(K,J),ELIN(K,J),(QUALKE(K,J,KK),KK=1,3),HELPTIME(20)
6117            FORMAT(A2,'-ELMED',2I8,F8.4,3F8.3,T70,A162)
              ENDIF
            ELSE
              IF(ECKLIN1(K,J) .EQ. 1) THEN  
                WRITE(DATALIN(LINE),6115) BLAB,LAYNUME(K,J),ELIN(K,J),(QUALKE(K,J,KK),KK=1,3),HELPTIME(18)
6115            FORMAT(A2,'-ELMGT',I8,F8.4,3F8.3,T70,A162)
              ELSE
                WRITE(DATALIN(LINE),6114) BLAB,LAYNUME(K,J),ELIN(K,J),(QUALKE(K,J,KK),KK=1,3),HELPTIME(17) 
6114            FORMAT(A2,'-ELMGD',I8,F8.4,3F8.3,T70,A162)
              ENDIF
            ENDIF
          ELSEIF(IETP(K,J) .EQ. 6) THEN
            WRITE(DATALIN(LINE),6118) BLAB,IELIN(K,J),ELIN(K,J),(QUALKE(K,J,KK),KK=1,3),HELPTIME(21)
6118        FORMAT(A2,'-GRAIN',I8,F8.4,3F8.3,T70,A162)
          ENDIF
        ENDDO
        
        IF(NSND(J) .GT. 0) THEN
          DO K=1,NSND(J)
            IF(NODSND(K,J) .GT. 0) THEN
              LINE=LINE+1
              WRITE(DATALIN(LINE),6119) NODSND(K,J),NCODE(K,J),(BCSND(K,J,L),L=1,6)
6119          FORMAT('SN',8X,2I7,2f10.5,4F8.3)            
            ELSE
              LINE=LINE+1
              WRITE(DATALIN(LINE),61191) NCODE(K,J),(BCSND(K,J,L),L=1,6)
61191         FORMAT('SD'15X,I7,2F10.5,4F8.2)       
            ENDIF  
          ENDDO
        ENDIF
        LINE=LINE+1
        WRITE(DATALIN(LINE),6200) 
6200    FORMAT('ENDSTEP')    
        
      ENDDO    
      
      LINE=LINE+1
      WRITE(DATALIN(LINE),6999) 
6999  FORMAT('ENDDATA')
      
      filter="r10 file *.r10|*.R10|"
      IOUT=66

      CALL WSelectFile(Filter,SaveDialog+PromptOn+AppendExt+DirChange,NAMEFL,'Save R10 File for Execution')
      
	  IF (WInfoDialog(ExitButtonCommon).EQ.CommonOpen) THEN
		  go to 500
	  else
        RETURN
      endif

500   CONTINUE
      OPEN(IOUT,FILE=NAMEFL,FORM='FORMATTED')
      DO K=1,LINE
        WRITE(IOUT,'(A230)') DATALIN(K)
      ENDDO
      CLOSE(IOUT)
      RETURN
      END