Db2 & Data Gen Setup
This setup is required to perform the Transform use case.
Provisioning WCA service & cloud Db2 database ( Techzone )
A DB2 instance will be provisioned for you in the techzone ibm cloud account.
Configure DB2 Cloud
- Once the instance is ready, click on the instance name to go to the Details page
- Go to Service credentials -> New credential to create new credentials
- These will be used later to connect ADDI to this database: username, password, hostname and port. By expanding the section you can see the contents
- Follow the Db2 for LUX prerequisites guide
Extract and install the IBM Service client 11.5 (Windows x64 version) on the Windows VM. This should allow you to connect ADDI to the IBM Cloud DB2 instance.
- Continue to the Testing DB2 connectivity from ADDI section
Provisioning watsonx Code Assistant service and cloud Db2 database ( Non - Techzone )
Provisioning watsonx Code Assistant in IBM Cloud Follow the instructions in techzone to get access to and set up the watsonx Code Assistant service to use transformation in a POC.
Create the DB2 instance
- Log in to IBM Cloud using your IBM ID
- Go to https://cloud.ibm.com/catalog/services/db2
- Select Enterprise plan
- Enter a recognizable name for your instance, enter this into the “Service name” field
- Select default values for the rest of the fields
- Agree to the license terms and click Create
- Go to the Databases section of https://cloud.ibm.com/resources and wait until your instance is ready
Configure DB2 Cloud
- Once the instance is ready, click on the instance name to go to the Details page
- Go to Service credentials -> New credential to create new credentials
- These will be used later to connect ADDI to this database: username, password, hostname and port. By expanding the section you can see the contents
- Go the Db2 UI by clicking Manage -> Go to UI
- Click Ok on the pop-up to enable the data administration features
- To prepare the database, you need to execute a SQL script that you can get from ADDI
- On the Windows VM, go to
C:\Program Files\IBM Application Discovery and Delivery Intelligence\IBM Application Discovery Build Client\Bin\Release\DBScripts
- Copy the contents of the DB2LUW_CreateObjects.sql script
- In the Db2 Cloud UI, click on Run SQL icon, from the list of tools in the left
- Paste the contents of the script in the empty SQL file, save and name it if you want
- Click Run all
- Wait for the script to complete (can take up to 20 min)
- Verify all script steps ran successfully, all must be green Configure ADDI for connect to Db2 Cloud Install and Configure Db2 driver:
- In the Db2 Cloud UI select administration -> connections -> Windows
- Click on driver list and click Download next to the IBM Data Server Driver Package
- On the Select fixes page, select
IBM Data Server Driver Package (Windows/x86-64 64 bit) V11.5.8 Fix Pack 0
- Click continue
- Select
Download using your browser (HTTPS)
- Click continue
- Download the
v11.5.8_ntx64_dsdriver_ALL_LANG.exe
to your Windows VM - Install the driver using the default options
- Open a command prompt on your Windows VM and enter the following commands (you can get the host name and port number from the Db2 Cloud UI
at administration -> connections -> Windows):
db2cli writecfg add -database bludb -host <Db2 hostname> -port <port>
===============================================================================
db2cli writecfg completed successfully.
===============================================================================
db2cli writecfg add -dsn dashdb -database bludb -host <Db2 hostname> -port <port>
===============================================================================
db2cli writecfg completed successfully.
===============================================================================
db2cli writecfg add -database bludb -host <Db2 hostname> -port <port> -parameter "SecurityTransportMode=SSL"
===============================================================================
db2cli writecfg completed successfully.
===============================================================================
- On the Windows VM, go to
Testing DB2 connectivity from ADDI
- From the ADDI dashboard, go to Configure ->
name of your environment
-> Servers and security -> Relational database server- Click Add
- Enter a name
- Select
IBM Db2
as database server type - Enter the Db2 Cloud hostname (you can get both hostname and port number from administration -> connections -> Windows in the Db2 Cloud UI)
- Enter the Db2 Cloud port number
- Check Use TLS
- Enter the name of the database
- Enter the username and password from the credentials of the Db2 Cloud instance
- Click Test connection to check if everything works
- If the test is successful, click Save
Create a COBOL services ADDI project that uses Db2 Cloud
After you have defined the Cloud Db2 database to ADDI, you can now create an ADDI project and associate it with the Db2 Cloud database. This project is for the COBOL services that will be transformed to Java by the AI. For transformation to work means scanning and populating the Cloud database with metadata about those COBOL services.
- Create a new project
- Open the IBM Application Discovery Build Client
- Go to File -> New Project
- Choose
Mainframe main languages
as project type - Enter a project name
- Select
IBM DB2 LUW
as DB Type and for Server Name select your previously created Db2 Cloud instance - Check Attach to database
- Enter the database name
- Click Next.
- For the project folders you can accept the default and click Finish
- Add project files
- Clone the COBOL services Git repo that you created to the Windows VM. Unless you have already added some code, you should have empty directories for the COBOL source, copybooks, and DDL.
- In the Windows file explorer go to the project path
C:\IBM AD\Mainframe Projects\<Your Project Name>
- Copy Cobol programs directory to zOS Cobol and Cobol copybooks to Cobol Include
- In the Build Client, right click on zOS Cobol -> Add all files from folder -> Check that the Folder path is the one where you copied the Cobol programs, then click OK
- Do the same for Cobol Include
- Build the project (Build -> Build Project)
- When asked if you want to run the CHECK project first, select
No
- When asked if you’re sure you want to perform the build because it will erase the database, select
Yes
- When asked if you want to run the CHECK project first, select
- Go to the ADDI dashboard -> Configure -> Select your environment -> Services -> File Service -> Add +
- Insert the (same) project path for both Remote and Local
- Click Save
- In the ADDI dashboard restart the File service
Setting up the Data Generator
The Data Generator component is supplied as a zip file with the Refactoring Assistant. When you download the Refactoring Assistant and unzip it, you
should see a WCA4Z-Data-Generator
zip file.
Install Data Generator
- Copy the
WCA4Z-Data-Generator
zip file to your Windows VM. - Unzip the file (Right click --> Extract All...) using
C:\Program Files\IBM Application Discovery and Delivery Intelligence
as the destination folder - After the extraction is done, you should have a new folder
WCA4Z Data Generator
inC:\Program Files\IBM Application Discovery and Delivery Intelligence
Configure Data Generator
You should have already set up project synchronization for ADDI, but a sample sync file is shipped with the data generator in case you need it. The end to end scenario includes instructions on how to update the synchronization file to include the COBOL services Git repo. So for now, you need to configure the data generator to know which ADDI project you are using for COBOL services, the location of the cloned Git repository and the location of the DDL within the cloned Git repository.
-
Go to
C:\Program Files\IBM Application Discovery and Delivery Intelligence\WCA4Z Data Generator
and open theconf.properties
file- Edit the values to match your Configuration:
- ADDI_PROJECT_NAME should have the name of the ADDI COBOL services project you created earlier
- ADDI_PROJECTS_FOLDER is the folder where ADDI places all your project files
- PROJECT_GITHUB_CLONE_FOLDER is the folder where you cloned the Github project that contains the COBOL source code, e.g.,
C:\git\wca4z-extracted-services
- DDL_FOLDER is the DDL folder inside the Github project, e.g.,
C:\git\wca4z-extracted-services\DDL
In summary, here is an example of a completed
conf.propertie
s file:ADDI_PROJECT_NAME=ExtractedServices1
ADDI_PROJECTS_FOLDER=C:\IBM AD\Mainframe Projects
PROJECT_GITHUB_CLONE_FOLDER=C:\git\wca4z-extracted-services
DDL_FOLDER=C:\git\wca4z-extracted-services\DDL - Edit the values to match your Configuration:
-
Open a command prompt and go to
C:\Program Files\IBM Application Discovery and Delivery Intelligence\WCA4Z Data Generator
-
Enter
automation.bat
to run the script. Note that if the cloned Git repo isn’t populated with content because you are going to do the end to end scenario, then you don’t need to do this step at this time.. -
In case of any error, you can consult the
runControlFlowGenerator.log
file, that contains the output of the script execution
Z Open Editor VS Code extension
To use the generative AI capabili4es to transform COBOL to Java, you need to install Visual Studio Code. It’s free to download from the Internet. Once installed, you can use the Extensions marketplace to install the Z Open Editor extension from IBM and the Java Language Server extension from RedHat. The Z Open Editor extension gives you support for COBOL editing and working with watsonx Code Assistant. The Java extension gives you support for working with Java. VS Code has Git support built in.
Install the VS Code extension:
- Open VS Code and go to the Extensions section (in the left side bar, click on the four little squares)
- Search for
Z Open Editor
and click Install. - The installation starts automatically.
- If the extension is disabled after the installation, this is probably because the workspace isn’t trusted yet:
- Click on the little shield symbol
- In the new tab that opens click on
Trust Workspace
- The extension should now be enabled
- Close the window to make the sections go into effect
Configure the extension
- In the Welcome to Z Open Editor welcome page, expand the section
New: IBM watsonx Code Assistant for Z in Z Open Editor
and check the box to enable watsonx Code Assistant support. - Go to the Explorer view and you should see a section called IBM WATSONX CODE ASSISTANT FOR Z in the Explorer view.
- Click on the cog wheel to add your API key. You created your key when you set up the watsonx Code Assistant service. If you ever want to delete your API key, simply enter a blank to reset. You are now ready to start walking through a use case to refactor and transform a COBOL service to Java. The end to end use case uses GenAPP, a sample Application.