Clarion (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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.

The Clarion Development Environment (IDE) sits on top of the Clarion Programming Language. The IDE provides code generation facilities via a system of templates which allow programmers to describe the program from an abstract level higher than actual code statements. The generator then turns this higher level into code, which in turn is then compiled and linked using a normal compiler and linker. This generation layer is sometimes referred to as 4GL programming.

Developer(s) JPI, Clarion International, SoftVelocity
Stable release
Clarion 10 / September 2015; 1 year ago (2015-09)
Operating system Microsoft Windows
Type Integrated development environment

The generation layer is not required. It is possible to create programs completely at the code level (the so-called 3GL layer), bypassing all the code generation facilities.

If the templates are used to generate code then programmers are able to inject their own code into the generated code to alter, or extend, the functionality offered by the template layer. This process of embedding code can be done while viewing the surrounding generated code. This mixing of template code and generated code allows the template settings to be updated, and the code regenerated, without the loss of the embedded code.

The templates (from which the code is generated) are provided in source form and developers are free to create their own templates. A large collection of templates have been written by various developers some of which are offered as commercial add-ons and some of which are free.

There are several Clarion products available; Clarion Professional Edition, Clarion Enterprise Edition and Clarion.Net.


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, fixed and extended the basic functionality. 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).

In August 2014 C9.1 Gold was release.

The actual running version (November 2015) is C10 Gold +

C10 was re-worked to build up on .NET 4


Clarion is historically notable as being one of the first 4GL computer programming tools, first developed in the 1980s; and from that time period onwards, has continued to refine its capabilities.

Other software vendors have tried to emulate the capabilities of Clarion, the most notable of which has been Microsoft's (Tm) "LightSwitch" project type, and the infamous "MVC", or "Model, View, Controller" project type -- which in this author's opinion merely touches the tip of the iceberg, in that -- the ability to transform DB schemas into code classes, or vice-versa, is viewed as an incredible achievement.

Clarion does this effortlessly, and can auto-generate code that match new requirements, in seconds, while other platforms require manual code interventions; the reliability of which is based on the coder making the changes skills. In other words -- they are not language-capability-based, but human skill based.


No Trial Version Available[edit]

There is no trial version of any Edition of Clarion, at the time of this writing. It is thus not possible to produce a simple "Hello World" program in Clarion, without purchasing a license first.

Sub-Standard Help[edit]

Clarion's documentation is of a varying standard with the mixture of "Enterprise Level" and ".NET" capabilities being intertwined into a single, one-serves-all Help Source.

This can result in some functionality being described in the help (together with code snippets) where that functionality is not in the specific product being used. For example, Clarion.Net documentation is included, even when the clarion.Net product is not installed. Documentation specific to one product though is clearly labelled as such.

The documentation has lagged behind the product and it is clear that it is not completely reviewed with every release.

For example, there are numerous references to previous versions of the currently released version, with references to examples that have to be "upgraded" on opening, because they are still in the application format of prior versions; having said that, it is testimony that, despite this lack of maintenance of sample code with the current release, the older sample applications do indeed open, are able to be upgraded, and function normally.

Closed User Community[edit]

The Clarion User Community has a reputation for being somewhat "closed", in that information, language extensions and the like are not provided freely, but tend to be charged for.

For example, there are global support sites available, where Clarion developers can access FAQ's etc., but these require subscriptions; and typically, language extension templates that add functionality to the underlying language, while available, and rich in functionality, are rarely free -- for some reason (perhaps because of the recognition of the power of the language), there is very little "free", when it comes to Clarion, in stark contrast to other languages such as Delphi, C#, VB, JavaScript, JQuery etc., where libraries that extend the language are openly and freely available to the global community.

The fact that a valid Clarion License No is required in order to be able to register on the Clarion NewsGroups is an indication of how closed the community is.

Limited Software Copyright Protection[edit]

Clarion is notoriously able to be copied, from one PC to another, by means of simply entering the User Name and License Code associated with the purchase of the software, with no online or other software copyright / user-level licensing protection measures in place.

This makes the development environment extremely vulnerable to being used without proper licensing enforcement measures in place, and means that, in effect, any Clarion installation executable can be re-used, any number of times, without any consequence, provided that the person installing the software has a valid User Name and License code.

Having said that, there seems to be an unwritten code of trust in the Clarion Community, in that despite this lack of software copyright enforcement, Clarion developers will not make their User Names and License Codes freely available to others, to protect the producers of the product itself.

Comprehensive Reference Material[edit]

Clarion [currently] ships with a very comprehensive set of reference documentation, in PDF format, which addresses topics ranging from beginner level, through to advanced, where topics like multi-threading, use of O/S API Kernel functionality and the like are covered.

The PDF documentation, as shipped in the current [2016] version, are:

ABC (Application Builder Classes) Library Reference (1,328 pages)

Advanced Programming Resources (64 pages)

Advanced Topics Reference Guide (265 pages)

Business Math Library (91 pages)

Clarion IDE Quick Ref Guide (2 pages)

Clarion Language Programming (74 pages)

Clarion XML Support (31 pages)

Database Drivers (322 pages)

FAQ's Tips n Tricks (175 pages)

Getting Started (47 pages)

IDE Reference (468 pages)

IDE Users' Guide (302 pages)

Language Reference (1,115 pages)

Learning Clarion (224 pages)

Report Writer (352 pages)

Report Writer Legacy (274 pages)

Template Guide (339 pages)

Template Language Reference (258 pages)

Sample Source Code Applications[edit]

The Clarion installer ships with 45+ ready to run applications that can be compiled and run, that demonstrate the capabilities of the Clarion language itself.

Each of these sample applications are able to be modified, as the source code is provided freely.

Language Properties[edit]

Clarion is an imperative programming language which supports an Object Orientated Programming syntax. The Clarion programming language is case insensitive. Line Endings are treated as implicit statement terminators (unless an explicit line continuation character -- the "pipe" symbol, or "|", is used). Data and program Labels are always declared in column 1, code is always indented from column 2 onwards. (Further indentation is optional.) The code syntax most resembles BASIC in structure, but being Object Oriented Programming oriented, it is able to be used in an almost intuitive, readable form, as well as in an object-oriented form that makes use of class methods and properties, using either the commonly used "dot" notation (e.g. Customers.Next()), or the PROP{} notation (e.g. ?btnCancel{PROP:Enabled} = false).

Code blocks typically have an implicit start (no BEGIN word is used) and either an explicit (using END or ".") or implicit (they are at the end of a declared routine, and therefore implicitly terminate).

For example;

If x = 5
  y = z * 3

A period can be used in place of the END statement.

If x = 5
  y = z * 3

Code can be concatenated onto a single line using the "." terminator (remember, "." is equivalent to "END").

If x = 5 then y = z * 3.

Note that the period "." terminates the If statement block. And as mentioned before, "IF", "if", "If" are all equivalent -- Clarion is NOT case sensitive, whether referring to reserved words, variables, or any other syntactical elements.

Interestingly, in .NET's C# Language (tm) there is a "shortcut" version of the "if then else" code construct, and it goes like this:

int x = 0;

int y = 6;

x = y == 5 ? 7 : 8;

This construct was introduced as the .NET framework evolved.

In the above example, it can be read as "x is equal to whether y is equal to 5. If y is equal to 5, let the value of x be 7. If the value of y is not equal to 5, let the value of x be 8."

In Clarion, the above C# code can be written as:

x# = Choose(y# = 5, 7, 8)

So if y# is equal to 5, return 7, otherwise return 8. The use of the "#" symbol in the example above indicates that the variable associated with it is implicitly being declared, as a long integer.

In other words,


int x = 5;


x# = 5

Are equivalent statements.

The Clarion language makes extensive use of what are loosely referred to as "variants", in that, for example, it is easily able to apply a variable declared as an integer, to a string value. So, it can express, where x# = 5, the answer to:

'The value of x = ' & x#

As output:

"The Value of x = 5"

Where the x# value, an integer, has been automatically converted to a string value, for the purposes of being used in the message box. In many respects, Clarion and .NET are similar in this respect -- for example:


int i = 5;



i# = 5


Use of Templates[edit]

Clarion generates its code by means of templates. Code generated by templates tends to be very reliable especially if the template has been in use for some time.

Templates are shipped in source form, and can be edited, however the editing of shipping templates is not recommended. The code generated by templates can be augmented, or altered by either creating additional custom templates or embedding specific code.

