We Are GAP Mobilize
Free Assessment Tool
Unisys Linc to J2EE

Converting Clarion to Native Web Apps

Automated migration process 

Talk to an Engineer

With proven automated legacy migration software, Mobilize.Net modernizes your Clarion Windows application to a native web app using Angular and ASP.NET Core..

Unisys Linc to J2EE
Time to Mobilize
Talk to an engineer

As the global leader in automated migration of Windows applications to native web apps, GAP is your trusted source for tools, services, and support in your Clarion modernization project.

Clarion is a high-level programming language primarily used for developing database-driven Windows applications. It was originally developed by SoftVelocity and has been in use since the late 1980s. Clarion is known for its rapid application development (RAD) capabilities, making it a popular choice for creating business software and database applications. 

Today, however, Clarion apps have many disadvantages:

  • As a legacy 4GL tool with a proprietary programming language, it's getting harder and harder to find engineering talent familiar with the tools and language.
  • Clarion apps are captive to the desktop
  • Clarion apps are old. Finding copies of the development environment to use for maintenance can be impossible, forcing an upgrade to a newer version.
  • Clarion uses non-standard approaches to application design, architecture, and nomenclature.

Now is the time to modernize Clarion legacy applications

GAP has the tools, experience, and capabilities to accelerate your path off Clarion. Our automated migration tools parse the Clarion source code and generate C# and the .NET Framework. Let's look at some examples:

Organization

Clarion applications use MAPs and procedures to organize source code. MAPs containe prototypes, program names, local data, modules and source code. 

MEMBER('ProgramFile')
MAP
    MemberProc PROCEDURE
END

! Declarations
val    long

! Procedures
MemberProc PROCEDURE()
    CODE
        ! Procedure code would go here

In C#, that code would look like this:

public static class MemberFileName // the filename of the member module
{
    // Declarations are private because they can only be used
    // within this module in Clarion
    private static int val;
    
    // Procedures are migrated as methods within the class
    public static void MemberProc()
    {
        // procedure code would go here
    }
}

Here's what this looks like graphically: 

Clarion to c#

Program execution control

Clarion, like some other 4GL systems, will auto-generate source code from form inputs or the developer can write source code in procedures directly using the Clarion programming language, which is C-like but unique. Converting to C# means some language elements can go almost straight across; others need some finessing. Some examples:

CASE statements are often used to avoid a long string of IF statements testing for different conditions. Clarion has one unusual syntax variant of CASE: CASE OROF:

switch (Name[0])
CASE Name[1]    !Get first letter of name. Remember Clarion is 1-based program
  OF 'A' TO 'M'         
  OROF 'a' TO 'm'
    Message('In first half')
  OF 'N' TO 'Z'         
    Message('In second half')
  OROF 'n' TO 'z'       
    Message('In second half but lower case')
END

Converting to C#, we get:

switch (Name[0])
{
    case >= 'A' and <= 'M':
    case >= 'a' and <= 'm':
        Console.WriteLine("In first half");
        break;
    case >= 'N' and <= 'Z':
    case >= 'n' and <= 'z':
        Console.WriteLine("In second half");
        Console.WriteLine("In second half but lower case");
        break;
}

Expressions

Clarion uses expressions in its language, as basically all other procedural programming languages do. Expressions are just formulas for mathematical, string, or logical operations that produce a result. 

Where differences pop up is in the precedence of operators in an expressions; ie, the order in which they are evaluated. In Clarion, precedence is as follows: 

Clarion precedence table

Expression evaluation in C# uses a different set of rules for precedence, you can see a detailed explanation here. This means as expressions get converted to C#, the expression may need to be modified to work correctly with different evaluation order.

String expressions are both common and complex in application code. Clarion is similar to C#, although concatenation uses the "&" character rather than the "+" character in C#. Here's some before and after code:

Clarion

! Variable declaration
StringPlusString STRING(30)
StringPlusVar    STRING(30)
StringPlusFormat STRING(30)
StringPlusNumber STRING(30)
StringPlusProc   STRING(30)
StringPlusExpr   STRING(30)
Name STRING(@S20) !A 20 character string picture field

