Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 8836)
@@ -258,8 +258,4 @@
            CALL iom_get( numror, 'frc_t', frc_t, ldxios = lrxios )
            CALL iom_get( numror, 'frc_s', frc_s, ldxios = lrxios )
-           IF( ln_linssh ) THEN
-              CALL iom_get( numror, 'frc_wn_t', frc_wn_t, ldxios = lrxios )
-              CALL iom_get( numror, 'frc_wn_s', frc_wn_s, ldxios = lrxios )
-           ENDIF
            CALL iom_get( numror, jpdom_autoglo, 'surf_ini', surf_ini, ldxios = lrxios ) ! ice sheet coupling
            CALL iom_get( numror, jpdom_autoglo, 'ssh_ini', ssh_ini(:,:), ldxios = lrxios )
@@ -270,4 +266,6 @@
               CALL iom_get( numror, jpdom_autoglo, 'ssh_hc_loc_ini', ssh_hc_loc_ini(:,:), ldxios = lrxios )
               CALL iom_get( numror, jpdom_autoglo, 'ssh_sc_loc_ini', ssh_sc_loc_ini(:,:), ldxios = lrxios )
+              CALL iom_get( numror, 'frc_wn_t', frc_wn_t, ldxios = lrxios )
+              CALL iom_get( numror, 'frc_wn_s', frc_wn_s, ldxios = lrxios )
            ENDIF
        ELSE
@@ -312,8 +310,4 @@
         CALL iom_rstput( kt, nitrst, numrow, 'frc_t'   , frc_t, ldxios = lwxios)
         CALL iom_rstput( kt, nitrst, numrow, 'frc_s'   , frc_s, ldxios = lwxios)
-        IF( ln_linssh ) THEN
-           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t, ldxios = lwxios)
-           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s, ldxios = lwxios )
-        ENDIF
         CALL iom_rstput( kt, nitrst, numrow, 'surf_ini', surf_ini, ldxios = lwxios )      ! ice sheet coupling
         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini(:,:), ldxios = lwxios )
@@ -324,4 +318,6 @@
            CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini(:,:), ldxios = lwxios )
            CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini(:,:), ldxios = lwxios )
+           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t, ldxios = lwxios)
+           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s, ldxios = lwxios )
         ENDIF
         !
@@ -373,8 +369,4 @@
         CALL iom_set_rstw_var_active('frc_t')
         CALL iom_set_rstw_var_active('frc_s')
-        IF( ln_linssh ) THEN
-           CALL iom_set_rstw_var_active('frc_wn_t')
-           CALL iom_set_rstw_var_active('frc_wn_s')
-        ENDIF
         CALL iom_set_rstw_var_active('surf_ini')
         CALL iom_set_rstw_var_active('ssh_ini')
@@ -385,4 +377,6 @@
            CALL iom_set_rstw_var_active('ssh_hc_loc_ini')
            CALL iom_set_rstw_var_active('ssh_sc_loc_ini')
+           CALL iom_set_rstw_var_active('frc_wn_t')
+           CALL iom_set_rstw_var_active('frc_wn_s')
         ENDIF
       ENDIF
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 8836)
@@ -347,6 +347,6 @@
                CALL iom_get( numror, 'ndastp', zndastp, ldxios = lrxios )
                ndastp = NINT( zndastp )
-               CALL iom_get( numror, 'adatrj', adatrj, ldxios = lrxios )
-	       CALL iom_get( numror, 'ntime', ktime, ldxios = lrxios )
+               CALL iom_get( numror, 'adatrj', adatrj , ldxios = lrxios )
+	       CALL iom_get( numror, 'ntime' , ktime  , ldxios = lrxios )
 	       nn_time0=INT(ktime)
                ! calculate start time in hours and minutes
@@ -408,8 +408,8 @@
          ! calendar control
          IF( lwxios ) CALL iom_swap(      cwxios_context          )
-         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp), ldxios = lwxios )   ! time-step
-         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp), ldxios = lwxios )   ! date
-         CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj, ldxios = lwxios            )   ! number of elapsed days since
-         !                                                                     ! the begining of the run [s]
+         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)  , ldxios = lwxios )   ! time-step
+         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)  , ldxios = lwxios )   ! date
+         CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj             , ldxios = lwxios            )   ! number of elapsed days since
+         !                                                                                                   ! the begining of the run [s]
 	 CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, wp), ldxios = lwxios ) ! time
          IF( lwxios ) CALL iom_swap(      cxios_context          )
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 8836)
@@ -79,5 +79,5 @@
       INTEGER ::   iconf = 0    ! local integers
       CHARACTER (len=64) ::   cform = "(A12, 3(A13, I7))" 
