Index: trunk/LMDZ.COMMON/libf/evolution/pem.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 3571)
+++ trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 3574)
@@ -238,5 +238,5 @@
 real            :: n_myear         ! Maximum number of Martian years of the chained simulations
 real            :: timestep        ! Timestep [s]
-character(20)   :: job_id          ! Job id provided as argument passed on the command line when the program was invoked
+character(100)  :: arg             ! To read command-line arguments program was invoked
 logical         :: timewall        ! Flag to use the time limit stopping criterion in case of a PEM job
 integer(kind=8) :: cr              ! Number of clock ticks per second (count rate)
@@ -293,40 +293,44 @@
 timewall = .true.
 timelimit = 86400 ! 86400 seconds = 24 h by default
-if (command_argument_count() > 0) then
-    ! Read the job id passed as argument to the program
-    call get_command_argument(1,job_id)
-    ! Execute the system command
-    call execute_command_line('squeue -j '//trim(job_id)//' -h --Format TimeLimit > tmp_cmdout.txt',cmdstat = cstat)
-    if (cstat /= 0) then
-        call execute_command_line('qstat -f '//trim(job_id)//' | grep "Walltime" | awk ''{print $3}'' > tmp_cmdout.txt',cmdstat = cstat)
-        if (cstat > 0) then
-            error stop 'pem: command execution failed!'
-        else if (cstat < 0) then
-            error stop 'pem: command execution not supported (neither SLURM nor PBS/TORQUE is installed)!'
-        endif
-    endif
-    ! Read the output
-    open(1,file = 'tmp_cmdout.txt',status = 'old')
-    read(1,'(a)') chtimelimit
-    close(1)
-    chtimelimit = trim(chtimelimit)
-    call execute_command_line('rm tmp_cmdout.txt',cmdstat = cstat)
-    if (cstat > 0) then
-        error stop 'pem: command execution failed!'
-    else if (cstat < 0) then
-        error stop 'pem: command execution not supported!'
-    endif
-    if (index(chtimelimit,'-') > 0) then ! 'chtimelimit' format is "D-HH:MM:SS"
-        read(chtimelimit,'(i1,a1,i2,a1,i2,a1,i2)') days, sep, hours, sep, minutes, sep, seconds
-        timelimit = days*86400 + hours*3600 + minutes*60 + seconds
-    else if (index(chtimelimit,':') > 0 .and. len_trim(chtimelimit) > 5) then ! 'chtimelimit' format is "HH:MM:SS"
-        read(chtimelimit,'(i2,a1,i2,a1,i2)') hours, sep, minutes, sep, seconds
-        timelimit = hours*3600 + minutes*60 + seconds
-    else ! 'chtimelimit' format is "MM:SS"
-        read(chtimelimit,'(i2,a1,i2)') minutes, sep, seconds
-        timelimit = minutes*60 + seconds
-    endif
-else
-    timewall = .false.
+timewall = .false.
+if (command_argument_count() > 0) then ! Get the number of command-line arguments
+    call get_command_argument(1,arg) ! Read the argument given to the program
+    select case (trim(adjustl(arg)))
+        case('version')
+            call print_version_info()
+            stop
+        case default ! This is the job id
+           ! Execute the system command
+            call execute_command_line('squeue -j '//trim(adjustl(arg))//' -h --Format TimeLimit > tmp_cmdout.txt',cmdstat = cstat)
+            if (cstat /= 0) then
+                call execute_command_line('qstat -f '//trim(adjustl(arg))//' | grep "Walltime" | awk ''{print $3}'' > tmp_cmdout.txt',cmdstat = cstat)
+                if (cstat > 0) then
+                    error stop 'pem: command execution failed!'
+                else if (cstat < 0) then
+                    error stop 'pem: command execution not supported (neither SLURM nor PBS/TORQUE is installed)!'
+                endif
+            endif
+            ! Read the output
+            open(1,file = 'tmp_cmdout.txt',status = 'old')
+            read(1,'(a)') chtimelimit
+            close(1)
+            chtimelimit = trim(adjustl(chtimelimit))
+            call execute_command_line('rm tmp_cmdout.txt',cmdstat = cstat)
+            if (cstat > 0) then
+                error stop 'pem: command execution failed!'
+            else if (cstat < 0) then
+                error stop 'pem: command execution not supported!'
+            endif
+            if (index(chtimelimit,'-') > 0) then ! 'chtimelimit' format is "D-HH:MM:SS"
+                read(chtimelimit,'(i1,a1,i2,a1,i2,a1,i2)') days, sep, hours, sep, minutes, sep, seconds
+                timelimit = days*86400 + hours*3600 + minutes*60 + seconds
+            else if (index(chtimelimit,':') > 0 .and. len_trim(chtimelimit) > 5) then ! 'chtimelimit' format is "HH:MM:SS"
+                read(chtimelimit,'(i2,a1,i2,a1,i2)') hours, sep, minutes, sep, seconds
+                timelimit = hours*3600 + minutes*60 + seconds
+            else ! 'chtimelimit' format is "MM:SS"
+                read(chtimelimit,'(i2,a1,i2)') minutes, sep, seconds
+                timelimit = minutes*60 + seconds
+            endif
+    end select
 endif
 
