Automated migration process
With proven automated legacy migration software, Mobilize.Net modernizes your Clarion Windows application to a native web app using Angular and ASP.NET Core..
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.
Today, however, Clarion apps have many disadvantages:
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:
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, 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;
}
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:
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:
! 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
// 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#:
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
Field1.Text
Field1.Text = ""
Drive.IconList[1] = "drvlcl.ico"
Classes
Printer.Device
Window.FoundCtl.ScreenText
Window.FoundCtl.Text = P.Value
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.
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
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
}
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.
Legacy client-server modernization services & solutions
Learn More →
Move data seamlessly to the cloud with Mobilize.Net
Learn More →
Transformative PowerBuilder to Java & C# migration tools.
Learn More →
Cloud application migration tools transform desktop apps.
Learn More →
VB6 migration tool to .NET & Web converter
Learn More →
Silverlight migration tools for Angular and HTML
Learn More →
“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
8834 N Capital of Texas Hwy, Ste 302
Austin, TX 78759
Call us: +1 (425) 609-8458
info@wearegap.com