Wednesday, May 31, 2023

Remove the need for procedure prototypes

This is another example of something in RPG that almost slipped by me. I now have a way not to have to define a procedure prototype in the procedures' member. All I need is the procedure, and the RPG compiler does its "magic" to do what ever it does to make this possible. This is made possible by the addition of a new control option and parameter in the procedure declaration.

The addition to the control option is a new option REQPREXP, which allows one of three values:

  • *REQUIRE:  All procedures are required to have a prototype (DCL-PR)
  • *WARN:  If a prototype is not found for a procedure a warning error, severity 10, is received when compiled
  • *NO:  Procedure prototype is not required for the main and exported procedures

Tuesday, May 30, 2023

Another study shows the benefits of IBM i

Forrester Consulting was commissioned by IBM to perform an assessment of the benefits of the IBM i operating system. The result was one of Forrester's trademark "Total Economic Impact" assessments, determining the cost savings and business benefits of using IBM i.

The report can be read by clicking on this link here.

I have already downloaded and emailed this to my Vice President and CIO to reinforce the benefits of continuing to enhance our IBM i strategy.

If you work amongst naysayers who keep saying "The AS400 is dead", this would be a useful document to have and share with your management to show that IBM i needs to remain part of your employer's business strategy.

Wednesday, May 24, 2023

Using TO_CHAR to format timestamps

I use the SQL scalar function TO_CHAR all of the time to format numbers, inserting thousand separator characters. I can also use it for formatting timestamps.

In the following examples I am going to show how easy this, and it appears to duplicate a lot of the functionality of the EXTRACT scalar function.

In these examples I am going to show what I can do with a timestamp column, TIMESTAMP1, in a SQL DDL table, TESTTABLE.

Let me show you some examples of what I can do.

Tuesday, May 23, 2023

Why do my SQL results show pointer?

At least one a month I get a question that is something like this:

My SQL results do not look like yours, mine have the word pointer in them. Why?

This gives you away as someone who is still using the old Start SQL command, STRSQL, interface in your 5250 emulator session, rather than Access Client Solutions' Run SQL Scripts. I am pretty sure that the vast majority of us are using ACS for our 5250 "green screen" sessions, so why are you still using STRSQL when Run SQL Scripts is there too?

Friday, May 19, 2023

Latest Db2 and RPG TR PTFs out today

In the IBM i world does "Christmas" come twice a year when the PTFs for the Spring and Fall Technology Refreshes are delivered? I think so!

Today the PTFs for Db2 (SQL) and RPG are released for the latest Technology Refreshes, IBM i 7.5 TR2 and 7.4 TR8.

The base operating system PTFs for these TRs became available on the May 8, 2023, but they did not include any of the changes and enhancements to Db2/Database or RPG.

Wednesday, May 17, 2023

Capturing errors within ON-EXIT

Having been busy recently performing presentations to various user groups and conferences I noticed an oversight in my work. In my presentations I had given an example of using the ON-EXIT group showing how I can use an indicator to indicate if an error had occurred in the procedure or subprocedure. In my post, on this website, about ON-EXIT I only mentioned it in passing. In this post I want to overcome oversight to show how I can do this.

The ON-EXIT group can be added to the end of every procedure or subprocedure in a RPG program. Regardless of whether the procedure or subprocedures errors or not, the code within the ON-EXIT group is always executed.

Let me start with my first example program, this one does not have any procedures or subprocedures:

Thursday, May 11, 2023

Spring 2023 version of the IBM i and Power10 performance guides

There are two updated publications from IBM to help us get the best performance from our favorite operating system, IBM i, and from the brand new IBM Power10 server it runs upon.

The first is "IBM Power 10 performance optimization for IBM i". It is 22 pages long and covers all kinds ways you can get the most from your IBM Power 10 server. I have read most of it, and when my employers moves to a Power 10 server, later this year, I hope to implement most of its suggestions. You can download your own copy here.

The other is the "IBM i on Power – Performance FAQ". This one is 112 pages and covers in detail what you can do to get the most from the IBM i operating system. This includes sections for things you can do with your RPG and COBOL to optimize it. This can be downloaded from here.

Lots of information to read, but worth it to get the best from our operating system and servers.

Wednesday, May 10, 2023

New columns added to OUTPUT_QUEUE_ENTRIES

Two new columns were added to the OUTPUT_QUEUE_ENTRIES SQL View and SQL Table Function as part of IBM i 7.5 Technology Refresh 1 and IBM i 7.4 TR7, and while I wonder how often I will use them I do find the information they return interesting.

These columns are:

  1. TOTAL_RECORDS:  Total number of records in the spool file. Will be null unless the spool file is *AFPDS, *AFPDSLINE or *LINE, or the file is open
  2. MAXIMUM_RECORDS:  The maximum number of records that the spool file can contain, when the file was first opened

Wednesday, May 3, 2023

Using SQL to retrieve information about hardware resources

Amongst the many new additions to the latest Technology Refreshes, IBM i 7.5 TR1 and 7.4 TR7, comes a new View and Table Function that allows me to retrieve information about a partition's hardware resources, including its status.

Both have the same name, HARDWARE_RESOURCE_INFO, and are in the library QSYS2. The View returns information for all hardware resources, the Table Function returns can be used to only return the information about one type of hardware resource or another. Both return the same columns in their results.

Before I start showing you examples of the results from these two I recommend you run the following SQL statement. This will allow you to see all the available columns, and help you decide what is useful to you.

Thursday, April 27, 2023

COMMON Finland

Tervetuloa, COMMON Finland have a new website, at commonfinland.fi

They become the 18th national association affiliated with COMMON Europe to launch their website.

I have added their site to my IBM i User Groups page. There is a link at the top of every page and post to this page.

If you are a member of, or know of, any User Groups not listed on my IBM i User Groups page please let me know of it, using the Contact Form that you can find on every post and page.

Wednesday, April 26, 2023

New columns added to HISTORY_LOG_INFO

As part of the latest round of Technology Refreshes, IBM i 7.5 TR1 and 7.4 TR7, three new columns were added to one of my favorites Db2 for i Table Functions, HISTORY_LOG_INFO. I often use this Table Function to search the IBM i partitions' history.

The new columns are all parts of the existing job name column, FROM_JOB:

  • FROM_JOB_NAME:  Job name
  • FROM_JOB_USER:  The user profile of the job
  • FROM_JOB_NUMBER:  Job number

These columns might not sound like a big addition to HISTORY_LOG_INFO, but the first two, name and user, make it easier to find results I am looking for.

Wednesday, April 19, 2023

Personalised SQL error logging, SELF

Update (January 24, 2023)
I can now use the special values '*ERROR', '*WARN', or '*ALL' rather than having to list all the SQL codes. Read about it here.


Introduced as part of IBM i 7.5 Technology Refresh 1 and IBM i 7.4 TR7, is a mechanism to capture details of SQL errors into a separate log table. I can decide which errors I want to capture in the log, by use of the SQL code. The SQL codes to capture are set at the SQL session level, rather than at the IBM i job level.

This is called the SQL Error Logging Facility, or SELF for short. It consists of several parts, the parts I am going to explain in detail are:

  • SQL_ERROR_LOG:  A View that is used to display the logged errors
  • SELFCODES:  A Global Variable that needs to contain the SQL codes I wish to log
  • VALIDATE_SELF:  A scalar function that validates SQL codes