Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

forced write on unit=6

jfdoyle
Beginner
718 Views
some of my apps take a long time to run so i like to echo some count numbers to the command window using

write(*,'(i5\)' icount

this should write across the command line. after 15 such writes, i do a carriage return using

write(*,'(/a\)) ' @@ '

this works fine with FPS 4.0, but with IVF 10.1, the system waits for the carriage return to write to the screen. i tried flush (6) but to no avail. any suggestions?

i would prefer to write an integer and not put a character.

thanks, james
0 Kudos
6 Replies
DavidWhite
Valued Contributor II
718 Views
Quoting - jfdoyle
some of my apps take a long time to run so i like to echo some count numbers to the command window using

write(*,'(i5)' icount

this should write across the command line. after 15 such writes, i do a carriage return using

write(*,'(/a)) ' @@ '

this works fine with FPS 4.0, but with IVF 10.1, the system waits for the carriage return to write to the screen. i tried flush (6) but to no avail. any suggestions?

i would prefer to write an integer and not put a character.

thanks, james
There are obviously some quote marks missing from your examples, but could you make the 15th write to be
write(*,'(i5)') icount
which would write the last value and then go to the next record.

David
0 Kudos
jfdoyle
Beginner
718 Views
Quoting - David White
There are obviously some quote marks missing from your examples, but could you make the 15th write to be
write(*,'(i5)') icount
which would write the last value and then go to the next record.

David
David:
thanks. you are right about the quotes.
the 15th write is OK because the /a forces the carriage return. it is the 14 writes leading up to it that are not showing on the screen until the carriage return.
james
0 Kudos
jimdempseyatthecove
Honored Contributor III
718 Views
Quoting - jfdoyle
Quoting - David White
There are obviously some quote marks missing from your examples, but could you make the 15th write to be
write(*,'(i5)') icount
which would write the last value and then go to the next record.

David
David:
thanks. you are right about the quotes.
the 15th write is OK because the /a forces the carriage return. it is the 14 writes leading up to it that are not showing on the screen until the carriage return.
james

Try using '$" in place of '' to suppress return/linefeed. Sounds like '' is using a buffered record buffer.

Jim Dempsey
0 Kudos
Steven_L_Intel1
Employee
718 Views
$ and are the same. The key here is that you need to use "Fortran carriage control", which FPS did. This works:

[plain]use ifcore

open (unit=6,form='formatted',carriagecontrol='fortran')
do i=1,10
write (*,'($,I0,"..")') i
call sleepqq(500)
end do
write (*,*) 'Done!'
end[/plain]
The USE IFCORE and call to sleepqq are just to help the demonstration.
0 Kudos
jfdoyle
Beginner
718 Views
$ and are the same. The key here is that you need to use "Fortran carriage control", which FPS did. This works:

[plain]use ifcore

open (unit=6,form='formatted',carriagecontrol='fortran')
do i=1,10
write (*,'($,I0,"..")') i
call sleepqq(500)
end do
write (*,*) 'Done!'
end[/plain]
The USE IFCORE and call to sleepqq are just to help the demonstration.
Steve:
Thanks, i now have things working.
Maybe you can clarify this for me. The following test program

c testc.for
use ifport
inc=2
icarriage=0
nmax=100
write(*,'(/a)') ' @@ '
do icount=1,nmax
if (mod(icount,inc) .eq. 0) then
write(*,'(i5)') icount
icarriage=icarriage+1
if (icarriage .eq. 15) then
write(*,'(/a)') ' @@ '
icarriage=0
endif
endif
call sleepqq(100)
enddo
c
end

works properly when i compile with
ifort testc.for
ifort /fpscomp:ioformat testc.for

but does not work properly when i compile with
ifort /fpscomp:all testc.for
ifort /fpscomp testc.for

i would have thought that :all would include :ioformat

--- james

0 Kudos
Steven_L_Intel1
Employee
718 Views
/fpscomp:ioformat is not the important option here - it's /fpscomp:general. ioformat has no effect on this program.

The difference with "general" and without is the default type of carriage control. Your new program works when the IVF default of CARRIAGECONTROL='LIST' is used but not when 'FORTRAN' is used. Specifying /fpscomp:all or /fpscomp (same as :all) sets "general" which changes the carriage control to 'FORTRAN'. (You can see the effect of this in that the leading space before the @@ is no longer displayed.)

I will admit that I am puzzled that the backslash doesn't work with 'FORTRAN' carriage control, as it is defined based on what is in the first character of the record! I'll have to ask our libraries developers about this.
0 Kudos
Reply