By Katherine Soohoo, Kendrick RenWith IBM Db2 for z/OS Developer Extension in VS Code, users can create Db2 connection profiles and run SQL against a Db2 system. The SQL statements can exist locally in a file or on z/OS with the help of the Zowe Explorer extension.
The following instructions describe how to run SQL statements on your local machine or on z/OS.
The Db2 Developer Extension is required to run SQL statements on your local machine.
This step is required if there is more than one connection profile defined.
In the editor with the SQL file, right-click to open the context menu and choose Run Options.
Specify custom run options, then click the Save button when finished.
In the editor with the SQL file, right-click to open the context menu and choose Run All.
Note: To run a subset of SQL statements within the file, highlight the SQL statements you wish to run then right-click and choose Run Selected.
If host variables were present in the SQL statements, an additional tab will be revealed to specify the host variables values. After filling in the values, click the Finish button.
After the SQL has finished running, the results of the execution will be revealed in another tab. The results of the execution will also be saved in the QUERY HISTORY view of the Db2 Developer Extension view.
The features provided by Db2 Developer Extension can also work together with Zowe Explorer extension on the SQL statements which are stored in the data sets or the files in Unix System Service (USS). You can run the SQL statements in the data sets or the USS files in the same way. Zowe Explorer extension is used to access the data sets and the USS files on z/OS.
Install Zowe Explorer in VS Code.
Go to the Zowe view by clicking on the icon in the Activity Bar.
Add a profile under DATA SETS or USS. Refer to the Zowe Explorer Profiles docs for more information.
Open the sequential or PDS/PDSE data sets or USS files containing the SQL statements.
Note: The lowest level qualifier of the data sets should be ending with "SQL". If you are using PDS or PDSE data sets, customize files.associations in settings.json with the content below.
Follow the steps in the previous section to create a Db2 connection profile and run SQL with the Db2 Developer Extension.