• August 14, 2020

Building an Application in Bluemix That Accesses Mainframe Data

Rocket Mainframe Data Service for BluemixThis is part 4 of a five-part series on accessing mainframe data from your Bluemix applications.

If you have not yet read part 1, part 2, and part 3 of this series, please review them before proceeding further.

At this point, you (or a system programmer) have installed the Rocket Mainframe Data Service on your mainframe and mapped some VSAM data on the mainframe to a virtual table. You are now ready to access the data from the Bluemix app and build a cloud or mobile app in Bluemix that will utilize the mainframe data for real time access to the all useful Systems of Record.

Before we jump into app development, there is one other point that may impact you. If you are not using Bluemix Local or Bluemix Dedicated, you will need to setup a secure gateway via Bluemix to allow access to the Rocket Mainframe Data Service running on your mainframe. In the secure gateway setup, you should setup a destination with the appropriate host for your mainframe and the correct port for MongoDB access. For a brief introduction, see Bluemix Secure Gateway: Yes, you CAN get there from here!; see Reaching enterprise backend with Bluemix Secure Gateway for more details and setup instructions. The Rocket Mainframe Data Service looks exactly like MySQL or MongoDB to the Secure Gateway client, so you can set it up as if you were setting up a MySQL server or MongoDB server running on-premise.

In this article, we will walk through building an app in Bluemix and configuring the Rocket Mainframe Data service. Optionally, see Develop and deploy a Node.js app for guidance on setting up with the DevOps environment. After you are set up with your Node.js app in Bluemix as shown in the preceding article, you can add the service Rocket Mainframe Data to your app. When you click on the tile for Rocket Mainframe Data to add that service, it will prompt you for a connection string; you can retrieve it by filling out the form Rocket Mainframe Data Service Connection String (www.rocketsoftware.com) above the connection string prompt in the Bluemix console. You can always type it yourself as well (it is a standard JDBC or MongoDB URI). Once you have entered the right information and the connection string is displayed, copy it and paste it in the Bluemix service provisioning dialog. This connection string will become available in your app for establishing connections.

In your app, you can use the following code to load the connection string:

if (process.env.VCAP_SERVICES) {
     var envURI_UP = JSON.parse(process.env.VCAP_SERVICES);
     dbURI =  envURI_UP['user-provided'][0].credentials.connectionstring;
     console.log("ENV VARIABLE: " + dbURI); 

The rest of the code is standard JavaScript code to access MongoDB data. This is why this is such a powerful service. A JavaScript developer who is used to accessing MongoDB APIs will no longer have to worry about data formats and/or languages for the mainframe. He or she will simply access it as if it was MongoDB. Below is a snippet for establishing a MongoDB connection:
mongonative.connect(dbURI, function(err, db) {
  assert.equal(null, err);
  console.log("successfully connected with native mongodb driver for mainframe");

Accessing data is a matter of simply executing a query – just like you would against any other MongoDB database:
var collection = db.collection('vsam_staff');
collection.find({}).toArray(function (err, docs) {

It couldn’t be simpler. We are looking forward to the amazing apps that you will create now that you are able to access the critical Systems of Record with the same ease that you are used to with your Systems of Engagement.

In the next article, we will recount a story about building an IT operational analytics dashboard using Bluemix as the platform and Rocket Mainframe Data as the source. It truly demonstrates the power of Rocket Mainframe Data and Bluemix together. Stay tuned…


Azeem Ahmed 13 Posts

Azeem Ahmed joined Rocket Software in 2003 as a Software Engineer after having graduated from UT Austin. Over the course of past fifteen years, he has held many engineering and management roles. In his current role as Chief Technologist for Cloud, Azeem helps lead Rocket R&D around Hybrid & Public Cloud, is responsible for Rocket’s Cloud strategy, and leads Emerging Tech Research Group focused on Big Data Analytics & Cloud. In addition to this role, Azeem was instrumental in conceiving the Rocket.Build program – an internal hackathon for Rocket Engineers. He continues to direct that program every year for our engineers.


Leave a Comment

Your email address will not be published. Required fields are marked *