Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
2 Views

Issues with SYSTEM and SYSTEMQQ

Hi,

A bit off a backstory. We've been recently migrated to SSD in our company. After that fortran code that we have started running very slowly on my computer, my colleagues seem to be fine.

I've tracked the problem down in debugger to various IDUMMY = SYSTEM(command line stuff) calls. Basically whenever this place is reached I have 1-2 second pause before commad executes.

Solutions that have worked for me (i.e. they execute instantly):

deleting files:

either:

OPEN(UNIT=123, FILE='FileName', DISPOSE='DELETE')

CLOSE(UNIT=123)

or

IDUMMY = DELFILESQQ('FileName') !this seems to work just fine

 

Overwriting files:

OPEN(UNIT=123, FILE='FileName', STATUS='REPLACE')

 

Now my only remaining issue is one place where I have to copy a file.

I tried IDUMMY = SYSTEMQQ('copy [path]file1.txt [path]file2.txt') same result as with  IDUMMY = SYSTEMQQ('copy [path]file1.txt [path]file2.txt')

 

So I have two questions:

1) why could would this be happening?

2) any elegant way to copy a file in fortran without a using either SYSTEM or SYSTEMQQ? RENAMEFILEQQ executes instantly, but unfortunatelly also moves the file.

Any help would be aprreciated.

 

P.S. using Parallel Studio XE 2016 Update 3, version 16.0.0062.12

 

0 Kudos
3 Replies
Highlighted
Valued Contributor II
2 Views

program P

program P
   use ISO_FORTRAN_ENV
   implicit none
   integer(INT8), allocatable :: contents(:)
   integer iunit
   integer(INT64) size

   open(newunit=iunit,file='test.txt',status='old',access='stream')
   inquire(iunit,size=size)
   allocate(contents(size))
   read(iunit) contents
   close(iunit)
   open(newunit=iunit,file='copy.txt',status='replace',access='stream')
   write(iunit) contents
   close(iunit)
   deallocate(contents)
end program P

 

0 Kudos
Highlighted
Black Belt
2 Views

I would use the CopyFile

I would use the CopyFile Windows SDK routine. The Miscellaneous\CopyFolder sample, in the Parallel Studio XE samples bundle, demonstrates this. I attached a copy (!) here.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
2 Views

Thanks! This has helped.

Thanks! This has helped.

0 Kudos