Silverfrost Forums

Welcome to our forums

FTN77 porting

4 Aug 2014 8:54 #14398

Quote message Hi everyone I am a new member of the forum and looking forward to sharing information with everyone.

I am starting work on translating some FTN77 source code to visual basic .net, whilst I have some experience of Fortran it is not my every day language. In the source code I have seen the following statement:

80 READ 940,STG 81 IF(STG(:1) .EQ. L(40) .OR. STG(:1) .EQ. L(65))THEN 82 T_F = .TRUE. 83 ELSE 84 T_F = .FALSE. 85 ENDIF

Can anyone please tell me what (:1) etc means, thank you for any input

4 Aug 2014 6:50 #14401

I can't understand why you want to do what you are doing, as FTN95 will run your FTN77 code unaltered, and, if you want, generate a .NET program executable.

If your Fortran code has a statement number on every line, it is probably rubbish anyway, and you could do worse than chuck it out and start again from scratch!

E

5 Aug 2014 12:02 #14405

The program was developed many years ago to run with a DOS environment. It was hoped that the source could be used to write a .NET program with a Windows GUI. The source file segment I have posted is the compiler list file the original source does not exist anymore.

If the code can be used with FTN95 and wrapped with a GUI that sounds like a good plan, can you please expand on the approach.

Quoted from LitusSaxonicum I can't understand why you want to do what you are doing, as FTN95 will run your FTN77 code unaltered, and, if you want, generate a .NET program executable.

If your Fortran code has a statement number on every line, it is probably rubbish anyway, and you could do worse than chuck it out and start again from scratch!

E

6 Aug 2014 2:20 #14409

Before you attempt to translate the Fortran program to some other language, you really should have a working copy of the Fortran program, test input data, and the program output as reference.

How long is the program?

Can anyone please tell me what (:1) etc means

If the subscript expression is used with a character type variable, that means 'take the substring defined by the subscript expression'. If the variable is not a character variable, the subscript expression is used to extract a section of the array.

7 Aug 2014 10:19 #14418

The program is about 1000 lines long split into several files. Each program header tells me the following:

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

Reading the source it is clear that the program was designed to run with DOS as it constantly writes batch file to launch .exe files depending on the results from user answers.

I have a working version of the software in the form of .exe program files and the batch files required.

Please see below the smallest source program file for information

WATFOR-77 V3.1 Copyright WATCOM Systems Inc. 1984,1989  92/02/27 15:41:41

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

      1       IMPLICIT NONE
      2       CHARACTER*8,NAME
      3       INTEGER I
        
      4       OPEN(1,FILE='GEN_TEMP.PAR')
      5       READ(1,'(A)')NAME
      6       IF(NAME(8:8).EQ.' ')THEN
      7           I = 7
      8       ELSE
      9           I = 8
     10       ENDIF
        
     11       CLOSE(1)
     12       OPEN(1,FILE='DOC_1.BAT')
     13       WRITE(1,'(A)')'E:'
     14       WRITE(1,'(A)')'CD \\PROG'
     15       WRITE(1,'(A)')'CALL HPGL '//NAME(:I)//'.1LD'
     16       WRITE(1,'(A)')'CALL HPGL '//NAME(:I)//'.1PD'
     17       WRITE(1,'(A)')'CALL PRT '//NAME(:I)//'.PAR'
     18       WRITE(1,'(A)')'CALL PRT '//NAME(:I)//'.MPR'
     19       WRITE(1,'(A)')'CD \\FS'
        
     20       CLOSE(1)
     21       STOP
     22       END
        
        


Compile time:                      00.38  Execution time:              00.00
Size of object code:                 626  Number of extensions:            1
Size of local data area(s):          324  Number of warnings:              0
Size of global data area:              8  Number of errors:                0
Object/Dynamic bytes free:  352432/45530  Statements Executed:             0


I would like if possible to build the .exe files from the available source and check the programs works the same as the working copy.

If you have any advice to assist with:

1) Were to get a compiler from (programs to run in DOS)?
2) Should I remove all the block numbers created from the compiler list?
3) Were the source makes reference to the statment C$INCLUDE E:\\FS\\CLRSCREE.FOR should I create seperate source files to reference the inclusion file.