-      CHARACTER (len=*), INTENT(IN) :: cdstr                  ! model  
+      CHARACTER (len=*), INTENT(IN) :: cdstr                  ! model: NEMO or SAS. Determines core restart variables
       INTEGER , DIMENSION(jpi,jpj) ::   ik_top , ik_bot       ! top and bottom ocean level
       REAL(wp), DIMENSION(jpi,jpj) ::   z1_hu_0, z1_hv_0
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 8836)
@@ -41,5 +41,4 @@
    USE dianam          ! build name of file
    USE xios
-   USE iom_def, ONLY : max_rst_fields, rst_rfields, rst_wfields, RST_FIELD
 # endif
    USE ioipsl, ONLY :  ju2ymds    ! for calendar
@@ -211,16 +210,16 @@
       IF( TRIM(cdname) == TRIM(crxios_context) ) THEN
 !set names of the fields in restart file IF using XIOS to read data
-       CALL iom_set_rst_context()
-       CALL iom_set_rst_vars(rst_rfields)
+          CALL iom_set_rst_context()
+          CALL iom_set_rst_vars(rst_rfields)
 !set which fields are to be read from restart file
-       CALL iom_set_rstr_active()
+          CALL iom_set_rstr_active()
       ELSE IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN
 !set names of the fields in restart file IF using XIOS to write data
-       CALL iom_set_rst_context()
-       CALL iom_set_rst_vars(rst_wfields)
+          CALL iom_set_rst_context()
+          CALL iom_set_rst_vars(rst_wfields)
 !set which fields are to be read from restart file
-       CALL iom_set_rstw_active(fname)
+          CALL iom_set_rstw_active(fname)
       ELSE
-       CALL set_xmlatt
+          CALL set_xmlatt
       ENDIF
 
@@ -239,4 +238,9 @@
 
    SUBROUTINE iom_set_rstw_var_active(field)
+      !!---------------------------------------------------------------------
+      !!                   ***  SUBROUTINE  iom_set_rstw_var_active  ***
+      !!
+      !! ** Purpose :  enable variable in restart file when writing with XIOS 
+      !!---------------------------------------------------------------------
    CHARACTER(len = *), INTENT(IN) :: field
    INTEGER :: i
@@ -264,4 +268,11 @@
 
    SUBROUTINE iom_set_rstr_active()
+      !!---------------------------------------------------------------------
+      !!                   ***  SUBROUTINE  iom_set_rstr_active  ***
+      !!
+      !! ** Purpose :  define file name in XIOS context for reading restart file,
+      !!               enable variables present in restart file for reading with XIOS 
+      !!---------------------------------------------------------------------
+
 !sets enabled = .TRUE. for each field in restart file
    CHARACTER(len=256) :: rst_file
@@ -286,5 +297,5 @@
              par_access="collective", enabled=.TRUE., mode="read",                 &
              output_freq=xios_timestep)
-!defin files for restart context
+!define variables for restart context
         DO i = 1, max_rst_fields
          IF( TRIM(rst_rfields(i)%vname) /= "NO_NAME") THEN
@@ -312,5 +323,10 @@
 
    SUBROUTINE iom_set_rstw_core(cdmdl)
-   CHARACTER (len=*), INTENT (IN) :: cdmdl
+      !!---------------------------------------------------------------------
+      !!                   ***  SUBROUTINE  iom_set_rstw_core  ***
+      !!
+      !! ** Purpose :  set variables which are always in restart file 
+      !!---------------------------------------------------------------------
+   CHARACTER (len=*), INTENT (IN) :: cdmdl ! model OPA or SAS
    
    IF(cdmdl == "OPA") THEN
@@ -350,6 +366,13 @@
 
    SUBROUTINE iom_set_rst_vars(fields)
-!set names for variables in restart file
+      !!---------------------------------------------------------------------
+      !!                   ***  SUBROUTINE  iom_set_rstr_active  ***
+      !!
+      !! ** Purpose :  Fill array fields with the information about all 
+      !!               possible variables and corresponding grids definition 
+      !!               for reading/writing restart with XIOS
+      !!---------------------------------------------------------------------
    TYPE(RST_FIELD), INTENT(INOUT) :: fields(max_rst_fields)
+
    INTEGER :: i
         i = 0
@@ -460,4 +483,10 @@
 
    SUBROUTINE iom_set_rstw_active(cdrst_file)
+      !!---------------------------------------------------------------------
+      !!                   ***  SUBROUTINE  iom_set_rstr_active  ***
+      !!
+      !! ** Purpose :  define file name in XIOS context for writing restart
+      !!               enable variables present in restart file for writing
+      !!---------------------------------------------------------------------
 !sets enabled = .TRUE. for each field in restart file
    CHARACTER(len=*) :: cdrst_file
