View previous topic :: View next topic |
Author |
Message |
mike.smartcam
Joined: 02 Aug 2014 Posts: 40 Location: Lancashire, United Kingdom
|
Posted: Wed Sep 24, 2014 8:04 am Post subject: Syntax error using FORMAT statement |
|
|
Hi Group,
I am getting a compiler error when it encounters the following statement:
Code: | 980 FORMAT('Input : ',a,' =',$,' ',F12.6,' =',$) |
The error is reported as:
Quote: | 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. _________________ Regards
Mike |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Wed Sep 24, 2014 1:17 pm Post subject: |
|
|
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.
Code: |
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 |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Wed Sep 24, 2014 1:33 pm Post subject: |
|
|
It's a WATCOM extension, i.e. nonstandard. It's another thing that you won't need in a Windows program!
Eddie |
|
Back to top |
|
 |
mike.smartcam
Joined: 02 Aug 2014 Posts: 40 Location: Lancashire, United Kingdom
|
Posted: Wed Sep 24, 2014 3:30 pm Post subject: |
|
|
Thank you Gents _________________ Regards
Mike |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Thu Sep 25, 2014 1:15 am Post subject: |
|
|
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 Code: | ! program to test \ and $
!
character answer*20
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 |
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Sep 25, 2014 6:56 am Post subject: |
|
|
I have logged this omission. |
|
Back to top |
|
 |
simon
Joined: 05 Jul 2006 Posts: 299
|
Posted: Sat Sep 27, 2014 3:31 pm Post subject: |
|
|
I use:
Code: | WRITE (UNIT=*,FMT='(1X,A)',ADVANCE='no') TRIM(cprmpt)//' > ' |
where cprompt is a character string. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Sat Sep 27, 2014 7:14 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Jan 21, 2015 3:38 pm Post subject: |
|
|
This information has now been added to the documentation for the next release. |
|
Back to top |
|
 |
|