# CHAPTER 1: Introduction

There are two variants of the Fortran Host Language Interface to Empress: the Command Language Interface and the Database Manipulation Language Interface.

The Command Language Interface allows Empress SQL commands to be executed from within a Fortran program. The Database Manipulation Language Interface provides a set of procedures that allows more detailed, record-at-a-time operations on a database.

## 1.1 Fortran Language Version Supported

The Empress Fortran Host Language Interface supports Fortran 77 and Fortran 90.

## 1.2 References

Throughout this manual we assume that you are familiar with the Fortran programming language, as well as database principles. If you are not, you should obtain copies of the references listed below and read them thoroughly.

This manual is intended as a specific guide and reference for interfacing Empress with Fortran, and not as a general guide to programming or creating Empress applications.

Ellis, T. M. R. (1982) A Structured Approach to Fortran 77 Programming. Addison-Wesley Publishers Ltd.

Date, C. J. (1995). An Introduction to Database Systems. Addison-Wesley, Reading, Mass., 6th. ed.

Tsichritzis, D. T., & Lochovsky, F. H. (1977). Database Management Systems. Academic Press.

## 1.3 Strings in Fortran

Unlike the C programming language, Fortran does not support the concept of variable-length strings. Normally, Fortran strings are blank-padded and their actual length cannot be determined. In order to simulate variable-length strings for the Database Manipulation Procedures, it is necessary to place an ASCII NULL (\0) after the actual end of the string when assigning table or attribute names to string variables, or using string constants. For example, if you wish to assign the name `loans` to a 10-character string variable, you must actually assign `loans\0` to it.

There may also be some problems when retrieved strings are used as parameters to other Database Manipulation Procedures. In this case it is also necessary to place a NULL in the string at the end of the retrieved value. This task is simplified because the routine which retrieves attribute values, `mfgetv`, also returns the length of the retrieved string. An example of inserting the NULL after the end of the retrieved value is given in the program `interest.f` or `interest.for`.

Since the UNIX F77 compiler adds a NULL at the ends of string constants automatically, if you use constants as parameters or in comparisons you do not need to add NULLs to them.