@@ -507,4 +536,11 @@
 
    SUBROUTINE iom_set_rst_context( ) 
+     !!---------------------------------------------------------------------
+      !!                   ***  SUBROUTINE  iom_set_rstr_active  ***
+      !!
+      !! ** Purpose : Define domain, axis and grid for restart (read/write) 
+      !!              context 
+      !!               
+      !!---------------------------------------------------------------------
 #if defined key_iomput
    TYPE(xios_domaingroup)            :: domaingroup_hdl 
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90	(revision 8836)
@@ -76,5 +76,5 @@
    END TYPE file_descriptor
    TYPE(file_descriptor), DIMENSION(jpmax_files), PUBLIC ::   iom_file !: array containing the info for all opened files
-   INTEGER, PARAMETER, PUBLIC                   :: max_rst_fields = 95  
+   INTEGER, PARAMETER, PUBLIC                   :: max_rst_fields = 95 !: maximum number of restart variables defined in iom_set_rst_vars
    TYPE, PUBLIC :: RST_FIELD  
     CHARACTER(len=30) :: vname = "NO_NAME" ! names of variables in restart file
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 8836)
@@ -219,15 +219,15 @@
          IF(.NOT.lxios_set) lrxios = lrxios.AND.lxios_sini
          IF( lrxios) THEN
-           crxios_context = 'nemo_rst'
-         if(.NOT.lxios_set) then
-             IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS'
+             crxios_context = 'nemo_rst'
+             IF( .NOT.lxios_set ) THEN
+                 IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS'
+                 CALL iom_init( crxios_context )
+                 lxios_set = .TRUE.
+             ENDIF
+         ENDIF
+         IF( TRIM(Agrif_CFixed()) /= '0' .AND. lrxios) THEN
              CALL iom_init( crxios_context )
+             IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for AGRIF'
              lxios_set = .TRUE.
-         endif
-         ENDIF
-         IF( TRIM(Agrif_CFixed()) /= '0' .AND. lrxios) THEN
-            CALL iom_init( crxios_context )
-            IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for AGRIF'
-            lxios_set = .TRUE.
          ENDIF 
       ENDIF
@@ -246,7 +246,5 @@
       REAL(wp) ::   zrdt
       INTEGER  ::   jk
-      TYPE(xios_duration):: dtime
-      integer::ni,nj,nk
-      REAL(wp), DIMENSION(jpi, jpj, jpk) :: w3d 
+      REAL(wp), DIMENSION(jpi, jpj, jpk) :: w3d
       !!----------------------------------------------------------------------
 
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 8836)
@@ -65,5 +65,5 @@
       CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
       TYPE(FLD_N)        ::  sn_apr   ! informations about the fields to be read
-      LOGICAL            ::  lrxios ! read restart using XIOS?
+      LOGICAL            ::  lrxios   ! read restart using XIOS?
       !!
       NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90	(revision 8836)
@@ -233,7 +233,7 @@
             IF(lwp) WRITE(numout,*) '~~~~'
             IF( lwxios ) CALL iom_swap(      cwxios_context          )
-               CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:), ldxios = lwxios )
-               CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem), ldxios = lwxios )
-               CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal), ldxios = lwxios )
+                CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:), ldxios = lwxios )
+                CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem), ldxios = lwxios )
+                CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal), ldxios = lwxios )
             IF( lwxios ) CALL iom_swap(      cxios_context          )
          ENDIF
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 8836)
@@ -215,5 +215,4 @@
             CALL iom_get( numror, jpdom_autoglo, 'ssh_m'  , ssh_m, ldxios = lrxios  )    !   "         "    height      (T-point)
             CALL iom_get( numror, jpdom_autoglo, 'e3t_m'  , e3t_m, ldxios = lrxios  )    ! 1st level thickness          (T-point)
-            CALL iom_get( numror, jpdom_autoglo, 'e3t_m', e3t_m, ldxios = lrxios )
             ! fraction of solar net radiation absorbed in 1st T level
             IF( iom_varid( numror, 'frq_m', ldstop = .FALSE. ) > 0 ) THEN
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl_rst.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl_rst.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl_rst.F90	(revision 8836)
@@ -150,18 +150,18 @@
       IF( ln_trdmxl_instant ) THEN 
          !-- Temperature
-         CALL iom_get( inum, jpdom_autoglo, 'tmlbb'           , tmlbb )
-         CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn )
-         CALL iom_get( inum, jpdom_autoglo, 'tmlatfb'         , tmlatfb )
+         CALL iom_get( inum, jpdom_autoglo, 'tmlbb'           , tmlbb          )
+         CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn          )
+         CALL iom_get( inum, jpdom_autoglo, 'tmlatfb'         , tmlatfb        )
          !
          !-- Salinity
