Convert PowerBuilder to C#

Delivering you an intelligent and high quality result in due time!

Automated Application Conversion

Do you need to convert your PowerBuilder application to C#? In this case, Ispirer products will be the perfect solution for your project!
Human-written code in each project has its own specifics. It may seem difficult to obtain a high level of automated conversion. With Ispirer it will be a smooth transition. The main advantage of Ispirer Toolkit is the personalization for your conversion project. As a result, you will replace the old technology with all its downsides. The outcome will be a new application without any middleware used afterwards.

How it Works

Ispirer Toolkit

Automated conversion of PowerBuilder to C# with the help of our tool makes it possible to significantly reduce the time and expenses as compared to manual rewriting of the application. The following approach allows to ensure high quality of automated conversion:

1. Preliminary Stage

The stage is carried out to determine the current conversion level of Ispirer Toolkit. The level of conversion depends on the complexity of the source code and the requirements for the target application. You can independently perform the analysis of the source code of your PowerBuilder application, as well as try to convert it to C# using the demo license. Besides, our experts can perform the source code analysis and provide you with examples of its conversion.
If your application is quite specific and large, we recommend to perform PoC to determine the maximum level of automated conversion of your project.
As a result, we will find out whether the customization is required or you can directly proceed to the conversion.

2. Ispirer Toolkit Customization Stage

If this stage is necessary, we will perform the customization to thoroughly prepare the toolkit for the conversion according to your project requirements. We will take a part of a representative code that amounts ussually to ~100,000 lines. The Ispirer technical team will add all the required conversion rules into the tool to achieve the highest possible level of automation or even to get a compilable result. As a delivery, we will provide conversion results of the scope of this customization. The customer will get a tailored and updated tool according to his specific project needs.

3. Use of Ispirer Toolkit

At this stage, you perform the conversion yourself. As to pricing, we apply project-based licensing. Prices depend on its scope and duration. The license includes support as well. If necessary, the conversion may be further improved even at this stage. As a result, customization requests, each of which is processed within 1-3 business days, are added to the license. Our experts will recommend the optimal number of requests considering the complexity and requirements of your project.

Ispirer Toolkit 10 Icon

Ispirer Toolkit 10
PowerBuilder to C#
Free Demo License

Try Now

Ispirer Migration and Modernization Service (Ispirer Service)

Our experienced team can provide you with a turnkey migration service and convert your entire PowerBuilder application to C#, delivering you a ready-to-use application in due time. Our responsibilities include not only professional analysis, assessment, performance and testing of your migration, but also services such as adding new or changing existing functionality of the application.

If you want to get an intermediate result of the converted PowerBuilder code in the C# language, the Ispirer team will be glad to provide you with a basic migration service. As a result, you will get code that is optimized to the compilable level. Further, you will have to independently bring the application to a fully functional state in accordance with your requirements.

You are free to choose a preferred option. Nevertheless, we can provide an estimate of both the Tool and the Service, and give professional advice.


Conversion Samples of PowerBuilder to C# WPF

PowerBuilder programs consist of Workspaces (starting from PB 8.0 and higher, these are .pbw files). Conceptually, they are similar to Solution. These are text files consisting of paths to the Target files (.pbt files) that correspond to the concept of Project. The Target files are in text format, and each contains paths to the PowerBuilder libraries (.pbl files that store source code files in binary format). Typically a library with the same name as the Target file has a .sra entry point file.

To convert a PowerBuilder application, you need to extract all source files from the appropriate Workspace libraries (or Target, if PB version is less than 8). You can download Ispirer PowerBuilder Metrics to get a statistical report on PB sources, as well as extract source files from PowerBuilder libraries using Workspace, or a set of Target files, or a set of particular PB libraries (.pbl files) that need to be converted.

Once the source code is extracted, for each PowerBuilder library file, a corresponding folder named library will be created with all the source code extracted. The folders will contain source files with the following file extensions:

  • .SRD - DataWindow source files
  • .SRW - Window source files
  • .SRM - Menu source files
  • .SRU - Custom user object source files
  • .SRS - Structure source files
  • .SRP - Data pipeline source files
  • .SRF - Function source files
  • .SRQ - Query source files
  • .SRA - Application source files

