Silverfrost Forums

Welcome to our forums

FTN77 to FTN95

11 Sep 2014 6:57 #14613

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
11 Sep 2014 9:36 #14614

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

11 Sep 2014 9:55 #14615

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:

           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?

11 Sep 2014 10:22 #14616

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

E

11 Sep 2014 10:50 #14617

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?

11 Sep 2014 11:08 #14618

Try this:

           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

11 Sep 2014 1:04 #14619

Thanks Ian,

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

            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
11 Sep 2014 3:16 #14620

Mike, use 'exit' instead of 'quit' - that is standard fortran. Wilfried

12 Sep 2014 12:16 #14621

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

or more simply by L = LEN_TRIM (STG)

Please login to reply.