Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90	(revision 2660)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90	(revision 2661)
@@ -4,7 +4,17 @@
    !! NEMO work space:  define and allocate work-space arrays used in 
    !! all components of NEMO
-   !!=====================================================================
+   !!======================================================================
    !! History :  4.0  !  2011-01  (A Porter)  Original code
    !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   wrk_alloc         : define in memory the work space arrays
+   !!   wrk_in_use, llwrk_in_use, iwrk_in_use, wrk_in_use_xz :
+   !!                       check whether the requested workspace is already used or not
+   !!   wrk_not_released, llwrk_not_released, iwrk_not_released, wrk_not_released_xz : release the workspace
+   !!   print_in_use_list : print out the table holding which workspace arrays are currently marked as in use
+   !!   get_next_arg      : get the next argument
+   !!   wrk_stop          : act as local alternative to ctl_stop
+   !!----------------------------------------------------------------------
    USE par_oce        ! ocean parameters
 
@@ -12,7 +22,7 @@
    PRIVATE
 
-   PUBLIC wrk_alloc   ! routine called in nemogcm module (nemo_init routine)
-   PUBLIC wrk_in_use, llwrk_in_use, iwrk_in_use, wrk_in_use_xz
-   PUBLIC wrk_not_released, llwrk_not_released, iwrk_not_released, wrk_not_released_xz
+   PUBLIC   wrk_alloc   ! function called in nemogcm module (nemo_init routine)
+   PUBLIC   wrk_in_use, llwrk_in_use, iwrk_in_use, wrk_in_use_xz                           ! function called almost everywhere
+   PUBLIC   wrk_not_released, llwrk_not_released, iwrk_not_released, wrk_not_released_xz   ! function called almost everywhere
 
    INTEGER, PARAMETER :: num_1d_wrkspaces  = 27   ! No. of 1D workspace arrays ( MAX(jpi*jpj,jpi*jpk,jpj*jpk) )
@@ -39,5 +49,5 @@
    ! num_Xd_wrkspaces parameter above and to allocate them in wrk_alloc()
 
-   !                                                                    !!**  1D, REAL(wp) workspaces  **
+   !                                                               !!**  1D, REAL(wp) workspaces  **
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)      , TARGET, PUBLIC ::   wrk_1d_1 , wrk_1d_2 , wrk_1d_3 , wrk_1d_4 , wrk_1d_5
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)      , TARGET, PUBLIC ::   wrk_1d_6 , wrk_1d_7 , wrk_1d_8 , wrk_1d_9 , wrk_1d_10
@@ -47,5 +57,5 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)      , TARGET, PUBLIC ::   wrk_1d_26, wrk_1d_27
 
-   !                                                                    !!**  2D, x-y, REAL(wp) workspaces  **
+   !                                                               !!**  2D, x-y, REAL(wp) workspaces  **
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)    , TARGET, PUBLIC ::   wrk_2d_1 , wrk_2d_2 , wrk_2d_3 , wrk_2d_4 , wrk_2d_5
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)    , TARGET, PUBLIC ::   wrk_2d_6 , wrk_2d_7 , wrk_2d_8 , wrk_2d_9 , wrk_2d_10
@@ -56,36 +66,37 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)    , TARGET, PUBLIC ::   wrk_2d_31, wrk_2d_32, wrk_2d_33, wrk_2d_34, wrk_2d_35
 
-   !                                                                    !!**  2D, x-z, REAL(wp) workspaces  **
+   !                                                               !!**  2D, x-z, REAL(wp) workspaces  **
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)            , PUBLIC ::   wrk_xz_1, wrk_xz_2, wrk_xz_3, wrk_xz_4 
    
-   !                                                                    !!**  3D, x-y-z, REAL(wp) workspaces  **
+   !                                                               !!**  3D, x-y-z, REAL(wp) workspaces  **
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  , TARGET, PUBLIC ::   wrk_3d_1 , wrk_3d_2 , wrk_3d_3 , wrk_3d_4 , wrk_3d_5
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  , TARGET, PUBLIC ::   wrk_3d_6 , wrk_3d_7 , wrk_3d_8 , wrk_3d_9 , wrk_3d_10
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  , TARGET, PUBLIC ::   wrk_3d_11, wrk_3d_12, wrk_3d_13, wrk_3d_14, wrk_3d_15
 
