How to Setup a Cross-language Analysis (PowerBuilder + DB Code)

This tutorial shows how to setup a Visual Expert Project including both PB + DB code (Oracle, SQL Server…). It includes 3 main steps:

  1. Add your PB code
  2. Add your DB code
  3. Configure the VE project to analyze PB to DB dependencies thoroughly

Before starting, please check the following requirements:

  • Update your installation with the latest Visual Expert 2016 build.
  • Include only 1 set of PB code in your VE project (a PB target, OR a set of files/folders containing the PB code).
  • Include only 1 set of DB code in your VE project (by connecting to the DB, OR selecting files/folders containing the DB code).

Please note: you can include several PB applications in a single VE project; however you cannot include DB code as well. VE will not be able to analyze PB to DB dependencies properly with multiple PB applications.

Step1 – Adding PB code

  • Open the Project Wizard: [file – New Project]
  • Select “PowerBuilder” > choose your version of PowerBuilder
  • Include your PB code using either “Target” or “folders/files”

Source Code Location

  • Once your PB code is selected, click “Next”
  • Select “Add more code in your VE project”. This will take you back to the code selection pages.

Add More Code

Step 2 – Adding DB Code

  • Choose your database:

Add More Code

  • You can include code by connecting to either the DB or selecting file/folders.

DB code source

If you choose the First option, you can filter DB objects from your database:
you may not want to analyze all system objects, functions, tables, etc. but only your own code.

Filtering by DB owner is usually a good start:

select db objects

  • Once your DB code is selected, click “next” > select “Continue Setup”

continue setup

  • Name your VE project
  • Set the scheduler to refresh your analysis automatically
  • Select “Open Project Setup”

Open project setup

Step 3: Configure the project to thoroughly analyze PB to DB dependencies

Why this step?

Consider the following SQLs:

Select  firstname,  lastname  from  employee 
Select  firstname,  lastname  from  myschema.employee 

This basic example creates ambiguity:
By default, Visual Expert cannot know whether employee and myschema.employee refer to the same table. Unless we remove this ambiguity, Visual Expert will duplicate the table employee.

To avoid this issue, VE needs a default DB schema:
In the example above, if VE knows that myschema is the default schema, then implicitly employee is the same as myschema.employee, and the table employee will not be duplicated in the VE project.

  • Open the tab “Project – Source Code Location” (screenshot)

  • Select the first item in the table – click on “Default DB Items” – enter the name of the default Server, Database and Schema.

  • Select the second item in the table (second language) - click on “Default DB Items” – enter the name of the default Server, Database and Schema.
    Important note: it is key to specify these settings for both types of code (PB and DB). They rely on 2 separate code parsers, both of them should connect the DB Objects referenced to the right schema.

  • Click OK, close the settings window and launch the code analysis as prompted by VE.

  • After the analysis is completed, you should see objects based on each languages included in the project. For instance:


 

 

PowerBuilder, Oracle, Impact Analysis, VE 2016