! Variable usage
StringPlusString = 'Message: ' & 'Classified'      !Concatenate a constant and constant
StringPlusVar = Weight & 'lbs.'                    !Concatenate a constant and variable
StringPlusFormat = 'ID:' & FORMAT(UserId,@P##-##P) !Concatenate a constant and Format
StringPlusNumber = 'Local ' & 404                  !Concatenate a constant and Number
StringPlusProc = 'Time: ' & LocalTime()            !Concatenate a constant and procedure return
StringPlusExpr = 'Sum 8: ' & '5' + '3'             !Concatenate a constant and another expression

C#:

// Variable declaration
string StringPlusString;
string StringPlusVar;
string StringPlusFormat;
string StringPlusNumber;
string StringPlusProc;
string StringPlusExpr;
string Name;

// Variable usage
StringPlusString = "Message: " + "Classified";                  //Concatenate a constant and constant
StringPlusVar = Weight + "lbs.";                                //Concatenate a constant and variable
StringPlusFormat = "ID:" + string.Format("{0:##-##}", UserId);  //Concatenate a constant and Format
StringPlusNumber = "Local " + 404;                              //Concatenate a constant and Number
StringPlusProc = "Time: " + LocalTime();                        //Concatenate a constant and procedure return
StringPlusExpr = "Sum 8: " + (int.Parse("5") + int.Parse("3")); //Concatenate a constant and another expression

Expressions that set properties are a little less readable in Clarion than C#:

Clarion:

String:Field1{PROP:TEXT}

String:Field1{PROP:TEXT} = ''

List:Drive{PROP:IconList, 1} = 'drvlcl.ico'

PRINTER{PROPPRINT:Device}

R:Window$FoundCtl{PROP:ScreenText}

R:Window$FoundCtl{PROP:Text} = P:Value

C#:


Field1.Text

Field1.Text = ""

Drive.IconList[1] = "drvlcl.ico"
Classes
Printer.Device

Window.FoundCtl.ScreenText

Window.FoundCtl.Text = P.Value

Classes

Both Clarion and C# uses classes; a CLASS in Clarion is created when it is declared, although this behavior can be overridden with a TYPE attribute in the class definition. 

Clarion

MyClass class               !Both a data type declaration and an object instance
MyField byte
end

MyClass2 class, type        !Only a data type declaration
MyField byte
end

MyProcedure procedure()
MyNoInstanceObject &MyClass !Object reference
TwoClass &MyClass2          !Object reference
 CODE
 TwoClass &= NEW(MyClass2)  !New statement to start the object lifetime

C#

public class MyClass           // Data type declaration 
{         
 byte MyField;
}
MyClass MyClass = new();        // Object instance

public class MyClass2           // Only a data type declaration
{        
 byte MyField;
}

public void MyProcedure()
{
 MyClass MyNoInstanceObject;  
 MyClass2 TwoClass;             // Object references
 MyNoInstanceObject = new();
 TwoClass = new();              // New statement to start the object lifetime
}

Learn more

Large, complex Clarion applications can be cumbersome to rewrite since so much of the code and logic is hidden behind the 4GL user interface and non-standard programming patterns. If you would like to see some of your Clarion code as C#, click the "Talk to an Engineer" button at the top of the page for a in-depth discussion with our team.

Got Legacy PowerBuilder, Java, Unisys Linc, Silverlight?

Modernization Services

Legacy client-server modernization services & solutions
Learn More →

Legacy Data to Snowflake

Move data seamlessly to the cloud with Mobilize.Net
Learn More →

PowerBuilder to Web

Transformative PowerBuilder to Java & C# migration tools.
Learn More →

VB, C#, .NET to Web

Cloud application migration tools transform desktop apps.
Learn More →

VB6 to .NET

VB6 migration tool to .NET & Web converter
Learn More →

Silverlight to Cloud Native

Silverlight migration tools for Angular and HTML
Learn More →

Unisys Linc to J2EE

“NTCNA Chassis Dynamics chose Mobilize.Net VBUC because the automated migration technology greatly sped up our move off VB6.”

- Aaron Bickel, Senior Manager, Nissan NA

“Mobilize tools create readable, maintainable, quality code,” said. “Mobilize uses familiar architecture and patterns which made it easy to immediately step into the code.”

- Matt Gropel, Director of Technology at AgWorks Software

“I am very pleased with the tool and your responsiveness. I have had at least 3 other aborted efforts to convert and hundreds of man-hours wasted. To get a clean compile after only 2 days is thrilling. I suspect that with about a week of effort, I can have a working .NET equivalent app.”

- Scott Lee, President, Superior Labels

“Mobilize.Net has a strong track record of building products that successfully automate challenging source code migrations, and this [product] will empower our customers to get up and running on Snowflake sooner.”

- Chris Degnan, CRO at Snowflake

We ran a proof of concept comparing the Visual Basic Upgrade Companion (VBUC) with other VB6 migration tools and we definitely preferred the way VBUC handled the conversion.

- James Lewis Stevenson II – Software Design Engineer, GT Software

Your Code. New. Again.

Trusted by 80% of the Global 2000
logo-IRS
microsoft
nissan
CFM-materials
logo-AgWorks