Wednesday, August 10, 2022

A better way to find which file an Alias was built for

find alias llibrary file member

Earlier this year I described a way I could retrieve the schema/library and table/file that a SQL Alias had been built over. over the last few months I have discovered several other ways that will allow me to easily get to that information, and even the member too.

I tend to use SQL Alias for coping with SQL's inability to easily handle multi member files. I could use the Override Database command, OVRDBF, too but I prefer the ease of using the Alias as I can create, use, and then delete the alias all within the same program.

Before I start showing examples, I am going to need to create an Alias, ALIAS_3. Here I am going to create an Alias that will based on the source file DEVSRC, in my library MYLIB, and the source member TESTRPG:


Wednesday, August 3, 2022

Copying multiple spool files into one PDF

The task came in: I needed to take many spool files from an output queue and convert them into just one PDF. I have written about converting individual spool files into PDF, but now there was the need for the to be only one PDF.

My solution would need to:

  1. Merge all of the spool files into one spool file
  2. Convert the one spool file into a PDF in the IFS

Both of these I have done separately on many occasions; this was the first time to do them together.

I cannot use the spool files I used for this task, but I have two spool files in my personal output queue:

Tuesday, July 26, 2022

Which files are used by a Query?

query files used

This is a question I am asked enough for me to want to write this so I can direct the askers here. The question is:

How can I discover the files used by all the Query/400 objects in a library?

The Query/400 object is called a Query Definition, and is the following object type: *QRYDFN

To generate a list of the files they use is a two-step process.

The first process is to create an output file that contains the data. I use the Display Program Reference command, DSPPGMREF, to generate the output file. If I wanted to list all the files used by all of the Query definitions in the library MYLIB I would use the following:

Wednesday, July 20, 2022

Access System Directory information via SQL

system directory entries

I was asked for a list of all the enabled user profiles that are enrolled in the system directory on a partition. I know I could use the Display Directory Entry command, DSPDIRE, to create an outfile of the information:


Surely I would only want to retrieve the information for enabled profiles, or perhaps have a way to validate if a single user profile is enrolled in the system directory.

After some poking around I found a number of files in the library QUSRSYS that would give me the information I wanted. As the data is in files I can use SQL to get data and format the results in a way I would want, in real time.

Monday, July 18, 2022

Merlin comes to 7.3

ibm merlin ibmi 7.3When the announcement for IBM i 7.5 was made we were introduced to Merlin. This was made available for IBM i 7.4 TR6 too.

I do not remember there being any mention of Merlin being made available for earlier releases. It appears that I missed something as earlier this month IBM announced that Merlin would be available for IBM i 7.3 too.

For more information you will find the announcement here.

Personally I think this is a great move by IBM to broaden the number of their customers who can use Merlin, as there still are a lot of companies still running IBM i 7.3 on their partitions.

Wednesday, July 13, 2022

Find how to update the long comment column

sql comment on

Those of you who have used the SYSCOLUMNS and SYSTABLES views must have noticed that there is a column called LONG_COMMENT. On the partitions I work on this column is usually null. What is purpose of this column? And how is it updated?

A quick search in IBM's documentation introduced me to the COMMENT ON SQL statement. Before I give examples of how to use it, I am going to need a SQL DDL table to use:

07     FIRST_COLUMN  IS 'First               col',
08     SECOND_COLUMN IS 'Column              heading'
09  ) ;

11     FIRST_COLUMN  TEXT IS 'First column',
12     SECOND_COLUMN TEXT IS 'Column text'
13  ) ;

14  LABEL ON TABLE FIRST_TABLE IS 'This is the first table' ;

Tuesday, July 12, 2022

New Power10 Servers announced

new power10 servers

September last year IBM announced the first of the Power servers that included the Power10 chips, the E1080.

Today more Power10 based servers have been announced. All of these are smaller than the "flagship" E1080, but still pack considerable power (pun intended).

Click on image to see larger version

I am sure all of my regular readers know that I am "software" guy, not "hardware". Rather than embarrass myself, by not explaining the new servers features properly, I am giving you the links I have found about these new servers.

A big disappointment is that the newly announced E1050 will not run the IBM i operating system.

Wednesday, July 6, 2022

New SQL Table Function for Activation Group information

activation group ACTIVATION_GROUP_INFO

New release IBM i 7.5 and the corresponding Technology Refresh for 7.4, TR6, has given us a SQL Table Function that allows us to see information about the active activation groups within a job. In the past I have been able to get this information using the Work With Job command, WRKJOB:


The output options are limited to display ( * ) or printed output ( *PRINT ). For years I have taken printed output from commands and broken them apart into files either using SQL or RPG. It is nicer to have a View or Table Function where I do not have to do this anymore.

Wednesday, June 29, 2022

Change to Create Table statement to stop accidental deletion of the Table

stop table delete with restrict on drop

It is always a danger that someone will accidentally drop (delete) the wrong file, not maliciously just accidentally.

02    (COLUMN1 CHAR(1)) ;


Statement ran successfully

Within the new release of IBM i 7.5 is an addition to the Create Table statement that can prevent this. This does appear to be only in 7.5, I cannot find a mention of this in the documentation for IBM i 7.4 TR6.

This addition to the Create Table statement is: WITH RESTRICT ON DROP

Tuesday, June 28, 2022

Moving content of data structure into an array

data strucutre subfields in array

I have been asked this same question a few times during the last couple of weeks: What is easiest way to move data from a data structure's subfields into an array?

Asking some other people I know how they would do it, several of them did not know of this simple way.

Here is the start of my code: