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: https://ibm.biz/rdi_hub

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

Monday, January 13, 2020

Delete many spool files with one command

delete many spool files all at once

Have you ever wanted to delete many, many spool files with just one command? You know the scenario someone decided to print every invoice that had ever been generated, and now I have several thousand spool files in an output queue. I use the WRKSPLF command to view all of the spool files in the output queue, and starting deleting them one at a time by putting a '4' next to them. As I do this I am thinking there must be a better way?

Could I just clear the output queue? No, that's not possible as there are many other spool files in the same output queue, belonging to other users, that need to be printed or retained.

Wednesday, January 8, 2020

Checking authority to a file using SQL

using sql scalar function to determine if user is authorized to use a file

It was another one of those examples of a find when I was looking for something else. This is a SQL scalar function, SQL_CHECK_AUTHORITY, that returns a single value to inform me if I am authorized to use a file or not.

What is a scalar function? A scalar function is passed one or more parameters and returns a single value.

The syntax is very simple:

  QSYS2.SQL_CHECK_AUTHORITY(library,file)

It returns one of the following values:

Friday, January 3, 2020

IBM YouTube series on PowerSystems myths

I stumbled upon a YouTube series about PowerSystems myths given by Skip Garvin, IBM Lab Services Expert. The goal of this series is to dispel the myths we have all heard, many times, about the perceived short comings of the PowerSystems servers.

These videos are about PowerSystems, and not IBM i. I thought I would share these so we all learn that a public cloud running on x86 servers is not the only future.

The series, to date, comprises of:

Wednesday, January 1, 2020

Happy New Year, and welcome to 2020

The last of the Christmas presents have been opened, and all of the decorations have been taken down and stored away. At the beginning of a new year I always like to reflect on the old year, and look forwards to what is coming.

2019 was another exciting year for the IBM i community. A new release of the operating system became available to us. Accompanying the new release there were another two Technology Refreshes for IBM i 7.3, and the first TR for the new 7.4. These added all kinds of new and exciting features and functions to our favorite operating system, which I have written about in this web site.

The only way I can gauge what you, the readers of this blog, considered the most interesting posts I wrote last year is by looking at the most read. These were:

Thursday, December 26, 2019

Selecting fixed number of random rows in the results

using sql rand to a number of records from a file at random

I have written about using SQL's RAND() to generate random numbers to be included in the returned results, but not to return a fixed number of randomly selected results. In other words I just want five randomly selected rows returned in the results.

In this example I have a file, and yes it is a DDS file, that contains just two fields:

  • COMPANY: company number
  • VALUE: a three long numeric field

For company number 1 there are twenty records with the sequential values 1 – 20.

The request is for, let's say, five randomly selected records for company number 1 only.

Thursday, December 19, 2019

New address for IBM's RPG Cafe

In October IBM's developerWorks website started showing an announcement that it would be closing at the end of 2019. Then last month IBM's Barbara Morris made it known that the contents of the RPG Cafe would be moving to another IBM web site.

Good news! The new RPG Cafe is now online with a very long URL, so I will just say click here.

Having had a quick glance at it, it appears that all of the same information that was available in the old version is also in the new. I have to say I prefer the user interface of the new site.

A big thanks to IBM, and everyone else involved with this, for preserving the RPG Cafe information.

Wednesday, December 18, 2019

Equivalent of DSPPGM and DSPSRVPGM using SQL part 2

using bound_module_info and bound_srvpgm_info sql views to list objects bound to programs

At least once a day I use the Display Program command, DSPPGM, and the Display Service Program command, DSPSRVPGM, to look at the service programs and modules bound to ILE programs and service programs I am analyzing. While the command give me the information I need the latest Technical Refreshes, IBM i 7.4 TR1 and 7.3 TR7, gives me another way to get the same information from two new SQL views:

  1. BOUND_MODULE_INFO
  2. BOUND_SRVPGM_INFO

In this post I am going to describe how I would use them to replace what I do with DSPPGM and DSPSRVPGM commands, and a few other pieces of information I have found that these Views make it easy for me to get to.

Tuesday, December 17, 2019

Equivalent of DSPPGM and DSPSRVPGM using SQL part 1

dsppgm and dspsrvpgm command data from sql views

I am sure we are all familiar with the Display Program, DSPPGM, and with the Display Service Program commands, DSPSRVPGM as a way to get all sorts of information about the program or service program entered. My two biggest complaints about these commands are:

  1. I can only get the information for one program at a time
  2. The only output options offered are display or print, no output to file

With the latest Technology Refreshes, IBM i 7.4 TR1 and 7.3 TR7, there are a number of new Db2 for i, or SQL, Views to give me the same information I was getting from the commands.

In this post I will be describing two of these Views: