Index: trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90	(revision 1271)
+++ trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90	(revision 1488)
@@ -48,16 +48,18 @@
       !! ** Purpose :  open an input file with IOIPSL (only fliocom module)
       !!---------------------------------------------------------------------
-      CHARACTER(len=*)       , INTENT(inout)           ::   cdname    ! File name
-      INTEGER                , INTENT(  out)           ::   kiomid    ! ioipsl identifier of the opened file
-      LOGICAL                , INTENT(in   )           ::   ldwrt     ! read or write the file?
-      LOGICAL                , INTENT(in   )           ::   ldok      ! check the existence 
-      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar   ! domain parameters: 
-
-      CHARACTER(LEN=100) ::   clinfo     ! info character
-      INTEGER            ::   iln        ! lengths of character
-      INTEGER            ::   istop      ! temporary storage of nstop
-      INTEGER            ::   ifliodom   ! model domain identifier (see flio_dom_set)
-      INTEGER            ::   ioipslid   ! ioipsl identifier of the opened file
-      INTEGER            ::   jl         ! loop variable
+      CHARACTER(len=*)       , INTENT(inout)           ::   cdname      ! File name
+      INTEGER                , INTENT(  out)           ::   kiomid      ! ioipsl identifier of the opened file
+      LOGICAL                , INTENT(in   )           ::   ldwrt       ! read or write the file?
+      LOGICAL                , INTENT(in   )           ::   ldok        ! check the existence 
+      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters: 
+
+      CHARACTER(LEN=100) ::   clinfo      ! info character
+      CHARACTER(LEN=10 ) ::   clstatus    ! status of opened file (REPLACE or NEW)
+      INTEGER            ::   iln         ! lengths of character
+      INTEGER            ::   istop       ! temporary storage of nstop
+      INTEGER            ::   ifliodom    ! model domain identifier (see flio_dom_set)
+      INTEGER            ::   ioipslid    ! ioipsl identifier of the opened file
+      INTEGER            ::   jl          ! loop variable
+      LOGICAL            ::   llclobber   ! local definition of ln_clobber
       !---------------------------------------------------------------------
 
@@ -65,5 +67,6 @@
       istop = nstop
       !
-      IF( ldok ) THEN      ! Open existing file...
+      llclobber = ldwrt .AND. ln_clobber
+      IF( ldok .AND. .NOT. llclobber ) THEN      ! Open existing file...
          !                 ! =============
          IF( ldwrt ) THEN  ! ... in write mode
@@ -78,4 +81,7 @@
          iln = INDEX( cdname, '.nc' )
          IF( ldwrt ) THEN  ! the file should be open in write mode so we create it...
+            IF( llclobber ) THEN   ;   clstatus = 'REPLACE' 
+            ELSE                   ;   clstatus = 'NEW'
+            ENDIF
             IF( jpnij > 1 ) THEN
                ! define the domain position regarding to the global domain (mainly useful in mpp)
@@ -86,9 +92,9 @@
                IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//cdname(1:iln-1)//'... in WRITE mode'
                CALL fliocrfd( cdname, (/'x'         , 'y'         , 'z', 't'/)   &
-                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid, ifliodom )
+                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid, ifliodom, mode = clstatus )
             ELSE              ! the file should be open for read mode so it must exist...
                IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//cdname//' in WRITE mode'
                CALL fliocrfd( cdname, (/'x'         , 'y'         , 'z', 't'/)   &
-                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid )
+                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid,           mode = clstatus )
             ENDIF
          ELSE              ! the file should be open for read mode so it must exist...