Now you can use Ispirer nGLFly Wizard to convert it to your chosen target technology.
Basic source type conversion by extension:

  • .SRD - converted to 3 files in a folder named datawindow_object_name_srd. The files are named datawindow_object_name_srdView.xaml and datawindow_object_name_srdView.xaml.cs – the UI and code of the DataWindow object and file datawindow_object_name_srdViewModel.cs with view model of the DataWindow object.
  • .SRW - converted to 3 files in a folder named window_object_name_srw. The files are named window_object_name_srwView.xaml and window_object_name_srwView.xaml.cs – the UI and code of the Window object and file window_object_name_srwViewModel.cs with view model of the Window object.
  • .SRM - converted to 3 files in a folder named menu_object_name_srm. The files are named menu_object_name_srmView.xaml and menu_object_name_srmView.xaml.cs – the UI and code of the Menu object and file menu_object_name_srmViewModel.cs with view model of the Menu object.
  • .SRU - converted to 1 file named user_object_name_sru.cs for nonvisualobject and to 3 files in folder named user_object_name_sru. The files are named user_object_name_sruView.xaml and user_object_name_sruView.xaml.cs – the UI and code of the User object and file user_object_name_sruViewModel.cs with view model of the User object.
  • .SRS - converted to 1 file named structure_object_name_srs.cs. The file contains a class with variable declarations from the PowerBuilder structure.
  • .SRP - not used for conversion.
  • .SRF - converted to 1 file named function_object_name_srf.cs. The file has a public static partial class AppGlobalFunctions with a converted function.
  • .SRQ - not used for conversion.
  • .SRA - converted to 1 file named application_object_name_sra.cs. The contents of this file are used to copy into the project's entry point file in the same way as in the conversion sample.

After the conversion, you need to create a WPF application desktop project in Visual Studio and add the converted files from the results folder to it. There is the Ispirer framework for converting PowerBuilder to C# WPF (IspirerFramework) in the results folder. It contains 4 or more projects that should be added to the solution and used in the main project with the conversion results as references. The events are converted to the corresponding events of the target technology. Note: this is a special framework provided by Ispirer. It extends the target technology to enable specific source code features.

Variables declarations conversion:

PowerBuilderC#
  1.  
  2. long var1
  3. long var2[]
  4. string var3
  5. datetime var4
  6. boolean var5
  7. decimal var6
  8. integer var7
  9. any var8
  10.  
  1.  
  2. int? var1 = 0;
  3. UnboundedArray < int? > var2 = new UnboundedArray < int? >();
  4. string var3 = string.Empty;
  5. DateTime? var4 = new DateTime(1900, 1, 1);
  6. bool? var5 = false;
  7. decimal? var6 = null;
  8. int? var7 = 0;
  9. object var8 = new object();
  10.  

Function conversion:

PowerBuilderC#
  1.  
  2. public function string sample_function();
  3. return "end"
  4. //do logic
  5. end function
  6.  
  1.  
  2. public string sample_function()
  3. {
  4. return "end";
  5. //do logic
  6. }
  7.  

Subroutine conversion:

PowerBuilderC#
  1.  
  2. protected subroutine sample_sub (string v_app);
  3. v_app = ""
  4. //do logic
  5. end subroutine
  6.  
  1.  
  2. public void sample_sub(string v_app)
  3. {
  4. v_app = "";
  5. //do logic
  6. }
  7.  

If statement conversion:

PowerBuilderC#
  1.  
  2. integer i
  3.  
  4. if true then i = 1 else i = 2
  5.  
  6. if true then
  7. i = 3
  8. end if
  9.  
  1.  
  2. int? i = 0;
  3.  
  4. if (true)
  5. {
  6. i = 1;
  7. }
  8. else
  9. {
  10. i = 2;
  11. }
  12.  
  13. if (true)
  14. {
  15. i = 3;
  16. }
  17.  

For statement conversion:

PowerBuilderC#
  1.  
  2. For lv_count = 1 to 10
  3. lb_units[lv_count].Visible = TRUE
  4. Next
  5.  
  1.  
  2. for (lv_count = 1; lv_count <= 10; lv_count ++)
  3. {
  4. lb_units[lv_count - 1].Visibility = Visibility.Visible;
  5. }
  6.  

While statement conversion:

