Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29391 Discussions

Legacy Fortran Program or Subroutine that has embedded SQL code - porting to .NET environment

shelley
Beginner
1,343 Views
We would like to move our application to .NET while reusing legacy Fortran code (on Alpha VMS). We connect to our database in our Fortran code and many Fortran subroutines access our database. Do you have examples of Intel Visual Fortran using legacy subroutines that have embedded SQL in them? What additional code has to be written in order to use the .NET objects that access the database? How does the Intel compiler handle this?
Thank you
Shelley
0 Kudos
7 Replies
Steven_L_Intel1
Employee
1,343 Views
There is (or was) a library called f90SQL which supported SQL calls from Fortran. Unfortunately, the vendor has not yet followed through on their promise to provide a version directly compatible with Intel Visual Fortran. I have read of people taking the Compaq Visual Fortran version and making it work with a small bit of effort, however.

.NET objects can be accessed using the "Fortran Module Wizard" feature which generates Fortran interfaces for .NET assemblies. There is not a lot of documentation on this, though, and you have to understand the interfaces of the .NET object.
0 Kudos
onkelhotte
New Contributor II
1,343 Views

I just received an email fromCanaima Software employee Nick Vogel.

They are working on an update to make f90sql compatible with IVF9. He also mentioned, that Intel has a fix which will be released next week.

But I got my version to work with IVF9 already...
Markus
0 Kudos
Steven_L_Intel1
Employee
1,343 Views
Yes - I finally connected yesterday with Canaima president Marco Garcia and he gave me permission to release my modified version of f90SQL-Lite that works with Intel Fortran. We are also pursuing a long-term solution.
0 Kudos
edmund-dunlop
Beginner
1,343 Views
Steve,
How can your modified version of f90SQL-Lite be obtained?
How did you do it? (i.e. did you adapt the DVF or Lahey Version as I did myself, or have you compiled a completely new IVF version from source provided from Canaimasoft?)
How do you hope to pursue a long-term solution?
Edmund.

0 Kudos
Steven_L_Intel1
Employee
1,343 Views
I modified the CVF version's f90sql.f90 file to add suitable ATTRIBUTES directives to match the CVF calling sequence. If you had the Lahey version and library that would work too. If you've already done that with the Lahey version, then what I have adds nothing new. I want to package it nicely and that's taking me extra time.

For the long term, we are investigating licensing the sources from Canaimasoft. That hasn't happened yet.
0 Kudos
Robinson__Donald
Beginner
1,343 Views

I just completed a bit of an overhaul of a mixed-language application (console app; Fortran calls C) that uses the Canaima database DLLs and LIB file (f90SQL Pro 2.01.001) and redistributables.

Previously I had this building under CVF6.6c/DevStudio98.The new console app builds and runs under Microsoft Developer Studio 2005 .Net, with Intel IA-32 Version 10.0.027 and the C++ compiler that ships with Dev Studio. Getting it to build was one thing; some minor coding - updating the template f90SQL.f90 that ships with the Pro version (based on Steve's update of the Lite version) and regenerating its .mod file. - was required to make it do sensible things.

Along the way I wrote up a document that describes in some detail how to build an example solution (although the mixed language example provided by Intel is good) and provides screen captures for all the steps, including linkage to our source control system (SourceGear Vault). It may be overkill for some, but I'm happy to make it available if it is useful (pdf attached;correction of egregious errors welcome).

0 Kudos
Nick2
New Contributor I
1,343 Views
Another available solution is to write your own interface to ODBC32.DLL. Microsoft has documented the library well. Writing your own interface means you no longer need f90sql. Here's a starter:

interface
C see http://msdn2.microsoft.com/en-us/library/ms712455.aspx
C see also ODBC32.lib in notepad
integer(2) function SQLAllocHandle
& (HandleType,InputHandle,OutputHandlePtr)
!DEC$ATTRIBUTES STDCALL,DECORATE,ALIAS:"SQLAllocHandle"::SQLAllocHandle
!DEC$ATTRIBUTES VALUE::HandleType
!DEC$ATTRIBUTES VALUE::InputHandle
!DEC$ATTRIBUTES REFERENCE::OutputHandlePtr
integer(2) HandleType
integer(4) InputHandle,OutputHandlePtr
end function

(etc)

To use it:

iRet = SQLAllocHandle(1, 0, EnvHndl)

This should look very familiar if you use f90sql.
0 Kudos
Reply