# FOCUS

FOCUS is a fourth-generation programming language (4GL) computer programming language and development environment that is used to build database queries. Produced by Information Builders Inc., it was originally developed for data handling and analysis on the IBM mainframe. Subsequently versions for minicomputers and such as the VAX and other platforms were implemented. FOCUS was later extended to personal computers and (in 1997) to the World Wide Web: the WebFOCUS product.

## History

Information Builders's FOCUS product began as an alternate product to Mathematica's RAMIS, the first Fourth-generation programming language (4GL).
National CSS (NCSS), a Time-sharing vendor, licensed rights to make RAMIS available on its VP/CSS system.
At some point Mathematica changed its licensing price.
The interested parties were:
* NCSS, which was marketing RAMIS (and other products) for use on their time-sharing system
* Mathematica, owner of RAMIS
* Key developers/programmers of RAMIS
** some stayed with Mathematica
** others left to form the company that became Information Builders, known for its FOCUS product

### Relation to other 4GLs

RAMIS was the direct ancestor of FOCUS.
Gerald D. Cohen and Peter Mittelman were the principal developers of RAMIS while working at Mathematica Products Group in 1970. RAMIS was licensed by Mathematica to a number of in-house clients (including Nabisco and AT&T Corporation), and was also offered by the National CSS timesharing company. In October 1975 Cohen left Mathematica and formed Information Builders, after which he recreated the product he had built at Mathematica in the form of FOCUS, which was very similar to RAMIS: "the same bugs and the same misspelled error messages."
The syntax of FOCUS in its simplest elements is almost a direct clone of the syntax of RAMIS bearing a resemblance similar to the differences between various early dialects of SQL. At the same time, NCSS decided to work on its own product, later called NOMAD. All three products flourished during the 1970s and early 1980s, with FOCUS also being offered on a time-sharing basis via Tymeshare.
Mathematica's time ran out in the mid-80s, and NCSS also failed, a victim of the personal computing revolution which obviated commercial timesharing.
RAMIS was sold to a series of companies, ultimately landing with Computer Associates. NOMAD suffered a similar fate. FOCUS, under Cohen's direction, continued to flourish by expanding their product line.
Loosely competitive with SAS, FOCUS never quite reached the same degree of mainstream adoption, perhaps because it had only basic analytical and statistical functions and lacked the wide array of specialized analytic tools which made SAS the standard in fields such as pharmaceutical clinical trials. Instead, FOCUS concentrated on extreme flexibility in data import and export as well as ad hoc end-user reporting.

### Integration

Software packages with which FOCUS has linked and integrated include:
* Excel
* AJAX

### Business Intelligence competitors

Business intelligence software competitors include:
* Business Objects
* Cognos
* Hyperion
* Microsoft
* MicroStrategy
* SAS

## Description

Although FOCUS resembles other data access and analysis tools, such as SQL and SAS, it also includes report and chart display and presentation features. It automates the process of identifying files to the operating system, opening the input file, reading the next record, opening the output file, writing the next record, and closing the files. This basic operation allows the user/programmer to concentrate on the details of working with the data within each record, in effect working almost entirely within an implicit program loop that runs for each record, somewhat like RPG (Report Program Generator). Other procedures operate on the dataset as a whole, for instance printing or statistical analysis, and merely require the user/programmer to identify the dataset.
Compared to general-purpose programming languages, this structure allows the user/programmer to be less familiar with the technical details of the data and how it is stored, and relatively more familiar with the information contained in the data. This blurs the line between user and programmer, appealing to individuals whose work roles are in business or research rather than information technology. This in turn has the double edged result of allowing rapid answers to business or research questions, even ones requiring several iterations to get from the initial results to a final answer; but also can contribute to the construction of a large body of poorly written and/or difficult to maintain source code.

### Master File Description (MFD)

A feature that was unique at the time is that FOCUS features the ability for the user to construct a data description file (called a "master file description") referring to the actual data file, or even several different data description files addressing the same data file in different ways, rather than the usual practice of having the file structure hard-coded into the program.
In this way, files of any structure from any source can be accessed or produced in many different ways, eliminating much of the data manipulation (for example concatenation, or parsing) at times required with other earlier programming languages. For instance, the same actual data file can be accessed (read or write) as each record being an 80 byte text string, or as 40 2 character numerical fields, other as 10 8-byte floating point numbers, etc., by the user simply re-writing the appropriate master file description as needed.

### Samples

* (batch)
** PRINT LASTNAME FIRSTNAME AREACODE PHONUM NOTES
** PRINT PROJNAME AND PROJCOST BY CUSTNAME SUBTOTAL PROJCOST BY CUSTID
The second command would produce a report with headings CUSTNAME CUSTID PROJNAME PROJCOST
       followed by one or more lines of detail, followed by
       _TOTAL_ CUSTNAME xxxxx (and $z,zzz.zz for that CUSTNAME)
          The bottom of the report would have the total for ALL projects.
* (interactive)
       MODIFY FILE PHONEIDX
       PROMPT AREACODE PHONUM LASTNAME FIRSTNAME NOTES
       MATCH AREACODE PHONUM
       ON MATCH REJECT
       ON NOMATCH INCLUDE
       DATA
There are keywords to facilitate modification (or deletion) of existing data, and the prompting and error messages from the interactive session can be customized.

## WebFOCUS

In 1997, a web-based version of FOCUS was introduced called "WebFOCUS" which built on the data access and reporting foundation of FOCUS, expanding these to a visually oriented thin-client paradigm accessible from any web browser.
WebFOCUS's language has both a "procedural" and "non-procedural" command structure. The former is for more immediate execution, whereas the latter "are placed into a stack of memory for later execution."