Silverfrost Forums

Welcome to our forums

Syntax error using FORMAT statement

24 Sep 2014 7:04 #14692

Hi Group,

I am getting a compiler error when it encounters the following statement:

980   FORMAT('Input : ',a,' =',$,' ',F12.6,' =',$)

The error is reported as:

error 276 - The '$' edit descriptor must be the last item in the list

Is this a general FTN syntax error or is it peculiar to the SilverFrost compiler and if so how should I format this statement please?

Thanks for any assistance.

24 Sep 2014 12:17 #14697

Only one $ per line and as the last item. You are obviously trying to hold the cursor at the end of a prompt line to request input.

This untested example builds a format line to include a text string and prompts for input of a real number. F12.0 on input helps with not having to enter a decimal place.

      Character*30 format1
      character*10 data_out
      real*8 avalue

      data_out='qwertyuiop'

      format1 = '(''Input : '//data_out//' = '',F12.0,$)'

      read(6,fmt=format1)avalue

Hope it helps Ian

24 Sep 2014 12:33 #14698

It's a WATCOM extension, i.e. nonstandard. It's another thing that you won't need in a Windows program!

Eddie

24 Sep 2014 2:30 #14699

Thank you Gents

25 Sep 2014 12:15 #14700

I have found that FTN95 supports both \ and $ as end of line format controllers, but can't find them in FTN95 help. The following example works for Ver 7.10.0 ! program to test \ and $ ! character answer20 integer i ! do i = 1,2 ! write (,1001) 'This is a slash test :' read (,1000) answer ! write (,2001) 'This is a dollar test :' read (*,1000) answer end do 1000 format (a) 1001 format (a\) 2001 format (a$) ! end

25 Sep 2014 5:56 #14703

I have logged this omission.

27 Sep 2014 2:31 #14728

I use:

WRITE (UNIT=*,FMT='(1X,A)',ADVANCE='no') TRIM(cprmpt)//' >  '

where cprompt is a character string.

27 Sep 2014 6:14 #14729

They are almost certainly in the FTN77 documentation. As always, to understand FTN95, you need FT95.CHM, the .ENH file AND the FTN77 documentation!

Eddie

21 Jan 2015 2:38 #15373

This information has now been added to the documentation for the next release.

Please login to reply.