-   !                                                                    !!**  4D, x-y-z-tra, REAL(wp) workspaces  **
+   !                                                               !!**  4D, x-y-z-tra, REAL(wp) workspaces  **
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:), TARGET, PUBLIC ::   wrk_4d_1, wrk_4d_2, wrk_4d_3, wrk_4d_4 
 
-
-   LOGICAL , ALLOCATABLE, SAVE, DIMENSION(:,:)            , PUBLIC ::   llwrk_2d_1, llwrk_2d_2, llwrk_2d_3 !: 2D logical workspace
+   !                                                               !!**  2D-3D logical workspace  **
+   LOGICAL , ALLOCATABLE, SAVE, DIMENSION(:,:)            , PUBLIC ::   llwrk_2d_1, llwrk_2d_2, llwrk_2d_3 
    LOGICAL , ALLOCATABLE, SAVE, DIMENSION(:,:,:)  , TARGET, PUBLIC ::   llwrk_3d_1 !: 3D logical workspace
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)            , PUBLIC ::   iwrk_2d_1 !: 2D integer workspace
-
-   LOGICAL, DIMENSION(num_1d_wrkspaces)  :: in_use_1d     !: Flags to track which 1D workspace arrays are in use  
-   LOGICAL, DIMENSION(num_2d_wrkspaces)  :: in_use_2d     !: Flags to track which 2D workspace arrays are in use
-   LOGICAL, DIMENSION(num_3d_wrkspaces)  :: in_use_3d     !: Flags to track which 3D workspace arrays are in use
-   LOGICAL, DIMENSION(num_4d_wrkspaces)  :: in_use_4d     !: Flags to track which 4D workspace arrays are in use
-   LOGICAL, DIMENSION(num_xz_wrkspaces)  :: in_use_xz     !: Flags to track which 2D, xz workspace arrays are in use
-   LOGICAL, DIMENSION(num_2d_lwrkspaces) :: in_use_2dll   !: Flags to track which 2D, logical workspace arrays are in use
-   LOGICAL, DIMENSION(num_3d_lwrkspaces) :: in_use_3dll   !: Flags to track which 3D, logical workspace arrays are in use
-   LOGICAL, DIMENSION(num_2d_iwrkspaces) :: in_use_2di    !: Flags to track which 2D, integer workspace arrays are in use
+   
+   !                                                               !!** 2D integer workspace  **
+   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)            , PUBLIC ::   iwrk_2d_1
+
+   LOGICAL, DIMENSION(num_1d_wrkspaces)  ::   in_use_1d     !: Flags to track which 1D workspace arrays are in use  
+   LOGICAL, DIMENSION(num_2d_wrkspaces)  ::   in_use_2d     !: Flags to track which 2D workspace arrays are in use
+   LOGICAL, DIMENSION(num_3d_wrkspaces)  ::   in_use_3d     !: Flags to track which 3D workspace arrays are in use
+   LOGICAL, DIMENSION(num_4d_wrkspaces)  ::   in_use_4d     !: Flags to track which 4D workspace arrays are in use
+   LOGICAL, DIMENSION(num_xz_wrkspaces)  ::   in_use_xz     !: Flags to track which 2D, xz workspace arrays are in use
+   LOGICAL, DIMENSION(num_2d_lwrkspaces) ::   in_use_2dll   !: Flags to track which 2D, logical workspace arrays are in use
+   LOGICAL, DIMENSION(num_3d_lwrkspaces) ::   in_use_3dll   !: Flags to track which 3D, logical workspace arrays are in use
+   LOGICAL, DIMENSION(num_2d_iwrkspaces) ::   in_use_2di    !: Flags to track which 2D, integer workspace arrays are in use
 
    ! Labels for specifying workspace type in call to print_in_use_list()
