FORBAS
If you are looking for the best Fortran to Visual
Basic or Qbasic converter then you are in the right place.
View an example See some of the program's capabilities then compare it with others available. You'll see that FORBAS is superior.
View documentation Complete documentation, including limitations.
System requirements, warranty, contact info.
Ordering details Selection, prices, shipping, payments accepted
How to order
Bonus!





Visit Geocities

Counter

Conversion example. Sample Fortran input then Basic outputs listed.
======================== FORTRAN input ============================

       PROGRAM DUMMY
C -- FORTRAN test program for Forbas. This is NOT a working program --
C -- Its sole purpose is to demonstrate the conversion capabilities --
       DIMENSION VV(27), COR(8), Q(5,9)
       CHARACTER FEED*11,RUNNUM*6
       CHARACTER*8 CO(3)
       COMMON DIT(6,2), CUT(15), STAN(13), ASTM(16),
      1 TBP(16), Z(8)
       DATA VV/57.5,196.,226.,271.,330.,340.,364.,16.36,15.23
      1 ,57.0,174.,188.,210.,252.,283.,296.,36.56,8.72
      2 ,9*0.0/
       DATA CO/'ASHLAND','SHELL ','OTHER '/,Z/4*2.0,4*3.1/
C
       open(3,file='example.cfg',status='old')
       READ (3,4,ERR=26) NU,RUNNUM,IST,IEN
4      FORMAT (I4,2X,A6,2X,2I4)
       PRINT 5