Thank you for any assistance
[/quote]
7 Aug 2014 12:26 #14419

Quoted from mike.smartcam

I would like if possible to build the .exe files from the available source and check the programs works the same as the working copy.

If you have any advice to assist with:

  1. Were to get a compiler from (programs to run in DOS)?

You may obtain a copy of the Open Watcom Fortran compiler at http://openwatcom.org/index.php/Downloads, and run the compiler in a Windows Command Window, which works almost the same as a DOS console. You may also consider the Silverfrost FTN95 compiler, available at http://silverfrost.com/default.aspx, as it provides much better facilities for error checking and integration with Windows.

(http://openwatcom.org/index.php/Downloads), and run the compiler in a Windows Command Window, which works almost the same as a DOS console. You may also consider the Silverfrost FTN95 compiler, available at http://silverfrost.com/default.aspx, as it provides much better facilities for error checking and integration with Windows.

(http://openwatcom.org/index.php/Downloads), and run the compiler in a Windows Command Window, which works almost the same as a DOS console. You may also consider the Silverfrost FTN95 compiler, available at http://silverfrost.com/default.aspx, as it provides much better facilities for error checking and integration with Windows.

(http://openwatcom.org/index.php/Downloads), and run the compiler in a Windows Command Window, which works almost the same as a DOS console. You may also consider the Silverfrost FTN95 compiler, available at http://silverfrost.com/default.aspx, as it provides much better facilities for error checking and integration with Windows. [quote:edc6bab100]2) Should I remove all the block numbers created from the compiler list?

If you mean the line numbers, yes. Here is a copy of the source code that you posted, ready to compile.

       IMPLICIT NONE
       CHARACTER*8 NAME
       INTEGER I

       OPEN(11,FILE='GEN_TEMP.PAR')
       READ(11,'(A)')NAME
       CLOSE(11)

       OPEN(11,FILE='DOC_1.BAT')
       WRITE(11,'(A)')'E:'
       WRITE(11,'(A)')'CD \\PROG'
       WRITE(11,'(A)')'CALL HPGL '//trim(NAME)//'.1LD'
       WRITE(11,'(A)')'CALL HPGL '//trim(NAME)//'.1PD'
       WRITE(11,'(A)')'CALL PRT '//trim(NAME)//'.PAR'
       WRITE(11,'(A)')'CALL PRT '//trim(NAME)//'.MPR'
       WRITE(11,'(A)')'CD \\FS'
       CLOSE(11)

       STOP
       END

Note that I have used the intrinsic function TRIM to remove trailing blanks from the input file name, and that I have used a unit number of 11 rather than 1 as in your original.

[quote:edc6bab100]3) Where the source makes reference to the statment C$INCLUDE E:\FS\CLRSCREE.FOR should I create separate source files to reference the inclusion file?

The INCLUDE statement has the syntax 'INCLUDE '<>'', where '<>' stands for the name of the file to include. Note that this is a statement starting in column-7 or later, rather than a compiler directive disguised as a comment.

7 Aug 2014 4:36 #14420

Thank for your guidance, I have a couple more question please:

  1. When you refer to a 'windows command window' do you mean the CMD command or something else?

  2. My original intention was to convert the fortran code to visual basic.net or C++ with a modern GUI but with the .net plug-in would you suggest leaving the fortran code in its existing form and binding the solution with Visual Studio?

Thank you once again for your valued information

7 Aug 2014 7:50 #14426

Quoted from mike.smartcam

  1. When you refer to a 'windows command window' do you mean the CMD command or something else? The CMD window.
  1. My original intention was to convert the fortran code to visual basic.net or C++ with a modern GUI but with the .net plug-in would you suggest leaving the fortran code in its existing form and binding the solution with Visual Studio? My point is that you have a choice. Porting a medium to large Fortran program to another language is not a trivial task, and requires that you are well trained in both languages. It is fairly common to see old Fortran code being compiled into a DLL with a well-defined interface, and writing the GUI code in the language of one's choice (including Fortran!) and calling the DLL to do the computational/EDP task for which it was designed.[/quote]
Please login to reply.