-   INTEGER, PARAMETER :: INTEGER_TYPE = 0
-   INTEGER, PARAMETER :: LOGICAL_TYPE = 1
-   INTEGER, PARAMETER :: REAL_TYPE    = 2
-
-   INTEGER :: kumout  ! Local copy of numout unit number for error/warning
-                      ! messages
+   INTEGER, PARAMETER ::   INTEGER_TYPE = 0
+   INTEGER, PARAMETER ::   LOGICAL_TYPE = 1
+   INTEGER, PARAMETER ::   REAL_TYPE    = 2
+
+   INTEGER :: kumout  ! Local copy of numout unit number for error/warning messages
    LOGICAL :: llwp    ! Local copy of lwp - whether we are master PE or not
 
@@ -107,11 +118,10 @@
       !!                work space arrays
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) :: iunit         ! Unit no. to use for error/warning
-                                           ! messages in this module
-      LOGICAL, INTENT(in) :: lwp_arg       ! Value of lwp
-      INTEGER             :: wrk_alloc     ! Return value
-      !
-      INTEGER :: extent_1d     ! Extent to allocate for 1D arrays
-      INTEGER :: ierror(8)     ! local integer
+      INTEGER, INTENT(in) ::   iunit         ! Unit no. to use for error/warning messages in this module
+      LOGICAL, INTENT(in) ::   lwp_arg       ! Value of lwp
+      !
+      INTEGER ::   wrk_alloc   ! Return value
+      INTEGER ::   extent_1d   ! Extent to allocate for 1D arrays
+      INTEGER ::   ierror(8)   ! local integer
       !!----------------------------------------------------------------------
       !
@@ -148,5 +158,5 @@
          &      wrk_1d_21(extent_1d) , wrk_1d_22(extent_1d) , wrk_1d_23(extent_1d) , wrk_1d_24(extent_1d) ,     &
          &      wrk_1d_25(extent_1d) , wrk_1d_26(extent_1d) , wrk_1d_27(extent_1d)                        , STAT=ierror(1) )
-      !
+         !
       ALLOCATE( wrk_2d_1 (jpi,jpj) , wrk_2d_2 (jpi,jpj) , wrk_2d_3 (jpi,jpj) , wrk_2d_4 (jpi,jpj) ,     & 
          &      wrk_2d_5 (jpi,jpj) , wrk_2d_6 (jpi,jpj) , wrk_2d_7 (jpi,jpj) , wrk_2d_8 (jpi,jpj) ,     &
@@ -160,5 +170,5 @@
          &      wrk_2d_31(jpi,jpj) , wrk_2d_32(jpi,jpj) , wrk_2d_33(jpi,jpj) , wrk_2d_34(jpi,jpj) ,     &
          &      wrk_2d_35(jpi,jpj)                                                                , STAT=ierror(2) )
-      !
+         !
       ALLOCATE( wrk_3d_1 (jpi,jpj,jpk) , wrk_3d_2 (jpi,jpj,jpk) , wrk_3d_3 (jpi,jpj,jpk) , wrk_3d_4 (jpi,jpj,jpk) ,     &
          &      wrk_3d_5 (jpi,jpj,jpk) , wrk_3d_6 (jpi,jpj,jpk) , wrk_3d_7 (jpi,jpj,jpk) , wrk_3d_8 (jpi,jpj,jpk) ,     &
@@ -166,18 +176,18 @@
          &      wrk_3d_11(jpi,jpj,jpk) , wrk_3d_12(jpi,jpj,jpk) , wrk_3d_13(jpi,jpj,jpk) , wrk_3d_14(jpi,jpj,jpk) ,     & 
          &      wrk_3d_15(jpi,jpj,jpk)                                                                            , STAT=ierror(3) )
-      !
+         !
       ALLOCATE( wrk_4d_1(jpi,jpj,jpk,jpts) , wrk_4d_2(jpi,jpj,jpk,jpts),     &
          &      wrk_4d_3(jpi,jpj,jpk,jpts) , wrk_4d_4(jpi,jpj,jpk,jpts), STAT=ierror(4) )
-      !
+         !
       ALLOCATE( wrk_xz_1(jpi,jpk) , wrk_xz_2(jpi,jpk) , wrk_xz_3(jpi,jpk) , wrk_xz_4(jpi,jpk) , STAT=ierror(5) )
