Variable Format Expressions “<” and “>” are supported according to PGI Fortran Reference and can be compiled without any error. But an error occurs when running. My computer is windows XP 64 system, why?
Hi,
Can you provide the example of your code?
Below is the code that I compile and run on Win64.
PGI$ cat a.f
program testme
integer myinteger1
integer j
j=3
myinteger1=1234
write(*,20),myinteger1
20 FORMAT (I<j+3>)
end
PGI$ pgf77 a.f
PGI$ a.exe
1234
PGI$
Are variable format expressions supported on Linux? I’m running
on a 64-bit AMD linux box, using v6.1 “linux86-64” of the Fortran
compiler.
I tried the following program and got a “syntax error” on
the 20 FORMAT (I<j+3>) line when compiling. If I could get
this to work, it might be a very nice solution for my previous
post on “variable length formatting for integers”.
Catherine
PROGRAM FORMATINT
integer, dimension(3) :: myint
integer :: i,j
myint(:) = (/ 99, 999, 9999 /)
do i = 1,3
j= log10(i)
write(*,20) myint(i)
end do
20 FORMAT (I<j+3>)
END PROGRAM FORMATINT
Hi Catherine,
Unfornately, we currently support only pgf77. If possible, please try to modify your program to be f77 for now. We have filed a TPR# 14158 for pgf90 support.
Thank you,
Hongyon
Hi
my code is
character*20 Ctemp
KK2=4800
KK2=ALOG10(REAL(KEND))+1
KK1=9-KK2
do I=1,KK1
write(Ctemp(I:I),‘(A1)’)’ ’
enddo
write(Ctemp(KK1+1:KK1+9),‘(A9)’)“End time[”
KK1=KK1+9
write(Ctemp(KK1+1:KK1+KK2+2),‘(I,A2)’)KEND,“]:”
write(6,‘(A20,$)’)Ctemp
Hi,
I am not sure what you are trying to write. If you want to write ctemp in a loop, for example, in that do loop,
you might want to change to write(*, “(A1)”) ctemp(i:i)
Hongyon