Monday, February 24, 2020

IBM i User Group month continues

Another quiet week in the quest to add to the list of IBM i user groups, and their social media accounts.

I have received several communications mentioning various IBM i and Db2 related websites. While some provide value information to the IBM i community, they are not user groups and they will not be added to the list.

I am still hoping there are some more groups, not just within the USA, that do have some kind of presence on the internet that I have not found. If you know of any groups that are not on the list please send me their details via:

Wednesday, February 19, 2020

Additions to Object Statistics table function

Changes to the OBJECT_STATISTICS table function

One of my favorite SQL table functions, OBJECT_STATISTICS, was introduced in IBM i 7.2 and it is something I use on a regular basis to identify unused objects that can be deleted. Over the last two releases of IBM i and numerous Technology Refreshes new columns have been added to this table function making it, in my opinion, better. In this post I am going to describe three of these enhancements, and how I can see them helping me.



One of the things I found using OBJECT_STATISTICS was certain object types' Last Used Timestamp was not updated when the object is used. This would fool me into thinking that it was an unused object that could be deleted as it was not being used. Then I would find all of the other objects of the same type were missing the Last Used Timestamp too. I ended up building a complicated select statement, referencing certain object types and conditioning the values in columns, to make an output table I could then use to find obsolete objects.

Wednesday, February 12, 2020

Calculating prime numbers in RPG

calculating prime numbers in rpg

The germ for this post is from a question that was asked in an interview. This person, a self confessed RPG "fresher", had been asked to write a "RPG free" program to calculate the prime numbers between 1 and 11. This request intrigued me, and made me think what kind of program the interviewer probably wanted, and what I would write if I need to use this at work.

Let me start with the basics, the definition of what is a prime number:

Any integer other than 0 or 1 that is not divisible without remainder by any other integers except 1 and the integer itself

Taken from the Merriam Webster dictionary.

What are the prime numbers in the desired range:

Thursday, February 6, 2020

Migration of developerWorks Technology Refresh information

The migration of content from IBM's developerWorks portal, which was sunset at the end of 2019, continued with Scott Forstie, IBM Db2 for i Business Architect, announcing the migration of two new sites:

As usual great information from IBM, and two sites I will be visiting on a regular basis.

Wednesday, February 5, 2020

Object owner information from SQL View

object_ownership sql view rather than wrkobjown

Tucked within the latest round of Technology Refreshes for IBM i for 7.4, TR1,and 7.3, TR7, was the addition of a SQL View, OBJECT_OWNERSHIP. This View returns the same information as the Work Object Owner command, WRKOBJOWN. I do not use WRKOBJOWN frequently, but I do before deleting an user profile to see which objects are owned by the profile, and an intermittent check on the production libraries to make sure that all of the objects are owned by the generic profile created for this purpose.

Alas, I am restricted on the IBM i partition I use to write these posts to only being able to see objects I own. Therefore, my examples will only show these objects.

The WRKOBJOWN is one of the easier commands to use. I can either just type it at a command line and press Enter, or press F4 to prompt to view the command's parameters.

Monday, February 3, 2020

Second annual IBM i User Group month

looking for information about ibm i user groups

If you are a regular readers of this blog you will know I am great fan of IBM i User Groups, and getting everyone involved with their local group. So much so I created a page of worldwide user groups, and added a link to it at the top of every page of this website.

Last year I started a campaign to update this list of User Groups. For the month of February I asked you, members of the IBM i community, to examine the list and if you knew of any groups that were not listed to let me know about them.

This year I am having the Second annual IBM i user group month. This month, February, I am asking you to do the same: review the User Groups page for any groups that are not listed. I am looking for any of the following information for any user groups:

Wednesday, January 29, 2020

Using SQL to look for record locks

view all jobs locking an object using sql

This is almost embarrassing. I was asked if there is an easy way to programmatically check if an object is being used by another job. I knew the name of the SQL View, but when I searched this site I could find I mentioned it when IBM i 7.2 TR3 was announced, but I did not write anything more about this View. Today I am making amends of that oversight.

The question was is it possible to know which users are using an object. I could just use the Work Object Lock command, WRKOBJLCK, at the command line:


But I needed to be able to retrieve within a program the same information.

Wednesday, January 22, 2020

Copying source statements from IFS files into programs

copy and include source code from members and ifs files into another member

I am sure we are all familiar with using a copy compiler directive to copy source code from a "copy book" source member into another. As we can now edit and compile individual source files in the IFS, how can I insert code from those members into the source code of my source file members?

Below I am going to give examples in my three favorite IBM i programming languages:

I have three files in an IFS folder, MyFolder, that contain snippets of RPG, CL, and SQL that I want to copy into programs in a source file, DEVSRC, in my library, MYLIB. I also have code snippets in other source members I want to include too. How to do it?

Wednesday, January 15, 2020

Retrieving the Host's name using SQL view

getting the system name from a sql view

When I run SQL queries, especially when retrieving system information, it is useful to include the IBM i partition name. I have been using a User Defined Function, UDF, I created to call a CL program to get this information. But looking at my trusty poster of Db2 for i I found the View that gives me the partition's host name and more interesting information.

This View also gives me the IBM i operating system version and release numbers, so I don't have to use the QSS1MRI data area and the DATA_AREA_ table function to retrieve it.

Tuesday, January 14, 2020

IBM Rational Developer for i Hub website

The next part of the process of moving the contents from IBM's now closed developerWorks to other new IBM sites occurred last week, with the announcement of the new Rational Developer for i Hub.

This is wonderful looking website that has put a wealth of information just a few clicks away from the home page. It appears to have everything that would help an existing RDi user, and for someone new to this tool. I have to say excellent work, and thank you, to all involved with creating this website.

You can reach this new site by clicking on this short URL:

This follows the RPG Cafe's new site, which was opened in December of last year.