-      !
+         !
       ALLOCATE( llwrk_2d_1(jpi,jpj) , llwrk_2d_2(jpi,jpj) , llwrk_2d_3(jpi,jpj)               , STAT=ierror(6) )
-      !
+         !
       ALLOCATE( llwrk_3d_1(jpi,jpj,jpk) , STAT=ierror(7) )
-      !
+         !
       ALLOCATE( iwrk_2d_1(jpi,jpj)      , STAT=ierror(8) )
       !
       wrk_alloc = MAXVAL( ierror )
-
+      !
       ! Calling routine, nemo_alloc(), checks for errors and takes 
       ! appropriate action - we just print a warning message
@@ -203,10 +213,10 @@
       !!                .FALSE. otherwise. 
       !!
-      !! ** Method  :   Sets internal flags to signal that requested workspaces
-      !!                are in use.
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kdim        ! Dimensionality of requested workspace(s)
-      INTEGER, INTENT(in) ::   index1      ! Index of first requested workspace
-      INTEGER, OPTIONAL, INTENT(in) ::            index2 , index3 , index4 , index5 , index6 , index7 , index8 , index9, index10
+      !! ** Method  :   Sets internal flags to signal that requested workspaces are in use.
+      !!                key_no_workspace_check defined ==> always return FALSE
+      !!----------------------------------------------------------------------
+      INTEGER          , INTENT(in) ::   kdim        ! Dimensionality of requested workspace(s)
+      INTEGER          , INTENT(in) ::   index1      ! Index of first requested workspace
+      INTEGER, OPTIONAL, INTENT(in) ::             index2 , index3 , index4 , index5 , index6 , index7 , index8 , index9, index10
       INTEGER, OPTIONAL, INTENT(in) ::   index11, index12, index13, index14, index15, index16, index17, index18, index19, index20
       INTEGER, OPTIONAL, INTENT(in) ::   index21, index22, index23, index24, index25, index26, index27
@@ -217,4 +227,6 @@
 
       wrk_in_use = .FALSE.
+      
+#if ! defined   key_no_workspace_check
       iptr    = index1
       iarg    = 1
@@ -287,4 +299,5 @@
          !
       END DO ! end of DO WHILE()
+#endif
       !
     END FUNCTION wrk_in_use
@@ -303,7 +316,7 @@
       !!                are in use.
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kdim     ! Dimensionality of requested workspace(s)
-      INTEGER, INTENT(in) ::   index1   ! Index of first requested workspace
-      INTEGER, OPTIONAL, INTENT(in) :: index2, index3, index4, index5, index6, index7, index8, index9
+      INTEGER          , INTENT(in) ::   kdim     ! Dimensionality of requested workspace(s)
+      INTEGER          , INTENT(in) ::   index1   ! Index of first requested workspace
+      INTEGER, OPTIONAL, INTENT(in) ::   index2, index3, index4, index5, index6, index7, index8, index9
       !
       LOGICAL ::   llwrk_in_use  ! Return value
@@ -312,4 +325,7 @@
       !
       llwrk_in_use = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr      = index1
       iarg      = 1
@@ -356,4 +372,5 @@
          !
       END DO ! while( (.NOT. llwrk_in_use) .AND. iarg <= max_num_wrkspaces)
+#endif
       !
    END FUNCTION llwrk_in_use
@@ -372,13 +389,16 @@
       !!                are in use.
       !!----------------------------------------------------------------------
-      INTEGER          , INTENT(in) :: kdim        ! Dimensionality of requested workspace(s)
-      INTEGER          , INTENT(in) :: index1      ! Index of first requested workspace
+      INTEGER          , INTENT(in) ::   kdim        ! Dimensionality of requested workspace(s)
+      INTEGER          , INTENT(in) ::   index1      ! Index of first requested workspace
       INTEGER, OPTIONAL, INTENT(in) ::   index2, index3, index4, index5, index6, index7
       !
