Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

How to execute an external batch file from Fortran with SYSTEM / SYSTEMQQ and wait until completion to continue

$
0
0

Hello,

I know there is available in the Intel Fortran Compiler a SYSTEM call or SYSTEMQQ logical function to be used for executing batch processes from CMD. However, the problem is that in either case Fortran does not wait until completion of the batch process.

Below is a sample case:

==============================================

      PROGRAM MAIN
C
C       IMPLICIT NONE
C
      CHARACTER(LEN=8)   :: JOBID
      CHARACTER(LEN=9)   :: DRIVER1
      CHARACTER(LEN=3)   :: DRIVER2
      INTEGER            :: RET
C
      JOBID='''JOB100'''
      DRIVER1='BATCH991('
      DRIVER2=',1)'
      CALL SYSTEM(DRIVER1//JOBID//DRIVER2)
C     
C
      PRINT*,'>>> RUNNING BATCH... >>>'
      PRINT*, CHAR(7)
C
C     continue FORTRAN statements...
C
C
      END PROGRAM MAIN

==============================================

The BATCH991 process takes around of 40 seconds to complete, and the beep sounds instantaneously after printing the RUNNING... message, a clear indication that Fortran is not waiting until completion to continue with the statements. I both tried with CALL SYSTEM, RES=SYSTEM(..) and RES=SYSTEMQQ(), in any case Fortran does not wait until the batch termination.

I really appreciate your help on this issue.

Thanks once again. 


Viewing all articles
Browse latest Browse all 3270

Trending Articles