Output in Fortran

Anton Shterenlikht mexas@bristol.ac.uk
Thu Jan 31 14:23:00 GMT 2013


	Date: Thu, 31 Jan 2013 05:40:11 -0800 (PST)
	From: mp22222222222 <mina.pouya@gmail.com>
	To: fortran@gcc.gnu.org
	Subject: Output in Fortran

	Hi everybody, 

	am trying to make an output in a text file in my Fortran VUMAT file. 
	it works well, when by writting the output on the screen : 
	WRITE(*,*)  'Gamma=MVf=', gamma
	but when i want it to write the variable gamma in a text file, the code is
	running well but there is no .txt file produced!
	 
	here is my main loop where i tried to write the output request. 

	 2000 continue
	      call elastic(x,celas,c2,cdach,smises,e,xnu,emoda,
	     & emodm,enua,enum,totstrain,gamma,detrans)
	         OPEN(UNIT=12,FILE="MVolFrac.txt",status='new',ACTION="write")
	         WRITE(12,*)'Gamma=MVf=',gamma

	Does anybody have any idea regarding this problem ?

I would:

1. add IOSTAT to OPEN, and monitor the status, e.g.

  integer :: errstat

  ...

  errstat=0

  ...

  OPEN(UNIT=12,FILE="MVolFrac.txt",status='new',ACTION="write",&
    iostat=errstat)
  if (errstat .ne. 0) stop "could not open the file for writing"

2. double check that the execution actually does reach this
  fragment.

Anton



More information about the Fortran mailing list