What JSON on IBM i Can Do For You

October 14, 2015
Alex Woodie

One of the most compelling new features that IBM added to the DB2 for i database in recent memory is support for JavaScript Object Notation (JSON), which has become the de facto standard interchange format for Web data. John Eberhard, a software engineer in IBM’s Rochester lab, recently led IT Jungle through some of the major capabilities that the new JSON data store can provide to all you IBM i shops out there.

IBM shipped a technology preview of the new JSON store earlier this year with updates to IBM i 7.1 and 7.2. Unfortunately, the JSON store did not move up to become a fully supported feature in the most recent Technology Refreshes unveiled by IBM last week, so native JSON support in DB2 for i will remain on the cutting edge for now. In any case, it’s clear that JSON is on the minds of IBM’s database developers, and therefore it should be on your radar too.

“The primary motivation for using JSON was described in the [2013 developerWorks article] DB2 JSON capabilities, Part 1: Introduction to DB2 JSON,” he tells IT Jungle. “In particular, the use of the JSON store will be most useful in applications where JSON is being used as the transport technology between different systems. The most common case is that of a Web application, where a JavaScript program running in a browser that communicates with a Web server. In this environment, JSON has an additional advantage over other techniques because JSON is easily processed by JavaScript.”

Many IBM i developers are beginning to use JavaScript as a front-end scripting language for developing Web and mobile interfaces. While the backend business logic for these apps remain in RPG, Java, PHP, or other language, the front-end is typically written in JavaScript, and quite often the data format it will use is JSON. The developer doesn’t have to use JSON with JavaScript, but there are many advantages to doing it this way–including the fact that you can now store JSON on DB2 for i.

Eberhard foresees the best use of the JSON store as a way to easily and efficiently interact with a JavaScript on a browser. “In this model, a Web application would be based mostly in JavaScript running on the browser,” he writes via email. “The JavaScript would generate and manipulate JSON that is exchanged with the server. On the server, the JSON API can be used to not only store and retrieve the document, but to interact with the JSON objects directly.”

As Eberhard mentioned, IBM is exposing an API that allows developers to access and manipulate the JSON data stored in the DB2 for i database. That is one way to work with JSON in DB2 for i–the other two being a command line interface for manipulating JSON directly, and a user defined function (UDF) that can be called. (Many third-party software vendors are also supporting JSON in their own ways.)

“For the developer, the most important function is the JSON API, which allows Java servlet-based applications to easily produce and process JSON that is exchanged with Web browser applications,” Eberhard says. Since DB2 for i has support for Java procedures and functions, the JSON API can be called by any other IBM i language that speaks SQL, including RPG, PHP, and COBOL.

The extensibility of JSON is a clear win for developers looking to build modern Web and mobile applications atop the IBM i platform. Developers who are familiar with other NoSQL databases that use JSON data formats–such as Couchbase and MongoDB (the DB2 JSON store actually implements parts of MongoDB’s open source BSON query engine)–should feel at home working with JSON/BSON documents stored on DB2 for i.

But this being IBM–which protects the backward compatibility of its customer’s IT investments stretching back into the decades–you can bet that the JSON DB2 store brings a little something for the operators and administrators tasked with actually running the stuff, too.

“For the business, the DB2 JSON Store allows clients to leverage their investments in DR and HA [disaster recovery and high availability] infrastructure to improve their data availability posture,” Eberhard says. “This point resonates with our clients because we’re bridging between two important business requirements: developer productivity and reliability of service.”

In many ways, the adventure into JSON technology parallels the adventures IBM i shops have taken with XML, which started becoming a big thing around the turn of the century.

“Much like what you saw happen with XML, DB2 for i customers will benefit from having JSON-specific features built into the database,” Eberhard says. “As mentioned earlier, clients can rely upon their considerable investment in DR/HA on IBM i. Even though the JSON collections (documents) are not a column in your favorite table, the data resides in DB2 for i, where you can count on it being there when you need it.”

The JSON data store is an important first step in getting JSON data on the IBM i platform. It also brings clear advantages for IBM i shops looking to develop and use modern Web and mobile applications in the manner that has become an industry standard.