5      FORMAT(/,'Demonstration follows.'//)
       WRITE(6,'(1X,I5,E8.2)')L,OU
       DO 8 I=1,3
8      WRITE(1,13) I,CO(I)
13      FORMAT(I3,2X,A8)
       IF (IFLAG)58,59,58
58      WRITE(UNIT=1,FMT=60)
60      FORMAT (/' INPUT ERROR'/)
       WRITE (2,21)(DIT(I,2),I=1,N),COR(2)
21      FORMAT (' C1 ',7X,4F8.3,F11.3)
59      amr=10**amrl
6      READ (1,*,END=999)(ASTM(I),I=1,3), (STAN(I),I=1,3)
       if (feed(1:1).eq.'c'.or.feed(1:1).eq.'C') goto 6
       if (runnum(j+1:j+4).eq.'$END') goto 999
       goto (25,25,26) k+1
25      if(i.lt.0.or.i.gt.9) goto 59
26      CONTINUE
       WRITE(1,888) ((Q(I,J),J=1,9),I=1,5)
888    FORMAT(3X,F6.2:)
999    CLOSE (1)
       CLOSE(UNIT=3,STATUS='DELETE')
       END
       SUBROUTINE IAW ( X1, Y1, X2, Doub )
       INTEGER X1, Y1, X2
       LOGICAL Doub
       CALL TextW ( X1-1,Y1-1, X2+1 )
       CALL TextF ( Doub )
       END
================== VB (default) converted output =================
'----- PROGRAM DUMMY ----- converted to Basic by FORBAS program.
' -- FORTRAN test program for Forbas. This is NOT a working program --
' -- Its sole purpose is to demonstrate thhe conversion capabilities --
OPTION BASE 1
DEFINT I-N
DEFSNG A-H, O-Z
dim VV As variant, COR(8), Q(5,9)
dim FEED as string*11
dim RUNNUM as string*6
dim CO(3) as string*8
public DIT(6,2),CUT(15),STAN(13),ASTM(16),TBP(16),Z(8)
VV = Array(57.5,196.,226.,271.,330.,340.,364.,16.36,15.23 _
,57.0,174.,188.,210.,252.,283.,296.,36.56, 8.72 _
,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0)
CO(1) = "ASHLAND "
CO(2) = "SHELL "
CO(3) = "OTHER "
for i0i= 1 to 4 : Z(i0i)=2.0 : next i0i
for i0i= 5 to 8 : Z(i0i)=3.1 : next i0i
'
open "example.cfg" for input as #3
on error goto 26
input #3, NU,RUNNUM,IST,IEN
on error goto 0
Msgbox CHR$(10)+"Demonstration follows."+CHR$(10)+CHR$(10)
printer.print spc(1);format(L,"#####");format(OU,"#.00E+00")
for I=1 to 3
8 print #1, format(I,"###");spc(2);format(CO(I),"@@@@@@@@")
next I
if IFLAG<0 then goto 58 else if IFLAG=0 then goto 59 else goto 58
58 print #1, CHR$(10);" INPUT ERROR";CHR$(10)
print #2," C1 ";spc(7);: for I=1 to N: print #2,format(DIT(I,2),"####.000");: next I: print #2,format(COR(2),"#######.000")
59 AMR=10^AMRL
6 if eof(1) then goto 999
for I=1 to 3: input #1, ASTM(I): next I
for I=1 to 3: input #1, STAN(I): next I
if (mid$(FEED,1,1) = "c" or mid$(FEED,1,1) = "C") then GOTO 6
if (mid$(RUNNUM,J+1,J+4-(J+1)+1) = "$END") then GOTO 999
select case K+1
case 1: goto 25
case 2: goto 25
case 3: goto 26
end select
25 IF (I < 0 or I > 9) then GOTO 59
26 rem
print #1,spc(3);: for I=1 to 5: for J=1 to 9: print #1,format(Q(I,J),"###.00");: next J: next I: print #1,""
999 close #1
close #3: kill "example.cfg"
END
sub IAW (X1 as integer, Y1 as integer, X2 as integer, DOUB as boolean)
CALL TEXTW ( X1-1, Y1-1, X2+1 )
CALL TEXTF ( DOUB )
end sub

Back to top

FORBAS Fortran to Basic converter program documentation
For revision 1.5. January 3, 2007

FORBAS is the common name for 2 packages available: FB6 and FBsetup. The two versions are working the same way, producing the same output.
FORBAS converts ANSI Fortran-77, with the most common IBM, DEC and HP extensions, to Microsoft Visual Basic (VB) and optionally QuickBasic (QB) compatible code.
The program(s) will do what most other converter programs would skip, like converting computed IF and GOTO, all kind of DATA statements, implied DO loops, FORMATted WRITE, intrinsic functions, etc. Even with the limitations listed below, the program makes over 98% syntactically correct conversions. "6" in FB6 stand for Visual Basic 6.0 and .NET version. The input is a Fortran source file in ASCII (text) form. FBsetup is standalone version, does not require Microsoft Visual Basic to run. The QB option produces DOS Basic code that runs on older PCs (requires Quick Basic 4.5 or higher), by default (without QB selected) the program produce program compatible with VB versions that will run in Windows environment (from 95 on).
If you are an expert in either of the two languages then the program will save you a great deal of time and effort. If you have no knowledge of either language then, if your program falls within the limitations detailed below, you will be able to create a functional equivalent program that will run in a PC or server.
The program produces a LOG file, listing all errors found during conversion. Some warnings in the log file can be ignored because the produced conversion will still be correct. Optionally Basic keywords found in the input file can also be listed in the log file (mostly variable names).
Limitations
The following Fortran statements are not handled: INCLUDE, COMPLEX, VIRTUAL, EQUIVALENCE, BLOCK DATA, BACKSPACE, UNLOCK, ENTRY, SAVE, EXTERNAL, INTRINSIC, ENDFILE, INQUIRE, REWIND. BYTE and LOGICAL are handled as INTEGER in the QB option. Extensions handled:ACCEPT and TYPE are handled as DEC (PDP and VAX Fortran IV) extensions as well as NAME=, TYPE=, READONLY, WRITEONLY, RECORDSIZE= in OPEN statements, all others extensions are ignored. ASSIGN is handled only as assigning a label to a variable, not as a DEC extension.
VS FORTRAN (IBM) extensions handled: Hollerith constants (in FORMAT, etc.), INTEGER*2, INTEGER*4, REAL*4, REAL*8, LOGICAL*1, DO WHILE - END DO, ACTION= in OPEN stmt, PRINT, READ and WRITE asynchronous and list directed, all other extensions are ignored (commented out or producing error). HP extensions handled: DO - ENDDO, ! as comment (only in col.1)
This extended version can handle maximum number of input file lines about 100,000. The program makes the number of lines swell during the run and the output lines are usually more because some Fortran statements can only be duplicated with many Basic lines. That's why the exact maximum lines cannot be determined.
It must be noted that the program converts COMMON items to Public (to DIM Shared in QB) only in the main program, COMMONs are removed from subroutines and functions. DIM is considered as Basic keyword, in Fortran it could be an intrinsic function or variable.
By default the program inherits the output file name from the input file name. For example if the input was C:\forbas\test\TESTER.FTN then the output file will be C:\forbas\test\TESTER.BAS. The LOG file name is created similarly but can be different if so desired. The program assumes the convention of using unit number 6 for output to printer and 5 for input from keyboard, all other unit numbers are assumed to be file input/output. Some installations use 1 instead of 5, you have to check to make sure your I/O is directed to the right device (check the JCL in IBM mainframe for example). File association (open) is sometimes done outside of the Fortran code. In that case you have to insert the appropriate open statement before you can use the output program. If no unit number specified in WRITE then the program converts it to screen output unless formatting characters (tab, spaces, etc.) are present, in that case it is directed to the printer instead.
Input file should be in fixed-form (sorry, no free-form accepted). Statements should start after column 6, however it can handle the DEC extension where a tab character is in place of spaces. Everything beyond column 72 is ignored. A character (except space and 0) in col.6 is considered a continued line. C, c, *, $ or ! in column 1 (first character in the line) are considered as comment line, therefore metacommands like $INCLUDE or $FILES are commented out. The program converts all single quotes ' to double quote ". This can cause problem if you have a " inside single quotes. Some Fortran allows a space after E format spec., e.g. 12.4E 01. Basic will not allow this. Fortran also allows to begin a variable name other than alpha character like $, Basic will give you an error for this (or commented out if line starts with $).
When a two or more dimensioned array values are listed in DATA, Basic may not place the values in the desired array index order. QB output will give a warning in this case because QB uses READ to enter DATA values into variables (VB uses array=). Fortran can allow outputting an array by just typing its name, like
DIMENSION A(30)
DATA A/.../
WRITE (2,3) A
3 FORMAT (30F8.2)
Basic cannot handle it this way, it is the user's responsibility to convert it (to (A(I),I=1,30) in this example). Input lines are converted to all uppercase except those within quotes. Converted Basic statements are in lowercase. The reason is that when you load your Basic program file in Basic (QB or VB) and if the word stays lowercase then you know that the line has a syntax error. Leading spaces removed.
Calls are not checked, it is the user's responsibility. Many of the Fortran library calls have no Basic equivalent. In Fortran a variable is sometimes declared twice (second usually in COMMON). Items changed to Variant type if necessary (for VB) only once. This can cause a duplicate declaration error in Basic. Implied DO loops are converted only in READ or WRITE (where they occur over 90% of the time) In Basic, comment line cannot be in the middle of continued lines, in Fortran it can. If this happened the Basic compiler yields an error. Graphical interface (Form setup) is not included, that is the user's responsibility. The program does not make an executable file, just a code to code conversion. The user need Quick Basic (version 4.5 and up, if QB option selected) or Microsoft Visual Basic to run the created output program or to create an executable file. Implied DO loop limitations: the program can handle up to 2 loops in one line but both have to be one-dimensional, for example,X1,X2,(VAR1(I),I=1,9),Y3,Y4,(VAR2(J),J=K,L),D5 is handled. Also handled two dimensional, e.g. (VAR3(I,J),J=1,5),I=4,10) but combined loops are not handled, e.g. (V(I),B(I),I=1,3).
FORMATs are ignored in READ statements (input). Inputs are list directed in Basic. FORMATs are converted for output. Not handled are $,P,:,\,S,SP,SS,B, BN,BZ,Q specs. Handled: T,X,A.G,E,D,I,L,F. G,E and D are converted to exponential form. L (logical) is converted as integer in QB. The main difference between QB and VB versions is in the output conversion. QB uses print using ... while VB uses format(..). In VB (simple keyboard) input ... causes an error, therefore the program adds a warning that the user should convert it to inputbox(..). Output to unit 6 is converted in VB as printer.print ..., simple WRITE * to MsgBox ...
Variable ASSIGNments to a label are not converted unless referred by in a WRITE. SIGN is changed to sgn but the Fortran function takes 2 parameters, Basic takes only one. User should convert it. MAX and MIN functions with up to 3 arguments are converted. Fortran continued line allows continuing portions of a variable name or a number, Basic prohibits this. In case like that Basic will give an error and the user's responsibility to keep whole numbers and names on either side of continuation.
Whenever the program encounters a statement that knowingly causes syntax error in Basic, it adds ' !!! in front of the line. The user should search the output file for !!! and do something about it otherwise the program will not run similarly to the Fortran program or the compiler will flag an error.
Subroutine and Function parameters generally should be defined as type. The program searches within the routine block for definition and if found it makes the correct "as 'type'" in the parameter line. If the parameter is not defined then the Basic compiler will give an error. The user should insert BYVAL when appropriate, the program cannot determine which parameter is passed as value. Also, Basic don't allow array definition in parameter. The user should remove the number between ( and ) and make the definition elsewhere. For example A(12) should be A() in parameter and DIM A(12) in the block underneath. Basic handles labeling differently. In Fortran the same label can be used in subroutines, Basic gives a "duplicate label" message. When you have DATA/.../ in Fortran subroutines, QB will move them when loading, into the main program. The problem is when you have continued lines; Basic moves only the first ("DATA..") line, the rest stays, giving compiler error.
The program converts substrings, e.g. ST(1:7) but can't handle arrays, e.g. ST(I)(1:9) or partials like ST(1:).
The program sometimes produces long lines, especially when implied DO loop is converted (if the line is too long for Basic then a message in placed in LOG file). The reason for this is to try to cut down on the number of lines so it won't go over the limit. Some statements can only be used within a subroutine or function in Basic. In this case you can make a dummy subroutine of the PROGRAM (main section in Fortran) as "sub main" (add "end sub" at the end, just before the first sub or function).
You can select 4 options before run:
1. Delete predefined DIMs. Variable names starting with I,J,K,L,M,N are defined as integers all others as real (single). If you select this option those references (except arrays) will be removed, for example INTEGER*2 IK,JOLT,NOPE or REAL SINT,DQL,ALMA
2. Consolidating DIMs. By selecting this option, similar declarations will be grouped (except arrays). For example:
dim TT as integer
dim U102 as integer
dim Q22 as integer
Will be like this:
dim TT as integer, U102 as integer, Q22 as integer
3. List reserved Basic words used. This option, if selected, will open the keyword file (KEYS.DAT with QB option, VBKEYS.DAT otherwise) and will list Basic keywords found. The keyword file must be in the same directory as the program. The user should change the keywords listed in LOG file otherwise Basic will give an error.
4. List line numbers. If the option selected, the program will append line numbers at every 10th line as a comment. Adding line number is skipped if the line is too long.