PowerBuilderC#
  1.  
  2. IDX = 0
  3. do while true
  4. if IDX = 10 then exit
  5. IDX = IDX + 1
  6. loop
  7.  
  1.  
  2. idx = 0;
  3.  
  4. while (true)
  5. {
  6. if (idx == 10)
  7. {
  8. break;
  9. }
  10.  
  11. idx = idx + 1;
  12. }
  13.  

Try catch statement conversion:

PowerBuilderC#
  1.  
  2. try
  3. IDX = 1 / 0
  4. catch (Exception ex )
  5. IDX = 100
  6. FINALLY
  7. IDX = IDX * 2
  8. end try
  9.  
  1.  
  2. try
  3. {
  4. idx = 1 / 0;
  5. }
  6. catch (Exception ex)
  7. {
  8. idx = 100;
  9. }
  10. finally
  11. {
  12. idx = idx * 2;
  13. }
  14.  

Try choose statement conversion:

PowerBuilderC#
  1.  
  2. integer some_id
  3. boolean cond
  4.  
  5. CHOOSE CASE some_id
  6. Case IS < 0
  7. cond = False
  8. CASE 0 TO 2
  9. cond = True
  10. some_id = 200
  11. Case IS > 0
  12. cond = True
  13. CASE ELSE
  14. cond = False
  15. some_id = 0
  16. END CHOOSE
  17.  
  1.  
  2. int? some_id = 0;
  3. bool? cond = false;
  4.  
  5. if (some_id < 0)
  6. {
  7. cond = false;
  8. }
  9. else if (some_id >= 0 && some_id <= 2)
  10. {
  11. cond = true;
  12. some_id = 200;
  13. }
  14. else if (some_id > 0)
  15. {
  16. cond = true;
  17. }
  18. else
  19. {
  20. cond = false;
  21. some_id = 0;
  22. }
  23.  

Inline query conversion:

PowerBuilderC#
  1.  
  2. global type s_2 from structure
  3. long field_1
  4. end type
  5. s_2 param1[]
  6.  
  7. INSERT INTO TAB1
  8. (
  9. COL1 , COL2
  10. )
  11. VALUES
  12. (
  13. :param1[1].field_1,
  14. :param1[2].field_1
  15. );
  16.  
  1.  
  2. public class s_2
  3. {
  4. public int? field_1 = 0;
  5. }
  6.  
  7. UnboundedArray< s_2 > param1 = new UnboundedArray< s_2 >();
  8. var dbCmd_ = new SACommand();
  9. dbCmd_.CommandText = "INSERT INTO TAB1 " +
  10. " ( " +
  11. " COL1 , COL2 " +
  12. " ) " +
  13. " VALUES " +
  14. " ( " +
  15. " :field_1, " +
  16. " :field_1 " +
  17. " )";
  18. dbCmd_.Parameters.AddWithValue("field_1", param1[0].field_1 ?? (object) DBNull.Value);
  19. dbCmd_.Parameters.AddWithValue("field_1", param1[1].field_1 ?? (object) DBNull.Value);
  20. dbCmd_.CommandType = CommandType.Text;
  21. AppGlobalVariables.sqlca.ExecuteNonQuery(dbCmd_);
  22.  

CURSOR conversion:

PowerBuilderC#
  1.  
  2. String v_uname[]
  3. Long v_unum[]
  4. Int v_count = 1
  5.  
  6. DECLARE c_unit CURSOR FOR
  7. SELECT U_NAME, U_NUM
  8. FROM UNT
  9. WHERE A_NUM = 10;
  10.  
  11. OPEN c_unit;
  12. FETCH c_unit INTO :v_uname[v_count],:v_unum[v_count];
  13. v_count ++
  14. Do While SQLCA.SQLCode = 0
  15. FETCH c_unit INTO :v_uname[v_count],:v_unum[v_count];
  16. v_count ++
  17. Loop
  18. CLOSE c_unit;
  19.  
  1.  
  2. UnboundedArray< string > v_uname = new UnboundedArray< string >();
  3. UnboundedArray < int? > v_unum = new UnboundedArray < int? >();
  4. int? v_count = 1;
  5. var dbCmd_c_unit = new SACommand();
  6. dbCmd_c_unit.CommandText = "SELECT U_NAME, U_NUM " +
  7. " FROM UNT " +
  8. " WHERE A_NUM = 10";
  9. dbCmd_c_unit.CommandType = CommandType.Text;
  10. var c_unit = sqlca.ExecuteReader(dbCmd_c_unit);
  11.  
  12. if (c_unit.Read())
  13. {
  14. v_uname[v_count] = c_unit?.GetString(0);
  15. v_unum[v_count] = c_unit?.GetInt32(1);
  16. }
  17. else
  18. {
  19. sqlca.SqlCode = 100;
  20. }
  21.  
  22. v_count ++;
  23.  
  24. while (sqlca.SqlCode == 0)
  25. {
  26. if (c_unit.Read())
  27. {
  28. v_uname[v_count] = c_unit?.GetString(0);
  29. v_unum[v_count] = c_unit?.GetInt32(1);
  30. }
  31. else
  32. {
  33. sqlca.SqlCode = 100;
  34. }
  35.  
  36. v_count ++;
  37. }
  38.  
  39. c_unit.Close();
  40. c_unit.Dispose();
  41.  

