Clarion (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Developer(s) JPI, Clarion International, SoftVelocity
Stable release 9.1 / July 29, 2014; 5 months ago (2014-07-29)
Operating system Microsoft Windows
Type Integrated development environment

Clarion is a commercial, 4GL, multi-paradigm, programming language and Integrated Development Environment from SoftVelocity used to program database applications. It is compatible with ISAM, SQL and ADO data access methods, reads and writes several flat file desktop database formats including ASCII, CSV, DOS (Binary), FoxPro, Clipper, dBase, and some relational databases via ODBC, MS SQL Server, Sybase SQL Anywhere and Oracle through the use of accelerated native database drivers, and XML, Clarion can be used to output to HTML, XML, plaintext, and PDF, among others.

One of the Clarion Development Environment's primary features is its use of templates which are used in conjunction with a code generator to produce much of the repetitive, time consuming code that is typically required when producing an application. An "embeditor" shows the developer the code that will be generated and embed points where the developer can enter their own hand-code in the context of the template generated code. Clarion programmers can create their own templates, or edit the existing ones.


The first release of the Clarion language was a DOS product called Clarion 1.0 and was first released in April 1986. Clarion was created by Bruce Barrington, one of the founders of healthcare firm "HBO & Company" (later acquired by McKesson Corporation[1]), and a small team of developers. Barrington's goal was to create a language that would be compact and expressive, and would maximize the use of the memory-mapped screen of the IBM PC by creating a screen designer. Version 1 produced pseudocode; the initial release included a screen designer, an interpreter, an editor, and a debugger. Initially it supported databases composed of DAT files and Clarion’s proprietary ISAM file format. Bruce Barrington formed Barrington Systems and released version 1.0.

Clarion 1.0 required the use of a dongle, at a time when industry sentiment was turning against dongles, which was offset by the ability to create royalty-free applications. However the dongle was removed with the release of 1.1.

At the same time, an even more basic version was sold. Called Personal Developer, it was very limited in what the user could do, but was adequate for very basic database applications. And it was a fraction of the cost of Professional Developer 1.x.

Version 2.0, released in May 1988, was known as Clarion Professional Developer, or CPD, and included a component called Designer, which incorporated a data dictionary. CPD generated Clarion code based on the contents of that dictionary and a template called a "model file." Because the model file was a text file, it could be modified (in limited ways) to create custom code. The model file was implemented with the "browse and form" paradigm, where data is initially displayed to the user in list box, and updating is done via a form called via buttons associated with the list. Designer created all the essential of the CRUD (create, read, update, delete) code, and developers could enhance functionality by inserting code at specified points in the generated code, or by hand-coding new procedures. Clarion Professional Developer also introduced Language Extension Modules (LEMs), that could extend the Clarion language using modules compiled in other languages that were built to the LEM format. Clarion Software and many third-party tool developers created LEMs for all purposes, including an extension for connecting to other databases such as dBase, Clipper and Paradox.

CPD 2.x was a database solution with everything required for screens, reports, databases and help files. A version of Clarion 2.x for end-users, Clarion Personal Developer, was also released just for the business user creating his own personal applications. Around the same time period, Clarion released Clarion Report Writer. This was created as both a stand-alone product for end-users of Clarion Personal Developer and users of programs written by developers with CPD, and as a built-in program bundled with Clarion Professional Developer version 2.1 released in 1989.

In 1991 Barrington licensed compiler technology from a company called Jensen & Partners International (JPI).

JPI was founded in 1987 by Niels Jensen, who had earlier (1979 or 1981) been one of the founders of Borland. Philippe Kahn was the marketing personnel who built Borland around the $99 Turbo Pascal compiler. Niels and his team were working on a new compiler technology at Borland when Philippe Kahn decided to buy Wizard C, and call it Turbo C. Niels and several other developers left Borland and started JPI, where they continued to work on their compiler technology, christened TopSpeed, which they bought from Borland for $1.7 million.

Clarion Database Developer 3.0 (CDD) was released in 1993. It was a revolutionary product adding many features and technology that could create programs with a “Windows like” CUA (Common User Access) user interface. Much of the CDD changes fit well into the Windows programming paradigm and laid the groundwork for the future Clarion for Windows product.

The CDD IDE was completely new and based on the JPI IDE. It included many professional programmer quality tools: editor, project system, compiler, linker, visual debugger. Gone was the p-code of CPD. The JPI compiler for the Clarion language produced true machine code EXEs, LIBs and DLLs. Binaries could be compiled for Protected Mode allowing DOS programs to use extended memory breaking the 640KB barrier.

The Clarion 3.0 language was enhanced in many ways, e.g.: new data types (CSTRING, PSTRING, DATE, TIME, USHORT, ULONG), file driver system (e.g. Btrieve, Clarion, Dbase, FoxPro, Paradox), queues (tables) were enhanced, screen processing was enhanced for CUA. Code generation by Models was replaced by “templates” that had more features and were extensible. This allowed generation of much more robust and complex code.

With all this new power came complexity. Many existing users found the transition to CDD difficult. CPD was simple and easy to use which attracted many non-programmers that could build programs by answering questions. CDD was more suited to professional programmers. Programs could still be developed as easily, but the size and vast features of the IDE made it appear complex.

The first 5 patch releases of CDD were buggy to the point of being unusable, which caused so many users to abandon the product that it was nearly a complete disaster for the company. Clarion kept working on CDD and by version 3.007 it was usable.

Version 3.1 named Clarion for DOS (CFD) was released in 1995. This proved much more stable, but by this time there was little interest in DOS development tools. A significant feature was the TopSpeed file driver, an ISAM file format allowing all indexes and multiple data files to be contained in one disk file.

During this time the relationship between Clarion Software and JPI grew closer, and on April 30, 1992, Clarion merged with JPI to form an entity which would eventually be called TopSpeed Corporation. The employees at the TopSpeed Development Centre in London went to work on CDD and ironed out many of the bugs.

TopSpeed released Clarion for Windows version 1.0 (aka CW 1.0) in January 1995. The final 1.003 release was June 1995. The IDE was completely written as a Windows GUI and could produce Win16 EXE and DLL binaries to run under Windows 3.x. The language featured many enhancements required to support the event driven Windows user interface. A Clarion developer could easily create a multithreaded MDI application. CW 1.0 continued the database flexibility added in CDD as well as adding an ODBC driver allowing connection to SQL databases, or any source supported by ODBC.

The DOS monolithic template model was significantly enhanced in CW 1.0 and replaced by a model that allowed a window to use multiple templates (Extension, Control or Procedure templates). For example, in DOS a screen procedure could support browsing a single data table. Under CW 1.0 a Window could use multiple Browse Control Templates each one displaying a different table. This design change was a major improvement in the power of Clarion code generation.

Clarion for Windows version 1.5 (aka CW 1.5) was released September 1995, with the final 1.502 release January 1996. This version added support for creating native Win32 binaries for Windows 95 and Windows NT 4. The same source could target Win16 or Win32. The IDE remained 16-bit but added 32-bit compilers, linker and debugger.

Clarion for Windows version 2 (aka CW20) was released in June 1996, with the final 2.003 release March 1997. CW20 added classic object orientation to the language, including inheritance, encapsulation, virtual methods and overloading. CW20 enhanced 32-bit support, added ActiveX support and enhanced SQL support.

Clarion 4 (aka C4) was released December 1997, with the final 4.002 release May 1998. TopSpeed elected to skip the dreaded version number three (the official explanation was that CW 1.5 "should have been CW 2.0," so CW 2.0 "should have been CW 3.0", so let’s just call the next one version 4). Due to DOS development being dead the name dropped the "for Windows" title.

C4 came with a new template set and class library called "Application Builder Classes" or “ABC”. The original template set generated procedural code, which was becoming increasingly complex. The ABC template set generated far less code, and leveraged the class library, which contained most of the actual logic for windows, browses, forms, etc. C4 enhanced OOP by adding Constructors and Destructors (without parameters).

Clarion 5 (aka C5) was released May 1998, with the final 5.0B release June 1999. The product was split into Professional and Enterprise editions.

Clarion 5.5 (aka C55) was released August 2000, with the final 5.507 release January 2002. C55 added Interfaces to OOP.

Clarion 6.0 (aka C6) was released November 2003, and added direct support for pre-emptive multi-threading.

Clarion 6.1 was released May 2004.

Clarion 6.2 was released May 2005.

Clarion 6.3 as released Jan 2006. Excluding patches this is the final release of the 16 bit Clarion development environment. The use of a 16 bit IDE produced some problems using current Windows technologies (ActiveX, OCX, COM, DOC, ...); however, note that the series 6.x of Clarion produces native Win32 executables (32-bit exes and/or dlls). Previous versions produced both 16-bit and 32-bit executables, the 16-bit support was dropped from the end-user product with version 6.0 of Clarion.

On April 13, 2009 SoftVelocity released Clarion 7 (aka C7). The new IDE will look familiar to SharpDevelop users; SoftVelocity obtained a commercial license for the SharpDevelop code and integrated Clarion's code generation and application generation technology. Major new features (other than the standard modern IDE features lacking in C6) include a build system based on MSBuild and backward compatibility with all releases of Clarion going back to Clarion for Windows 1.5.

C7 is still a Win32 development environment, but a beta .NET version of the Clarion language, called Clarion#, is available. Both Clarion# and C7 share the same IDE, although at present they are shipped as separate products. Unlike C7, Clarion# does not yet have a dictionary editor or application generator. When Clarion# goes gold it is expected that a single IDE will support both Win32 and .NET development.

The new IDE (in Clarion# mode) retains the ability to build .NET applications with VB.NET and C#.

On September 12, 2011 SoftVelocity released Clarion 8. It continues the line of Clarion 7 (the latest release was C7.3).

The actual running version (August 2014) is C9.1.11139, which was released as GOLD -- meaning perceived by the development team as being ready to use as a stable release.


Clarion is historically notable as being one of the first 4GL computer languages, first developed in the 1980s.


No Trial Version Available[edit]

There is no trial version, of any Edition of Clarion, at the time of this writing. At all.

This in stark contrast to other mainstream language vendors, which tend to provide trial / evaluation versions of their languages for developers to decide if their offerings will meet their needs or not.

It is not possible to produce a simple "Hello World" program in Clarion, without purchasing a license first.

Sub-Standard Documentation[edit]

Clarion's documentation is of a notoriously poor standard, with the mixture of "Enterprise Level" and ".NET" capabilities being intertwined into what appears to be a single, one-serves-all Help Source. Functionality is described (together with code snippets), and shipped with, for example, the WIN32 version of the "Professional Edition", where this functionality is not only not available in the product it was shipped with, but bears no relevance at all. The numerous references to "Clarion 7" within the "Clarion 8" or "Clarion 9" documentation are hardly comforting to the developer making use of these references. Which exist at a "Tutorial" and "Sample Application" level as well. Third party vendors tend to fall into this same trap, where their "application examples" are shipped as is, based on previous versions of Clarion, and require "upgrading" on first compiling to the latest version of Clarion.

In the opinion of the writer, this has led many ardent supporters of the Clarion Language to question quality standards, and has provided Clarion critics with valid reasons with which to reject Clarion as a reliable product capable of meeting its documented capabilities.

Undue Focus on COM[edit]

One of the Clarion 9.1's most announced advanced capabilities is the ability to "auto-register" COM objects on demand, so that there is no need to register COM components by means of the "REGSVR32" command prior to their use.

This capability is not only of virtually no consequence to developers who depend on COM, since those that do tend to include COM Object registration as part of their Installation / Setup Applications, but is an example of focus being placed on a technology that is widely considered to be antiquated, and is being phased out, in favor of .NET components.

To emphasize this, consider the use of the Clarion data type BSTRING, which is supported by the Clarion language, but documented nowhere. At all. On the .NET side, it is referred to as "UnmanagedType.BStr", a data type which is required to be "marshalled", or "translated" by virtue of the fact that it does not really fit into the newer .NET picture.

It is a curiosity that Clarion is propounding, as an advanced feature, the continued use of COM as it is, while at the same time, the very mention of this data type has dropped off of the radar, in all Clarion documentation, yet is key to COM interoperability.

For example, on the Clarion side of a .NET DLL call, the so-called "PROTOTYPE" (or declaration of the function/procedure "structure") for a function called "SayHello" could be:


While on the .NET side (using C#) it would be:

[DllExport("SayHello", CallingConvention = CallingConvention.StdCall)]

private static CWLong SayHello([MarshalAs(UnmanagedType.BStr)])

Which declares the static function, receiving the BSTRING to display, and returning a value, for example 0 or 1, indicating success or failure.

Why make such a fuss about new COM features and then (continue to not mention) BSTRING as a data type?

This data type, clearly critical, is still recognized by Clarion, but in (I would suggest acknowledgment of the phasing out of COM) the Clarion IDE is not available as a data type -- like BYTE, BOOL, CSTRING etc. is.



Clarion is very similar to current mainstream languages, in that it does require every code block to be contained in a begin-end block, except for Routine declarations which automatically terminate on the next declaration of one. So this, for example is required:

If A# = 5 then
  J# = A# * 3

or, as Clarion allows, the use of the "end", you can use the period "." character in place of the "end" keyword, as in the example below:

If A# = 5 then
  J# = A# * 3
.   ! < --- Note this period.  It is the equivalent of an "end".

You can drop the "then" keyword, so it now becomes...

If A# = 5 
  J# = A# * 3
.   ! < --- Note this period.  It is the equivalent of an "end".

Or place it one one line (DO NOT FORGET THE PERIOD! This a common error and can cause endless compiler-error problems...)

If A# = 5 then J# = A# * 3. ! NOTE -- the "." at the end of the line is the equivalent of an "end".

Use of Templates[edit]

Clarion generates its code by means of templates. Tried and tested over many years, rock-solid base code is produced as a result. Although the templates are editable, the template generated code is not. So this leaves Clarion Developers with the option of (a) modifying the templates (by means of a fully documented Template Language Reference), or (b) Creating templates that produce code that is exactly as they want it to produce the code it generates.

Wide Variety of 3rd Party Extensions / Inter-Language Support[edit]

A number of 3rd Party Vendors, most notably "CapeSoft", based in South Africa, (, produces a wide variety of advanced "add-ins", that extend the capabilities of Clarion. It must be noted however, that most 3rd Party Vendors do "wrap" other language capabilities into their products, which is something that any Clarion Developer familiar with any of these other languages is quite capable of doing themselves.

An example of the combining the capabilities of Clarion with other languages and platforms, thereby extending Clarion's native capabilities can be found at , which has library offerings allowing for integration of Clarion projects with the following languages/platforms, which Clarion is easily able to integrate into any of its products:

Android™ Classic ASP C C++ C# Delphi ActiveX Delphi DLL Visual FoxPro Java MFC Objective-C Perl PHP ActiveX PHP Extension PowerShell Python Ruby SQL Server Unicode C Unicode C++ Visual Basic 6.0 VB.NET VBScript

Database Flexibility[edit]

Clarion is data-centric, meaning it is designed to be used among a wide variety of database vendors, and is focused around the data. This means a table which is targeted at for example a .TPS file can be fairly easily ported to a Microsoft-SQL table, by simply choosing the new database target (MSSQL), and providing the required Ms-SQL database accessibility criteria (e.g. ServerName, DatabaseName, UserName, Password).

This is on of Clarion's most powerful capabilities -- the code it produces supports any of the database drivers it ships with -- most times without the need for code changes at all. The language "translates" into the relevant language required for the database transparently, allowing the Clarion Developer to not have to deal with low level issues.

Clarion natively supports the following database formats, including, but not limited to:

ASCII Basic BTrieve Clarion (.DAT) TopSpeed (.TPS) Clipper DBaseIII DBaseIV DOS FoxPro/FoxBase Ms-SQL (T-SQL) ODBC (here you can go DB/2 or any other database that supports ODBC -- so in reality, ANY database format that has an ODBC driver available for it) Pervasive SQL SQLLite MySQL Oracle

In addition, due to its ability to readily interact with any .NET Class Library, it is able to leverage off of any of the very latest technologies from a database perspective, including ASP.NET and any others that Microsoft makes available. Including Windows Communication Foundation, Windows Communication Foundation, and Windows Workflow Foundation. Of any version.

Learning Clarion[edit]

Clarion is a language that is very easy to learn. The "Learning Clarion" PDF can be read in a day or two. However, in order to begin programming in clarion, you must purchase the Clarion compiler/development platform, which has an entry level cost of over $1000.

Dictionary Abilities[edit]

In all of the areas of the "data dictionary data declaration sections", namely the "global data section", the "module-specific data declaration section", and the "local data data declaration sections", when you declare a (simple or complex data type or variable), you can also declare it's "prompt, or label", "mask", or "picture", whether it is read-only on not, to be skipped on the form or not, the foreground and background color, transparency, and a whole host of other attributes.

So that if you ever drop that variable on a form in Clarion's IDE (Designer), it adopts those properties automatically, and they are reflected automatically. In other words, the data dictionary (or 'database' in SQL terms), contains not only information about the data itself, but also information about how it should be represented in applications which make use of the "database" declaration itself.

Therefore, the more time a Clarion Developer spends time defining the data-dictionary, the more time they will save later on when the 4GL application generator produces output, typically lists of data with full CRUD capabilities, validation, automatic lookup from "child" table capabilities etc.

Hello World[edit]

A demonstration of a Hello World program in Clarion.

 MESSAGE('Hello World!','Clarion')

Programing for Non-Programmers[edit]

The sample code shown in the "Hello World" example is an example of "hand-written" code, which the Clarion compiler will gladly compile.

Because Clarion, as a 4GL language, is template-based, and the code the templates produce are consistent and have been refined over decades. This allows programmers who choose to use clarion, to quickly throw together prebuilt application modules built by other developers.

The Global Map[edit]

One of the things Clarion includes is what is called "Global Map".

Inside here, procedure definitions are declared, including, if required, declarations to external DLL's or Libraries written in non-Clarion languages. For use by the Clarion application. Clarion also has the ability to generate DLL's that can be consumed by external non-Clarion applications, taking full advantage of all of Clarion's 4GL capabilities and simply "plugging in" to the procedures it has created.

Within this MAP, it is able to leverage of all of the Windows-API declarations, using, if required, the no-longer documented data types that are core to the Windows O/S. Easily.

Interop with .NET Libraries[edit]

Thanks to support from the developer community, Clarion is able to access some of the current .NET functionality. Unmanaged Exports, a nuget package developed by Robert Gieseck (, allows you expose functions developed in a .NET library to native languages on Windows. This is helpful for those who are forced to maintain a Clarion product but have no way of upgrading third party tools due to lack of support. Most of the third party tools can be rewritten in .NET with ease.


  1. ^ "Health Care Services Leader McKesson’s History | Our History". McKesson. Retrieved 2012-03-14. 

External links[edit]