Back to top

System requirements
Minimum system requirements for all packages:
- 486 computer (Pentium or compatible recommended)
- Windows 95 or later operating system.
- VGA display or better
- 1Mb free disk space.
- Visual Basic 6.0
- FBsetup requires ~4Mb free disk space

Warranty
Money back warranty condition: If the program for some reason don't work with your input file then send your input file to us and if we verify it then you will get your money back. Your input file must fulfill the requirements set forth in the documentation
Due to some Fortran statement and function incomparability to Basic and due to installation differences, we can not guarantee identical functionality, however the program is warranted for a year, meaning if you find a bug you will get a bug-free replacement.
We are not satisfied until you satisfied!

Questions can be sent to: mn112@yahoo.com

Back to top

Pricing

Package name Single user price Network ins. price
FB6 $179 $99 $495 $199
FBsetup (standalone) $315 $199 $695 $299

(Corporate) Network installation means multiuser.
Prices are in US dollar and include 6% sales tax in case of NJ order.
Each package contains the FORBAS program, documentation, keyword files + bonus (see below).

Shipping options

- Mail on floppy disk(s). Add $3.00 for shipping.

- Send as attachment to E-mail.


Pay methods

- PayPal. You can pay with credit card or bank account via PayPal. Click PayPal when you ready to pay.
(see How to order below!)
PayPal is now offering a simplified, low cost way to transfer
funds internationally, currently covering many countries (besides US).
List countries to find if your country is included.

