forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FTN77 to FTN95

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
mike.smartcam



Joined: 02 Aug 2014
Posts: 40
Location: Lancashire, United Kingdom

PostPosted: Thu Sep 11, 2014 7:57 am    Post subject: FTN77 to FTN95 Reply with quote

I am trying to compile a Watcom syntax free FTN77 program using Silverfrost FTN95 but the compiler is objecting to certain parts of the program structure/syntax. Can anyone please advise in the problem and solution, thank you.

[/code
!WATFOR-77 V3.1 Copyright WATCOM Systems Inc. 1984,1989 92/02/27 16:03:32

!Options: list,disk,errorfile,warnings,exe,terminal,check,arraycheck

SUBROUTINE FIND_SOURCE(SOURCE)

IMPLICIT NONE
CHARACTER*60 SOURCE
CHARACTER*200 LN1
INTEGER EXDOS,I

I=EXDOS('SET >TEMPFILE.ZZZ')
IF(I.NE.0)THEN
PRINT*,'ERROR ZTI#1: DOS not responding'
ENDIF

OPEN(1,FILE='TEMPFILE.ZZZ')
LOOP :L1
READ(1,'(A)',END=99)LN1(:80)
IF(LN1(:9).EQ.'AWDE_DIR=')THEN
SOURCE =LN1(10:)
QUIT :L1
ENDIF
ENDLOOP
CLOSE(1,STATUS='DELETE')

RETURN
99 PRINT*,'ERROR ZTI#2: DOS variable "AAA_DIR" not set'
CLOSE(1,STATUS='DELETE')
OPEN(1,FILE='FOPT_RUN.BAT')
CLOSE(1,STATUS='DELETE')
STOP

END
_________________
Regards

Mike
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Sep 11, 2014 10:36 am    Post subject: Reply with quote

Mike,

EXDOS is a library function for Watcom, and it's not a standard function in Fortran (so it isn't Watcom-free). It looks to me that it emits the command SET (without parameters) to the command.com command processor, and pipes the result to a specifically named file. Subsequently you sort out environment variables to find the path to a specific directory. While the environment variables are still accessible in Windows, there are different ways of getting to this information.

In early versions of Windows, this was to put such information in a file of type .INI, which could be located in the main Windows folder, or in the application folder. Later versions of Windows park this information both for the system and the individual applications in something called the registry. The reason for this is that the 'environment' space was always rather restricted

There are equivalents in FTN95, including CISSUE (which is documented in the online help file), but also look in the FTN77 documentation which is available on the Silverfrost website in the FTN95 section, click on documentation).

Eddie

PS Equivalents to EXDOS, that is, and also ways of saving that directory path information in the appropriate place.

E
Back to top
View user's profile Send private message
mike.smartcam



Joined: 02 Aug 2014
Posts: 40
Location: Lancashire, United Kingdom

PostPosted: Thu Sep 11, 2014 10:55 am    Post subject: Reply with quote

Hi Eddie,

I was not aware of the limit set for forum mesaages so the important bit got missed.

I was aware of the the WATCOM dependent stuff but thank you.

Below is a code segment which appears to through syntax problems when compiling:

Code:
           LOOP :L1
               READ(1,'(A)',END=99)LN1(:80)
               IF(LN1(:9).EQ.'AWDE_DIR=')THEN
                   SOURCE =LN1(10:)
                   QUIT :L1
               ENDIF
           ENDLOOP
           CLOSE(1,STATUS='DELETE')
       
           RETURN
99    PRINT*,'ERROR ZTI#2: DOS variable "AWDE_DIR" not set'
           CLOSE(1,STATUS='DELETE')


I get error messages regarding label 99 and a sytax error on the READ line, do you know if this is a version thing please?
_________________
Regards

Mike
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Sep 11, 2014 11:22 am    Post subject: Reply with quote

LOOP looks to me like an extension - not something I ever used. Is the error message to do with that?

E
Back to top
View user's profile Send private message
mike.smartcam



Joined: 02 Aug 2014
Posts: 40
Location: Lancashire, United Kingdom

PostPosted: Thu Sep 11, 2014 11:50 am    Post subject: Reply with quote

Hi Eddie,

The compiler issues the following messages:

error 32 - Statement not recognised LOOP :L1
error 32 - Statement not recognised QUIT :L1
error 20 - Label 99 has not been defined READ(1,'(A)',END=99)LN1(:80)


I think it just does not understand the commands, they do not appear to cause a problem when compiling with the WATCOM system.

Is it possible that they are FTN77 commands only?
Perhaps they are unique to the WATCOM compiler?
_________________
Regards

Mike
Back to top
View user's profile Send private message Send e-mail
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Sep 11, 2014 12:08 pm    Post subject: Reply with quote

Try this:
Code:

           DO
               READ(1,'(A)',END=99)LN1(:80)
               IF(LN1(:9).EQ.'AWDE_DIR=')THEN
                   SOURCE =LN1(10:)
                   EXIT
               ENDIF
           END DO
 


Also, it is better to avoid units 1,2,5,6. Just add 10 to all unit numbers in all open, close, read & write statements. There are many discussions about this in the forum.

The EXDOS command looks as though it may be attempting to determine whether the file exists, try FTN95 function FEXISTS@.
Regards
Ian
Back to top
View user's profile Send private message Send e-mail
mike.smartcam



Joined: 02 Aug 2014
Posts: 40
Location: Lancashire, United Kingdom

PostPosted: Thu Sep 11, 2014 2:04 pm    Post subject: Reply with quote

Thanks Ian,

I assume the following code is creating a compiler error because it does not know the meaning of the command QUIT?

Code:
            L = LEN(STG)
!            LOOP :L1
            DO
                IF(STG(L:L) .NE. ' ')QUIT :L1
                IF(L .EQ. 1)THEN
                    L = 0
                    QUIT :L1
                ENDIF
               L = L - 1
!            ENDLOOP
            END DO

_________________
Regards

Mike
Back to top
View user's profile Send private message Send e-mail
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu Sep 11, 2014 4:16 pm    Post subject: Reply with quote

Mike,
use "exit" instead of "quit" - that is standard fortran.
Wilfried
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri Sep 12, 2014 1:16 am    Post subject: Reply with quote

you could replace your loop by
Code:
            DO L = Len(STG),1,-1
                IF (STG(L:L) .NE. ' ') EXIT
            END DO

or more simply by
Code:
      L = LEN_TRIM (STG)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group