Download Sample Code

You have just examined only a piece of the PowerBuilder to C# conversion sample. You can download the entire application migration sample for free by filling out the form. Once you get the code sample, you will be able to:

  • Explore how well Ispirer Toolkit migrates the source code to the target technology without downloading it.
  • Analyze and compare the source sample with your code to understand which components of your application can be automatically converted using Ispirer Toolkit.
  • Run, play with and test an application containing nearly 1,500 lines of code.

See for yourself that Ispirer Toolkit can automatically convert not only a single piece of code, but an entire application. Most likely, complex code will require customization of the toolkit, but our experts can add new conversion rules within 3-5 business days. As a result, using Ispirer Toolkit you will get readable and maintainable code of manual conversion quality in the shortest time possible.

Snatch a totally free opportunity to see the high efficiency of Ispirer Toolkit!

Get your sample code
Enter your name.

Enter a valid e-mail address.

Select your country.

Invalid input.

Get a Quote

Ispirer Toolkit

Reach the maximum level of automation and quality of your conversion with the help of Ispirer Toolkit! Based on your requirements, the Ispirer team will process all customization requests for your PowerBuilder to C# conversion project. We offer several types of Ispirer Toolkit licenses, among which you will find the one that is suitable for you. Each conversion project is considered and discussed separately, prices depend on its scope, duration and complexity.

Ispirer Toolkit 10 Icon

Ispirer Toolkit 10
PowerBuilder to C#

Request a Quote

Ispirer Service

If you don't want to involve your own resources to move the PowerBuilder application to C#, get Ispirer Migration and Modernization Service and we will deliver you an operational and high-quality end-result on time and at a reasonable price. Apart from professional Analysis, Evaluation, Performance and Testing of your migration, we also provide such services as Code Refactoring, Changing Functionality, and Adding Extra Functionality. Each conversion project is reviewed and discussed separately and the final price is a subject to negotiation.

Ispirer Migration Service

Ispirer Migration Service
PowerBuilder to C#

Get an Estimate

Benefits You Get

100% Automation

100% Automation

Due to the customization, the manual work after migration will be minimized or eliminated.

Flexible Pricing

Flexible Pricing

You pay for only what you need: prices depend on the scope and duration of your project.

Optimized Migration

Optimized Migration

You get an intelligent and maintainable code without using any middleware after conversion.

What Our Customers Say

"Beckman Coulter provided as much of the information as we could but there was a lot of functionality that we did not know. This is where Ispirer talents became apparent as they forensically reengineered functionality."

"We are now successfully running live on the new system, with the updated PB apps. I want to express my thanks to Ispirer team. You made this project a success!!! I was happy to work with you and would highly recommend Ispirer!"

"Because of Ispirer and MnMTK, our team was able to devote its time to build the infrastructure for new Java programs instead of spending time on converting code. The produced Java code met all our maintainability, readability and performance requirements."

"This approach was very successful avoiding any confusion at the first stage, and achieved high conversion rate in the end. The project was completed successfully, they say they couldn't make it without MnMTK 2017 and excellent extension support from lspirer."

"At the onset of the engagement the Ispirer MnMTK was expanded to meet the specific requirements of our migration prior to being delivered for our use. Once this phase of the project was complete we were provided with the expanded toolkit."

"We have found the Ispirer team to be knowledgeable and responsive and we have found the tooling to be flexible enough to be easily adapted to our coding conventions."

previous arrow
next arrow
Slider

Get in touch with us!

Have questions about migration from PowerBuilder to C#?

Contact us