Getting started
In the next six steps, we are going to explain the conversion process.
Step 1: Search for .exe path
In the PBJava tool's folder, open a command prompt window and search for the file Artinsoft.Pb2Java.Runner.exe. Paste the .exe path into the command prompt.
Step 2: Add input folder
After pasting the .exe file, type in the command prompt the input folder where the PowerBuilder source code is located. To specify this folder, use the -i argument.
Example:
Step 3: Add output folder
Up next, add the output folder where you want your migrated code to be generated. To specify this folder, use the -o argument.
Example:
Step 4: Add package
Then, enter the name of the package you want to appear in the generated code. To specify this package, use the -p argument.
This argument generates the name of the package.
Example:
The line before generates the following code:
Step 5: Start the migration process
Press the Enter key to start the migration.
You will see all the tasks the conversion tool goes through to successfully migrate the code. Along with those tasks, the tool provides the percentage of completion of the conversion process at the moment.
PBJava also provides some code conversion statistics such as number of lines migrated or not migrated, number of parsing errors, number of conversion errors, number of libraries, etc.
After the successful conversion of the code, the command prompt will display a summary of the conversion process. This summary shows the performance of each task processed by the conversion tool.
Step 6: Review migration folder results
Now that the migration is finished you can go to the output folder to check the generated files and folders. You will find the following:
ReferenceApplication: This is the web application.
Target: The target folder contains all the Java classes generated by the Conversion Tool.
TmpFiles: Temporary files used in the conversion process. You can delete those files.
WebApp: this folder contains the HTML and CSS files generated.
messages.properties: This file is used to map some label texts in case you need to use a different language.
Pb2JavaEwis.xml: an XML file that contains a list of errors, warnings and issues that occurred during the conversion process.
tmpstringsfile.txt: This file is used to map some label texts in case you need to use a different language.
Arguments
An argument is a type of indication that you provide to configure the tool so that the code can be successfully converted.
In this section you will find all the arguments options you have to configure PBJava.
Required Arguments
The following arguments are required to run the tool:
-i
Input folder path of the .pbt file **
-o
Output folder path for the migrated code
-p
Name of the package for the source code
** If there are two or more .pbt files in the path name, extension and -t argument must be indicated.
Optional Arguments
-s
Path of the serialized symbol table of sharedlibraries
-t
Indicates that the -i argument contains the file name
-q
List of SQL parsers separated by ";"
-r
This is the path of the configuration files, Config.xml and pb.ini **
-f
Temporal argument to fix specific SQL Sybase statements with joins or Informix statements
** These files contain specific configurations and customizations.
Argument -s
This argument is used to migrate PowerBuilder application or target containing only shared libraries while avoiding duplicate migrated code. As we know .pbl libraries can be shared by multiple targets. If the -s argument is not indicated and there are targets using the same libraries, then each target will migrate that same library causing duplicated libraries.
To avoid this behavior, creating a target with all the shared libraries on a new PowerBuilder application is required. This new target should compile without errors. The -s argument for the rest of the target must have the path where share libraries target was migrated.
To migrate the shared library target, both arguments, -o and -s will have the same path.
Example:
Shared libraries target
-i C:\source\sharedLibrary -o C:\migration\sharedLib -s C:\migration\sharedLib
Now, to convert the other targets using the migrated shared library, use the shared library migrated path in the -s argument. The tool will use the migrated code in the sharedLib folder to be able to migrate other targets that make reference to the shared library.
Example:
Normal target using migrated shared library
-i C:\source\target -o C:\migration\target -s C:\migration\sharedLib
Argument -t
If the -t is specified, the name of the pbt file should be included on the -i path. Example:
If -t is not specified, the migrator will find and migrate all the pbt files on the -i path. Example:
Argument -q
You can specify which parsers you want to use to migrate code. The supported parsers are Oracle (Ora), TSQL (TSql) and Sybase (Sy).
The default parser is Oracle. If the -q argument is not specified, the migrator will use Oracle parser to parse all SQL statements in the code.
If you want to specify more parsers, in case of not supported statements, you can use the following command:
In this case, if the migrator is not able to parse the code with Sybase, then it will do it try with Oracle. If it also fails, then it will use TSQL.
Argument -r
Using this argument, you can load an XML file with configuration details needed for the migration. For example, the XML file may include which datawindows need to be converted to pdf (reports) or background colors to be excluded. Also, with the useOnlyFreeForm
configuration you can migrate all the dataManagers as FreeForm
.
Example of the config file:
Argument -f
This argument is temporal. It will be removed after Sybase and Informix parsers are finished. If you need to use the Sybase parser, you must specify -f Sy, to convert Informix statements use -f Informix