IBM Db2, DBAs and Zowe CLI

Rose Sakach
Zowe
Published in
5 min readJun 4, 2020

A DBA Overview of Zowe CLI and the IBM Db2 Database Plugin for Zowe CLI

{Ecosystem} In 2018, when The Linux Foundation’s Open Mainframe Project (OMP) introduced Zowe to the Mainframe world, the contributors not only introduced Open Source and the power of the open source community to mainframers — the resulting service-oriented software framework dramatically changed the available “tooling” landscape for both DevOps and Modernization efforts associated with Mainframe. The collective Zowe components (z/OS Services, Application Framework, API Mediation Layer, and Command Line Interface) enable off-platform access to mainframe services. The CLI (Command Line Interface) component, which installs on the desktop, enables a platform interaction style often used by Cloud Developers. The look-and-feel is very familiar to Enterprise Architects and Next-Gen Developers — both capable and comfortable working in Command Line.

CLI enables the use of desktop tools

The CLI makes programmatic interaction with APIs and other services much easier, straightforward and very familiar to modern developers. Instead of having to write code against APIs, a developer can use logical CLI commands that can be initiated from their own desktop. Since a developer’s desktop can include a multitude of open source technologies, having “local” mainframe access gives them the ability to leverage them while performing their mainframe work. For example, Mainframe teams can use continuous integration — continuous delivery (CI-CD) pipeline orchestration tools like Jenkins and Bamboo, task runners like Gulp and Gradle, or testing frameworks like Mocha and Jest. They do this by adding Zowe CLI commands into the scripts they’ve written to invoke these tools.

As developers realize they have a need to — and are able to — chain together various repeatable processes they will naturally prefer to create their own pipelines. These pipelines can be simple (compile-link after code save or code check-in) or more complex (compile-link-deploy, execute and validate tests, promote to the next stage etc.). They can be limited to a single developer for personal use, they can be used by a development team, or they can be leveraged by DevOps Engineers responsible for creating and maintaining enterprise CI-CD pipelines.

Simple CI-CD pipeline

Where Db2 fits in

Many mainframe business applications rely on data stored in Db2 databases. The developers responsible for maintaining these applications now have the ability to create pipelines that include creating masked Db2 test data, compiling Db2 programs and testing Db2 programs and Db2 stored procedures. As a DBA responsible for building, maintaining, and managing the Db2 databases associated with these applications, it’s important to understand where developers and DevOps Engineers may want to take their application pipelines and what types of actions can be performed using the Zowe CLI plug-in for Db2.

At the present time, the plug-in offers 3 basic actions: CALL, EXECUTE, and EXPORT. These actions are a result of the use cases most requested by customers and can be invoked using the CLI interactively (i.e. command prompt) or executing them within a script. They include:

  1. Call a Db2 stored procedure
  2. Execute a Db2 SQL query
  3. Export a Db2 table

For the first use case, developers wanted the ability to create test automation for an application that included a Db2 stored procedure initiated from a COBOL program. Specifically, they wanted to be able to execute the stored procedure as part of an automated test included in their CI-CD pipeline. The zowe db2 call command gave them the ability to achieve this goal.

For the next use case, we needed to augment an existing, regularly scheduled automated testing scenario that executed a series of test suites. The goal was to capture the results of the test suites as a step in the CI-CD pipeline. For this we added the zowe db2 execute command to the existing script to invoke several SQL statements. The first issues an insert sql statement that writes the test output from each of the suites to a specified Db2 table. Then, once all output is collected, the pipeline includes another zowe db2 execute command with a select sql statement to obtain the entries that were just added to the table for viewing or programmatic comparison.

We also leverage the zowe db2 execute command by adding it to a pipeline that verifies Db2 table updates were successful after executing a CICS transaction.

The third use case satisfied the request to export the contents of a Db2 table to enable a simple data comparison after a code change.

How DBAs can help

Each of the use cases required specific Db2 interactions to be included as part of an automated script. They are simple use cases meant to describe the possibilities and are by no means, meant to comprehensively cover all use cases associated with interacting with mainframe Db2 applications. The current list of actions included in the IBM Db2 Database Plugin for Zowe CLI represent the beginning of a series of actions that allow Db2 applications to participate in maturing Enterprise DevOps processes. To that end, we welcome the voice of all of the mainframe Db2 DBAs in the Zowe Community to help us to understand their perspective on where application teams struggle specifically with moving mainframe Db2 application changes through the development process and into production. We are anxious for you to share your expertise, to help set direction and ideally help lead the efforts to grow the list of actions available in the plug-in. If this has piqued your curiosity, please consider reaching out directly to share your perspective or better yet, consider taking the next step and join our team!

If you enjoyed this blog checkout more Zowe blogs here

Ask a question and join the conversation on the Open Mainframe Project Slack Channel #Zowe-dev, #Zowe-user or #Zowe-onboarding.

Get started with Zowe CLI with this 5 minute read: https://medium.com/zowe/getting-started-with-zowe-cli-7a29420c6be7

For more information on Zowe, visit https://www.zowe.org

For more information on the Db2 plug-in visit: IBM Db2 Database Plug-in for Zowe CLI Documentation

Try it! Get a sample script: visit Zowe CLI samples repository

Questions? Comments? Got a suggestion for the next use case? Send me an email at Rose.Sakach@broadcom.com

Click the links to learn more about Zowe and more Zowe blogs.

--

--