- Check (Bank, Co. or personal). Can take up to 2 weeks to clear.

- Money Order.

Back to top

How to order

First select a product from the pricing table (see Ordering Details) then select shipping method and pay method. If (postal) mailing selected then add $3 to the package cost and send your mailing address to mn112@yahoo.com.
If E-mailing selected then send your E-mail address to mn112@yahoo.com. If payment method is check or money order then ask address
If credit card (MC,Visa) is preferred then send the money with PayPal to mn112@yahoo.com. If you don't have PayPal then you can set up an account with them free by going to paypal.com
In any case send a note to mn112@yahoo.com indicating your selection as well as the time and method of payment.

Back to top




BONUS

  Free software is included with order: FIOFC, Fortran I/O File Converter. The program will convert a formatted input or output file produced by Fortran or other program.
When you convert a program from Fortran to Basic, the input file(s) most likely can not be used as is. That's because Fortran uses formatted input while Basic uses list directed input where the items are separated by comma. In Fortran the items need not be separated, for example BlaBla 10.32 3.45123.43 will be inputted perfectly with READ(1,'A6,3F6.2') Bstr,A,B,C. Basic cannot read this, it needs to be changed to "BlaBla",10.32,3.45,123.43 in order to read in correctly with INPUT #1,Bstr,A,B,C.
FIOFC will do the conversion for you. It is a real time saver if you have big input file(s). It is also useful if you want to prepare such file for spreadsheet input (.CSV file).
The program also can handle output file conversion. Older Fortran (Cobol,etc) programs used lineprinter control characters in output files. The most commonly used characters in the first column are 0 (zero) to give an extra line feed and 1 to give a page break. Those are converted (optionally) by FIOFC so the file is printed with a wordprocessor as it was originally intended.

Back to top





Page last modified: 1/3/2007