-      LOGICAL             :: iwrk_in_use    ! Return value
-      INTEGER :: iarg, iptr
-      !!----------------------------------------------------------------------
-
+      LOGICAL ::   iwrk_in_use    ! Return value
+      INTEGER ::   iarg, iptr
+      !!----------------------------------------------------------------------
+      !
       iwrk_in_use = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr     = index1
       iarg     = 1
@@ -435,4 +455,5 @@
          !
       END DO ! end of DO WHILE()
+#endif
       !
     END FUNCTION iwrk_in_use
@@ -451,13 +472,16 @@
       !!                are in use.
       !!----------------------------------------------------------------------
-      INTEGER          , INTENT(in) :: index1      ! Index of first requested workspace
-      INTEGER, OPTIONAL, INTENT(in) :: index2, index3, index4, index5, &
-                                       index6, index7, index8, index9
-      ! Local variables
+      INTEGER          , INTENT(in) ::   index1      ! Index of first requested workspace
+      INTEGER, OPTIONAL, INTENT(in) ::   index2, index3, index4, index5
+      INTEGER, OPTIONAL, INTENT(in) ::   index6, index7, index8, index9
+      !
       LOGICAL ::   wrk_in_use_xz   ! Return value
       INTEGER ::   iarg, iptr      ! local integer
       !!----------------------------------------------------------------------
-
+      !
       wrk_in_use_xz = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr       = index1
       iarg       = 1
@@ -465,9 +489,9 @@
       DO WHILE( (.NOT. wrk_in_use_xz) .AND. iarg <= max_num_wrkspaces )
          !
-         IF(iptr > num_xz_wrkspaces)THEN
+         IF(iptr > num_xz_wrkspaces) THEN
             CALL wrk_stop('wrk_in_use_xz - more 2D xz workspace arrays requested than defined in wrk_nemo module')
             wrk_in_use_xz = .TRUE.
             EXIT
-         ELSE IF( in_use_xz(iptr) )THEN
+         ELSE IF( in_use_xz(iptr) ) THEN
             wrk_in_use_xz = .TRUE.
             CALL print_in_use_list(2, REAL_TYPE, in_use_xz) !ARPDBG - bug
@@ -486,4 +510,5 @@
          !
       END DO ! while( (.NOT. wrk_in_use_xz) .AND. iarg <= max_num_wrkspaces)
+#endif
       !
    END FUNCTION wrk_in_use_xz
@@ -502,15 +527,18 @@
       !!                in use.
       !!----------------------------------------------------------------------
-      LOGICAL             :: wrk_not_released ! Return value
-      INTEGER, INTENT(in) :: kdim             ! Dimensionality of workspace(s)
-      INTEGER, INTENT(in) :: index1           ! Index of 1st workspace to release
+      INTEGER          , INTENT(in) ::   kdim             ! Dimensionality of workspace(s)
+      INTEGER          , INTENT(in) ::   index1           ! Index of 1st workspace to release
       INTEGER, OPTIONAL, INTENT(in) ::            index2 , index3 , index4 , index5 , index6 , index7 , index8 , index9 , index10
       INTEGER, OPTIONAL, INTENT(in) ::   index11, index12, index13, index14, index15, index16, index17, index18, index19, index20
       INTEGER, OPTIONAL, INTENT(in) ::   index21, index22, index23, index24, index25, index26, index27
       !
-      INTEGER :: iarg, iptr
-      !!----------------------------------------------------------------------
-
+      LOGICAL ::   wrk_not_released   ! Return value
+      INTEGER ::   iarg, iptr
+      !!----------------------------------------------------------------------
+      !
       wrk_not_released = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr = index1
       iarg = 1
@@ -541,5 +569,5 @@
             !
           ELSEIF( kdim == 4 ) THEN
-            IF(iptr > num_4d_wrkspaces)THEN
+            IF(iptr > num_4d_wrkspaces) THEN
                CALL wrk_stop('wrk_not_released : attempt to release a non-existent 4D workspace array')
                wrk_not_released = .TRUE.
@@ -568,4 +596,5 @@
          !
       END DO ! end of DO WHILE()
+#endif
       !
    END FUNCTION wrk_not_released
@@ -586,4 +615,7 @@
       !
       llwrk_not_released = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr = index1
       iarg = 1
