# Getting started

In the next six steps, we are going to explain the conversion process.

## Step 1: Search for .exe path <a href="#step-1-search-for-exe-path" id="step-1-search-for-exe-path"></a>

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 <a href="#step-2-add-input-folder" id="step-2-add-input-folder"></a>

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:

```
-i C:\source\target1.pbt
```

## Step 3: Add output folder <a href="#step-3-add-output-folder" id="step-3-add-output-folder"></a>

Up next, add the output folder where you want your migrated code to be generated. To specify this folder, use the **-o** argument.

Example:

```
-o C:\migrated
```

## Step 4: Add package <a href="#step-4-add-package" id="step-4-add-package"></a>

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:

```
-p a.b
```

The line before generates the following code:

## Step 5: Start the migration process <a href="#step-5-start-the-migration-process" id="step-5-start-the-migration-process"></a>

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 <a href="#step-6-review-migration-folder-results" id="step-6-review-migration-folder-results"></a>

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 <a href="#arguments" id="arguments"></a>

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 <a href="#required-arguments" id="required-arguments"></a>

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 <a href="#optional-arguments" id="optional-arguments"></a>

|    |                                                                                                   |
| -- | ------------------------------------------------------------------------------------------------- |
| -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 <a href="#argument--s" id="argument--s"></a>

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 <a href="#argument--t" id="argument--t"></a>

If the **-t** is specified, the name of the pbt file should be included on the -i path. Example:

```
-i C:\source\target1.pbt -o C:\migrated -t
```

If **-t** is not specified, the migrator will find and migrate all the pbt files on the **-i** path. Example:

```
-i C:\source -o C:\migrated
```

#### Argument -q <a href="#argument--q" id="argument--q"></a>

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:

```
-i C:\source\target1.pbt -t -o C:\migrated -q Sy;Ora;TSql
```

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 <a href="#argument--r" id="argument--r"></a>

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`.

```
-i C:\source\target1.pbt -t -o C:\migrated -q Sy;Ora;TSql -r C:\source\config.xml
```

Example of the config file:

```


    
        
        
    
    
        #C0C0C0
    
    
        true
    

```

#### Argument -f <a href="#argument--f" id="argument--f"></a>

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**

```
-i C:\source\targe1.pbt -t -o C:\migrated -f Sy
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/webmap/powerbuilder-to-java/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
