Friday, December 02, 2016

DB2 for i Services - a great tool for system administration

System management on the IBM i has always been easy - there are commands to list and work with every object type on the system. And when you needed to work with a list of objects, most of the commands supported an file parameter, so you could dump the list into a file and extract and manipulate the list from the file as you wished.

However, some of the commands used for system management does not have the option to write the list to a file. Instead you had to use an API to retrieve the list, which could mean that you had to read a complex API documentation and understand all the parameters for the API and how to work with user spaces or wherever the output from the API was placed. This was tedious and error prone and few people had the knowledge, time and energy to accomplish that.

IBM wanted to make it easier to manage the IBM i for people without extensive knowledge of the system, and they combined the existing API's with an excellent tool for handling and manipulation lists - SQL! IBM added SQL views and table functions to list object and system information, and now the information was easy to work with - just fire up a SQL prompt and select data from the table function, that gives you the wanted information. Since you're using SQL to retrieve the list of information, all the SQL facilities like selecting, grouping, ordering, joining etc. are at your disposal. IBM even found a great name for these new system management functions: "DB2 for i Services". You can also see it named as "IBM i Services" or "SQL Services".

The services are documented at the DeveloperWorks website. In the beginning the number of services was small, but since the start some years ago the number has increased substantially and the list of services has grown tremendously. Take a look of the services available on DeveloperWorks and you will surely find one or more, that you can use to great benefit. Even if you are not on the latest and greatest version of IBM i, there will be services available to you even at IBM i 6.1!

IBM has even provided samples of the DB2 for i Services in the Access Client Solutions product - the replacement for IBM i Access for Windows. The Run SQL Script plugin has a whole bunch of samples ready to be insert into the SQL editor. Just go to the menu Edit and select "Insert from Examples", and you will get a long list like this:


Click on the one you want, and a sample of a SQL statement returning the selected information will be insert into the typing area of the Run SQL Script window.


Go ahead and explore the services and see what IBM has made available for you. In an upcoming post I will show how you can make your own services like the ones that IBM has created.

Until then - have fun!


4 comments:

Anonymous said...

Hello there! I could have sworn I've been to this website before but after
checking through some of the post I realized it's
new to me. Anyhow, I'm definitely glad I found it and I'll be bookmarking and checking back often!

Anonymous said...

Appreciate this post. Let me try it out.

Anonymous said...

Hey there, I think your site might be having browser compatibility issues.
When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it has some
overlapping. I just wanted to give you a quick heads up!

Other then that, fantastic blog!

Anonymous said...

I've been surfing online greater than 3 hours these days, yet I never found any attention-grabbing
article like yours. It's lovely worth enough for me.
Personally, if all website owners and bloggers made good content as you probably did,
the internet will probably be much more useful than ever before.