@@ -624,4 +656,5 @@
          !
       END DO ! while (iarg <= max_num_wrkspaces)
+#endif
       !
    END FUNCTION llwrk_not_released
@@ -636,7 +669,7 @@
       !!                no-longer in use.
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kdim             ! Dimensionality of workspace(s)
-      INTEGER, INTENT(in) ::   index1           ! Index of 1st workspace to release
-      INTEGER, OPTIONAL, INTENT(in) :: index2, index3, index4, index5, index6, index7
+      INTEGER          , INTENT(in) ::   kdim             ! Dimensionality of workspace(s)
+      INTEGER          , INTENT(in) ::   index1           ! Index of 1st workspace to release
+      INTEGER, OPTIONAL, INTENT(in) ::   index2, index3, index4, index5, index6, index7
       !
       LOGICAL :: iwrk_not_released   ! Return value
@@ -645,4 +678,7 @@
       !
       iwrk_not_released = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr         = index1
       iarg         = 1
@@ -695,4 +731,5 @@
          !
       END DO ! end of DO WHILE()
+#endif
       !
    END FUNCTION iwrk_not_released
@@ -705,6 +742,6 @@
       !!
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) :: index1           ! Index of 1st workspace to release
-      INTEGER, OPTIONAL, INTENT(in) :: index2, index3, index4, index5, index6, index7, index8, index9
+      INTEGER          , INTENT(in) ::   index1   ! Index of 1st workspace to release
+      INTEGER, OPTIONAL, INTENT(in) ::   index2, index3, index4, index5, index6, index7, index8, index9
       !
       LOGICAL ::   wrk_not_released_xz   ! Return value
@@ -713,4 +750,7 @@
       !
       wrk_not_released_xz = .FALSE.
+      !
+#if ! defined   key_no_workspace_check
+      !
       iptr           = index1
       iarg           = 1
@@ -737,4 +777,5 @@
          !
       END DO ! while (iarg <= max_num_wrkspaces)
+#endif
       !
    END FUNCTION wrk_not_released_xz
@@ -745,5 +786,5 @@
       !!                 *** ROUTINE print_in_use_list ***
       !!
-      !!    Purpose: to print out the table holding which workspace arrays
+      !! ** Purpose:   to print out the table holding which workspace arrays
       !!             are currently marked as in use.
       !!----------------------------------------------------------------------
@@ -819,9 +860,9 @@
       &                     index25, index26, index27 )
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(inout) :: iargidx ! Index of current arg
-      INTEGER, INTENT(inout) :: iargval ! Value of current arg
-      INTEGER, OPTIONAL, INTENT(in) ::            index2 , index3 , index4 , index5 , index6 , index7 , index8 , index9 , index10
-      INTEGER, OPTIONAL, INTENT(in) ::   index11, index12, index13, index14, index15, index16, index17, index18, index19, index20
-      INTEGER, OPTIONAL, INTENT(in) ::   index21, index22, index23, index24, index25, index26, index27
+      INTEGER          , INTENT(inout) ::   iargidx   ! Index of current arg
+      INTEGER          , INTENT(inout) ::   iargval   ! Value of current arg
+      INTEGER, OPTIONAL, INTENT(in   ) ::            index2 , index3 , index4 , index5 , index6 , index7 , index8 , index9 , index10
+      INTEGER, OPTIONAL, INTENT(in   ) ::   index11, index12, index13, index14, index15, index16, index17, index18, index19, index20
+      INTEGER, OPTIONAL, INTENT(in   ) ::   index21, index22, index23, index24, index25, index26, index27
       !!----------------------------------------------------------------------
 
@@ -945,6 +986,6 @@
       !!----------------------------------------------------------------------
       !!               ***  ROUTINE wrk_stop  ***
-      !!    Purpose: to act as local alternative to ctl_stop. Avoids
-      !!             dependency on in_out_manager module.
+      !! ** Purpose :   to act as local alternative to ctl_stop. 
+      !!                Avoids dependency on in_out_manager module.
       !!----------------------------------------------------------------------
       CHARACTER(LEN=*), INTENT(in) :: cmsg