-         CALL iom_get( inum, jpdom_autoglo, 'smlbb'           , smlbb )
-         CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn )
-         CALL iom_get( inum, jpdom_autoglo, 'smlatfb'         , smlatfb )
+         CALL iom_get( inum, jpdom_autoglo, 'smlbb'           , smlbb          )
+         CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn          )
+         CALL iom_get( inum, jpdom_autoglo, 'smlatfb'         , smlatfb        )
       ELSE
-         CALL iom_get( inum, jpdom_autoglo, 'hmxlbn'          , hmxlbn ) ! needed for hmxl_sum
+         CALL iom_get( inum, jpdom_autoglo, 'hmxlbn'          , hmxlbn         ) ! needed for hmxl_sum
          !
          !-- Temperature
-         CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn ) ! needed for tml_sum
-         CALL iom_get( inum, jpdom_autoglo, 'tml_sumb'        , tml_sumb )
+         CALL iom_get( inum, jpdom_autoglo, 'tmlbn'           , tmlbn          ) ! needed for tml_sum
+         CALL iom_get( inum, jpdom_autoglo, 'tml_sumb'        , tml_sumb       )
          DO jk = 1, jpltrd
             IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I1)")   jk
@@ -173,6 +173,6 @@
          !
          !-- Salinity
-         CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn ) ! needed for sml_sum
-         CALL iom_get( inum, jpdom_autoglo, 'sml_sumb'        , sml_sumb )
+         CALL iom_get( inum, jpdom_autoglo, 'smlbn'           , smlbn          ) ! needed for sml_sum
+         CALL iom_get( inum, jpdom_autoglo, 'sml_sumb'        , sml_sumb       )
          DO jk = 1, jpltrd
             IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('smltrd_csum_ub_', I1)")   jk
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 8836)
@@ -815,10 +815,10 @@
       !
       IF( lwxios ) THEN
-        CALL iom_set_rstw_var_active('en')
-        CALL iom_set_rstw_var_active('avt')
-        CALL iom_set_rstw_var_active('avm')
-        CALL iom_set_rstw_var_active('avmu')
-        CALL iom_set_rstw_var_active('avmv')
-        CALL iom_set_rstw_var_active('dissl')
+         CALL iom_set_rstw_var_active('en')
+         CALL iom_set_rstw_var_active('avt')
+         CALL iom_set_rstw_var_active('avm')
+         CALL iom_set_rstw_var_active('avmu')
+         CALL iom_set_rstw_var_active('avmv')
+         CALL iom_set_rstw_var_active('dissl')
       ENDIF
 
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/SAS_SRC/daymod.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/SAS_SRC/daymod.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/SAS_SRC/daymod.F90	(revision 8836)
@@ -30,5 +30,5 @@
    USE in_out_manager ! I/O manager
    USE prtctl         ! Print control
-   USE iom            !
+   USE iom            ! I/O manager
    USE timing         ! Timing
    USE restart        ! restart
@@ -345,6 +345,6 @@
                CALL iom_get( numror, 'ndastp', zndastp, ldxios = lrxios )
                ndastp = NINT( zndastp )
-               CALL iom_get( numror, 'adatrj', adatrj, ldxios = lrxios )
-	       CALL iom_get( numror, 'ntime', ktime, ldxios = lrxios )
+               CALL iom_get( numror, 'adatrj', adatrj , ldxios = lrxios )
+	       CALL iom_get( numror, 'ntime' , ktime  , ldxios = lrxios )
 	       nn_time0=INT(ktime)
                ! calculate start time in hours and minutes
@@ -406,7 +406,7 @@
          ! calendar control
          IF( lwxios ) CALL iom_swap(      cwxios_context          )
-         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp), ldxios = lwxios )   ! time-step
-         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp), ldxios = lwxios )   ! date
-         CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj, ldxios = lwxios            )   ! number of elapsed days since
+         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)  , ldxios = lwxios )   ! time-step
+         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)  , ldxios = lwxios )   ! date
+         CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj             , ldxios = lwxios )   ! number of elapsed days since
          !                                                                     ! the begining of the run [s]
 	 CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, wp), ldxios = lwxios ) ! time
Index: /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90
===================================================================
--- /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 8835)
+++ /branches/2017/dev_r8600_xios_read_write_v2/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 8836)
@@ -41,5 +41,4 @@
    USE xios           ! xIOserver
 #endif
-   USE in_out_manager, ONLY : ln_xios_read, nn_wxios
 
    IMPLICIT NONE