The templates are capable of generating any text based file, and are not limited to Clarion Language statements.

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

The Clarion language is capable of interacting with DLL's produced by other languages. It is compatible with libraries using the PASCAL method or C method of parameter passing. Windows API calls can be made directly from the language.

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 focus on the data starts with the Data Dictionary which is a method for formally declaring data tables. This dictionary is then used extensively by the templates when generating the program. Changes at the dictionary level can cascade into the program causing automatic changes to the program itself.

The data dictionary provides a vendor independent method for declaring tables, which in turn means that changing a program from one database vendor to another is relatively straightforward (within the constraints of what features the chosen database provides.)

Clarion supports both SQL databases and non-SQL data stores. Support for popular ISAM file types (dBase, Btrieve etc.) are built in and two proprietary ISAM file systems (Topspeed (TPS) and Clarion (DAT)) are also provided.

In the program code Tables are a native data type. Table access is provided by a standard DLL interface (known as a "database driver") which separates the program from the chosen data store. This abstraction allows the chosen backend to change with either no, or minimal, changes to the program itself.

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




Clarion (.DAT)

TopSpeed (.TPS)








Pervasive SQL





The ODBC driver allows access to any ODBC source. Firebird, Postgresql, DB/2 etc. are all fully accessible from within Clarion, via ODBC.

Clarion, which is C-based, and quite capable of compiling both Clarion and C code side-by-side into an executable or DLL, can access any technology the O/S has to deliver.

Learning Clarion[edit]

Clarion is a simple language, resembling BASIC, but with the addition of Objects and Classes. Typically, one or two days of going through the tutorials are all it takes to be able to deliver functional, real-world applications.

Hello World[edit]

A demonstration of a Hello World program in Clarion.

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

Programming 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. However most developers do not write whole programs at the code level, but make use of the templates to generate code.

Because of this ability to describe a program at a level higher than code Clarion has been most popular with both non-programmers and programmers with limited skills or abilities. It is possible for non-programmers to generate sophisticated "data based" programs while at the same time either writing no language code at all or by adding only minimal amounts of their own code.

Interop with .NET Libraries[edit]

Clarion (as opposed to Clarion#, the .NET based version of the development platform), is able to be easily integrated with any .NET assembly, by means of the use of the Visual Studio extension available at (

What this means, in a nutshell, is that a developer can use the (4GL) capabilities of Clarion to develop the core application, and at any time, tap into the .NET framework, and draw on any of its capabilities, which are vast and extensive, with ease.

A very, very rarely documented data type, known as "BSTR" or "BSTRING", is the key to providing interoperability between the two platforms.

In a Clarion application, for example, you would declare an external procedure (one that is .DLL hosted), with a name of "Concatenate", that takes two parameters, and returns a string result. The Clarion "prototype" for this would look like this:


This would declare, in Clarion, that the procedure being called would take two parameters, both of type BSTRING (the .NET equivalent of a "string"), would return a string, would use the Pascal calling convention, and that the function exists in a DLL.

On the .NET side, with the package available at ( installed, we could have a function declared in a class library that concatenates the two input variables, and returns the result, as such:

       [DllExport("Concatenate", CallingConvention = CallingConvention.StdCall)]
       public static [MarshalAs(UnmanagedType.BStr)] Concatenate([MarshalAs(UnmanagedType.BStr)] string firstName, [MarshalAs(UnmanagedType.BStr)] string lastName) 
           string fullName = firstName + " " + lastName;
           return fullName;

One important thing to note is that, once any .NET (be it C#, VB, or an other .NET based language) DLL is compiled, the resulting, associated .LIB file must be opened with Clarion's "LibMaker.exe" utility, which is in the "Bin" folder of the Clarion installation folder, and once opened, the resulting .LIB file must be saved into the same location as the Clarion application; Once done, in the "Solution Explorer", the resulting .LIB file must be added to the solution, and the newly declared external procedure must be associated with the .LIB file that was associated with the solution.

So any .NET capability is within the grasp of any Clarion 4GL application's requirements -- and that with the power of Clarion 4GL, together with the extensive capabilities of .NET, the best of both worlds are able to be leveraged.

The result: 4GL Power, with .NET -- done.


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

External links[edit]