Index: /IOIPSL/trunk/src/restcom.f90
===================================================================
--- /IOIPSL/trunk/src/restcom.f90	(revision 1523)
+++ /IOIPSL/trunk/src/restcom.f90	(revision 1524)
@@ -49,4 +49,5 @@
   INTEGER,SAVE :: nb_fi = 0
   INTEGER,DIMENSION(max_file,2),SAVE :: netcdf_id = -1
+  CHARACTER(LEN=120),DIMENSION(max_file,2),SAVE :: netcdf_name='NONE'
 !-
 ! Description of the content of the 'in' files and the 'out' files.
@@ -268,4 +269,5 @@
     CALL restopenin (nb_fi,fname,l_rw,iim,jjm,lon,lat,llm,lev,ncfid)
     netcdf_id(nb_fi,1) = ncfid
+    netcdf_name(nb_fi,1) = TRIM(fnamein)
 !---
 !-- 1.3 Extract the time information
@@ -324,6 +326,8 @@
       (nb_fi,fname,iim,jjm,lon,lat,llm,lev,dt,date0,ncfid,domain_id)
     netcdf_id(nb_fi,2) = ncfid
+    netcdf_name(nb_fi,2) = TRIM(fnameout)
   ELSE IF (l_fi.AND.l_fo) THEN
     netcdf_id(nb_fi,2) = netcdf_id(nb_fi,1)
+    netcdf_name(nb_fi,2) = netcdf_name(nb_fi,1)
     varname_out(nb_fi,:) = varname_in(nb_fi,:)
     nbvar_out(nb_fi) = nbvar_in(nb_fi)
@@ -1372,5 +1376,10 @@
   CHARACTER(LEN=80) attname
   INTEGER,DIMENSION(4) :: corner,edge
-!---------------------------------------------------------------------
+  LOGICAL :: l_dbg
+!---------------------------------------------------------------------
+  CALL ipsldbg (old_status=l_dbg)
+!---------------------------------------------------------------------
+  IF (l_dbg) WRITE(ipslout,*) 'RESTGET 0.0 : ',netcdf_name(fid,2),vname_q,iim,jjm,llm,itau,def_beha
+!-
   ncfid = netcdf_id(fid,1)
 !-
@@ -1379,4 +1388,6 @@
 ! 1.0 If the variable is not present then ERROR or filled up
 !     by default values if allowed
+!-
+  IF (l_dbg) WRITE(ipslout,*) 'RESTGET 1.0 : ',vnb
 !-
   IF (vnb < 0) THEN
@@ -1402,4 +1413,5 @@
 !-----
       CALL restdefv (fid,vname_q,iim,jjm,llm,.TRUE.)
+      IF (l_dbg) WRITE(ipslout,*) 'RESTGET 1.1 : ',vnb
 !-----
     ELSE
@@ -1416,4 +1428,5 @@
 !---
     vid = varid_in(fid,vnb)
+    IF (l_dbg) WRITE(ipslout,*) 'RESTGET 2.0 : ',vid
 !---
     nbvar_read(fid) = nbvar_read(fid)+1
@@ -1437,4 +1450,5 @@
  &      str,'is not available in the current file',' ')
     ENDIF
+    IF (l_dbg) WRITE(ipslout,*) 'RESTGET 3.0 : ',index
 !---
 !-- 4.0 Read the data. Note that the variables in the restart files
@@ -1488,4 +1502,5 @@
     iret = NF90_GET_VAR(ncfid,vid,var, &
  &                      start=corner(1:ndim),count=edge(1:ndim))
+    IF (l_dbg) WRITE(ipslout,*) 'RESTGET 4.0 : ',iret
 !---
 !-- 5.0 The variable we have just read is created
@@ -1899,4 +1914,7 @@
   ENDIF
   CALL ioget_calendar (one_year,one_day)
+!-
+! 0.0 show arguments
+  IF (l_dbg) WRITE(ipslout,*) 'RESTPUT 0.0 : ',netcdf_name(fid,2),vname_q,iim,jjm,llm,itau
 !-
 ! 1.0 Check if the variable is already present
@@ -2053,4 +2071,7 @@
   IF (itau_out(fid) >= 0) THEN
     iret = NF90_REDEF(ncfid)
+    IF (l_dbg) THEN
+       WRITE(ipslout,*) 'restdefv 0.0 : REDEF',itau_out(fid)
+    ENDIF
   ENDIF
 !-
@@ -2481,5 +2502,5 @@
       WRITE(ipslout,*) &
         'restclo : Closing specified restart file number :', &
-        fid,netcdf_id(fid,1:2)
+        fid,netcdf_id(fid,1:2),netcdf_name(fid,1:2)
     ENDIF
 !---
@@ -2490,10 +2511,12 @@
         WRITE (n_f,'(I3)') netcdf_id(fid,1)
         CALL ipslerr (2,'restclo', &
-          "Error "//n_e//" in closing file : "//n_f,'',' ')
+          "Error "//n_e//" in closing file : "//n_f,netcdf_name(fid,1),' ')
       ENDIF
       IF (netcdf_id(fid,1) == netcdf_id(fid,2)) THEN
         netcdf_id(fid,2) = -1
+        netcdf_name(fid,2) = 'NONE'
       ENDIF
       netcdf_id(fid,1) = -1
+      netcdf_name(fid,1) = 'NONE'
     ENDIF
 !---
@@ -2504,7 +2527,8 @@
         WRITE (n_f,'(I3)') netcdf_id(fid,2)
         CALL ipslerr (2,'restclo', &
-          "Error "//n_e//" in closing file : "//n_f,'',' ')
+          "Error "//n_e//" in closing file : "//n_f,netcdf_name(fid,2),' ')
       ENDIF
       netcdf_id(fid,2) = -1
+      netcdf_name(fid,2) = 'NONE'
     ENDIF
 !---
@@ -2520,10 +2544,17 @@
           WRITE (n_f,'(I3)') netcdf_id(ifnc,1)
           CALL ipslerr (2,'restclo', &
-            "Error "//n_e//" in closing file : "//n_f,'',' ')
+            "Error "//n_e//" in closing file : "//n_f,netcdf_name(ifnc,1),' ')
+        ENDIF
+        IF (l_dbg) THEN
+           WRITE(ipslout,*) &
+                'restclo : Closing specified restart file number :', &
+                ifnc,netcdf_id(ifnc,1:2),netcdf_name(ifnc,1:2)
         ENDIF
         IF (netcdf_id(ifnc,1) == netcdf_id(ifnc,2)) THEN
           netcdf_id(ifnc,2) = -1
+          netcdf_name(ifnc,2) = 'NONE'
         ENDIF
         netcdf_id(ifnc,1) = -1
+        netcdf_name(ifnc,1) = 'NONE'
       ENDIF
 !-----
@@ -2534,7 +2565,13 @@
           WRITE (n_f,'(I3)') netcdf_id(ifnc,2)
           CALL ipslerr (2,'restclo', &
-            "Error "//n_e//" in closing file : "//n_f,'',' ')
+            "Error "//n_e//" in closing file : "//n_f,netcdf_name(ifnc,2),' ')
+        END IF
+        IF (l_dbg) THEN
+           WRITE(ipslout,*) &
+                'restclo : Closing specified restart file number :', &
+                ifnc,netcdf_id(ifnc,1:2),netcdf_name(ifnc,1:2)
         END IF
         netcdf_id(ifnc,2) = -1
+        netcdf_name(ifnc,2) = 'NONE'
       ENDIF
     ENDDO