While traditional relational database technology and SQL-based access methods will continue to power many of the internal processes that IBM i servers run on a daily basis, the query and storage methods used to serve data to Web and mobile user interfaces is clearly shifting toward document-oriented designs, with JSON leading the way.

At Fresche, modernization and efficient management of IBM i environments is what we do. It's our specialty. We provide highly experienced modernization services in conjunction with tools such as the X-Analysis suite (for deep understanding of your applications, data models, code complexity, business rules, etc.) and the looksoftware suite (to modernize your application UI and improve the complete user experience). Most IT departments have limited modernization experience and are not aware of all the pitfalls that can occur on a modernization journey. Fresche has already met and overcome most obstacles, including difficulties in testing, project management and integration.

Experience shows that there are six main steps that lead up to a successful modernization effort.

1. Analyze your application environment
In large IBM i shops, it is very likely that no one has a complete picture of the application environment. Knowing what you have - and how it currently supports (or doesn't adequately support) the business - is crucial in deciding how to proceed. There are many decisions involved in a well-planned modernization project, and those decisions cannot be made if you do not have accurate metrics about application and database size, quality and complexity, interdependencies, obsolete and redundant code, backup procedures, etc. Using automated tools like X-Analysis to perform a highly detailed analysis of your IBM i application portfolio provides you with a clear picture of what is used in your system and how. This information is crucial before planning your modernization journey.

In addition, you need to begin evaluating target technologies. Remember that one size does not fit all. Not all of your legacy technology needs to move to the same target technology, and some of it does not need to move at all. Hybrid solutions are the key: rarely is there one monolithic solution to a company's modernization needs.

Consulting an experienced vendor such as Fresche can help you with both aspects of this phase. Through Fresche's Strategy and Discovery service, or even by purchasing X?Analysis, you can learn everything you need to know about your IBM i environment and begin reviewing recommendations for modernization.

2. Find the Right Strategy
There are a variety of modernization strategies, and you need to decide which ones are right to support each part of your business. Among the strategies and solutions:

Retire Some applications can be decommissioned when newer technology on the platform has
superseded the older functionality

Again, help from an experienced vendor such as Fresche can be invaluable in determining how to proceed. Most companies do not have an abundance of modernization skills and experience and benefit greatly from a vendor's knowledge.

3. Align IT Projects to Business Value Creation
Fresche's experience has shown that willingness on the part of IT and some users is not enough to sustain a thorough and on-going modernization strategy. It is absolutely essential to link each modernization project with a business improvement that will benefit one or more parts of the business. As you are building out your strategy, keep the following points in mind:

• What does the business get out of it?

• Move from an IT-centric perspective to a business-centric one

• Existing IT budgets are rarely adequate to fund mid-to-large scale modernization initiatives;
the business will need to sponsor and fund the project

• A professional and strategic approach to the business is required

You must be able to show what business problems you are solving with each part of the modernization project. You must also be able to show business the return on the investment.

4. Define a Phased-Approach Timeframe that Includes Quick Wins
Organizations typically do not like to invest in multi-year programs where the benefits only appear at the end of an extended period, so it's in your best interests to create a milestone-based plan where each milestone shows a specific business value. Establish one or more quick and visible wins early in the process to show business that the modernization strategy has definite and beneficial goals. These quick-win projects can include rapid Web enablement, UI and workflow customization, database modernization (long names, for example), and a published data model. A variety of tools from Fresche and looksoftware can help with all of these projects.

5. Seek input from line-of-business application stakeholders
In fact, this is something that you need to do throughout your modernization journey. We have already stressed how important it is to define projects in terms of their business value. But it is also important to include business analysts and users as early in the discussion as possible to validate the direction that you are considering and to ensure buy-in. Projects that succeed are ones where business analysts fully understand - and are looking forward to - the benefits that the project will provide.

6. Seek External Validation on Strategy and Approach
Planning and running a modernization project is very different from net new development. It requires in-depth knowledge of the existing system and an understanding of where some of the scope creep and problematic areas could potentially arise. We always recommend obtaining external validation of your approach and strategy from sources that specialize in modernization. Fresche can help, no matter what stage of modernization you are currently considering.

Do you have questions? Do you want some helping building your plan?Talk to an expert.