Wednesday, November 20, 2024

Using expression in CL call parameters

Starting in IBM i 7.4 it is possible to use CL Built in Functions, BiF, in the parameters of CL's Call command. This becomes even easier when I use the additional parameters in the Parameter parameters of the CALL command.

Those of you who have seen example of my RPG code have seen examples where I have used BiFs in its Call operation code parameters. When I learned that there was now similar functionality in CL I became very curious what could I do with it.

I chosen a number of scenarios to write examples for, as these are things I have done many times with RPG's Call operation code.

Tuesday, November 19, 2024

IBM Power11 is coming, but not announced

I do not think I have ever seen IBM do this before. The Vice President of Product Management for the IBM Power Servers, Bargav Balakrishnan, wrote a blog post in the IBM Newsroom about IBM Power11 processors being released next year, 2025.

While his post was not technical, explaining the differences from IBM Power10 and Power11, he did give some details about the performance improvement we could see when comparing these two servers.

He also wrote about integrating the IBM Spyre Accelerator to allow IBM Power servers used to be able the scale AI workloads.

The last section of his post talked about IBM's AI tool for RPG, RPG code assistant, stating that IBM intends to deliver it next year too.

You can read his blog post here.

This goes to show that 2025 is going to be an exciting year for IBM Power, IBM i and RPG.

Thursday, November 14, 2024

Fall 2024 IBM i Performance Guide

On Tuesday, November 12 2024, IBM i Chief Architect and CTO, Steve Will, announced the updated "Fall 2024 IBM i Performance FAQ" guide had been published, and is available for download.

This guide gives information on how to measure the performance of your IBM i partition, and how to optimize whatever tools and programming languages you use to get the best from the operating system we all love.

You can open and download the document from here.

I have already downloaded and read this document this guide. And I think it would be good for you to do the same.

Wednesday, November 13, 2024

Using Fields BiF to update Subfile

When I use RPG Update operation code I tend to use the %FIELDS Built in Function, BiF, with it. The %FIELDS allows me to list the file fields I want to update, all other are unchanged. As I like my code to be "self-documenting" I use it a lot if I am not updating all of the fields in the record, this allows other developers to learn that I was only interested in updating the fields listed.

These days almost all of my data file I/O is with SQL, which leaves me using RPG I/O with just display and printer files. I cannot update a record in a printer file, therefore, this post is exclusively about display files, and subfiles in particular.

Why do I feel the need to write about this when %FIELDS and subfiles have been around for several releases. It is because of a change that is in IBM i 7.5. In this release it is no longer possible to compile a program that uses the %FIELDS when updating a subfile without some extra work. But before I go into that let me show my example code, starting with the DDS source for the display file:

Tuesday, November 12, 2024

RPGPGM.COM-unity in Canada

Last week I was presenting at COMMON's Navigate in Toronto, Canada, and I took the opportunity to hand out more of the RPGPGM.COM-unity ribbons. You can see who I gave them to here.

If I gave you a ribbon and I missed taking a photograph of you with it, please send me a photograph posed like the other people I photographed with their ribbons.

What is the RPGPGM.COM-unity? You will have to click on this link to learn what it means.

Wednesday, November 6, 2024

Learning about active queries

Have you ever wanted to know what is going on within an active SQL Query Engine, SQE, query?

If, like me, you do there is a table function that shows all kinds of interesting information.

The table function ACTIVE_QUERY_INFO has been around since IBM i 7.3 . It has four parameters that allow you to select the results you want returned.

  1. JOB_NAME:  This is the parameter I have found the most useful. Rather than it using the qualified job name it uses the job name part of the job name. Therefore I can just search for jobs with wildcards, for example 'DSP1*'. I can also use '*' to return results for the current job only, and '*ALL', or blank, to return the results for all active jobs.
  2. JOB_USER:  The user name from the job name. A wildcard can be used here too.
  3. JOB_NUMBER:  The job number part of the job name. '*ALL' can be used here.
  4. USER_NAME:  The user name for the job, which may not be the same as the job user name.

Tuesday, October 29, 2024

Special Authority Data Mart

A second data mart was introduced as part of the last round of Technology Refreshes that allows me to capture and store information about the special authorities given to user profiles in my partitions.

The Special Authority Data Mart is held in the table SPECIAL_AUTHORITY_DATA_MART, which resides in the SYSTOOLS. The table is a Materialize Query Table, MQT. This means that the contents of the table are not dynamic, changed when changes are made to the user profiles, it is refreshed using the REFRESH TABLE SQL statement. If you don't know what that is I will show how to use it in my examples below.

The most basic SQL statement to retrieve the data from the Table is:

01  SELECT * FROM SYSTOOLS.SPECIAL_AUTHORITY_DATA_MART

Wednesday, October 23, 2024

Retrieving the library that contains the currently running program

The idea for this post came from a question. The questioner had a situation where, due to a mixed-up library list, someone had run the wrong version of a program from another library. They already had the program's name on their display files, and they asked was it possible to retrieve the library the current executing program is in, and add that to the their display files.

After some discussion we decided that any change would be needed in both RPG and CL programs. Fortunately, this is simple in both languages.

Before I start explaining my RPG and CL code I need to have a display file within which are fields for the program and the program's library. I created a simple display file to do this, called TESTDSPF:

01 A                                      DSPSIZ(24 80 *DS3)
02 A          R SCREEN
03 A                                  3  2'Program name  . :'
04 A            PGMNAME       10   O  3 20
05 A                                  4  2'Program library :'
06 A            PGMLIB    R        O  4 20REFFLD(PGMNAME  *SRC)

Wednesday, October 16, 2024

Audit Journal Data Mart

This is something that caught my attention when the latest Technology Refreshes were announced: the ability to create a database of journal entry types entries. I had been doing something similar using the CREATE TABLE SQL statement and various of the Audit journal entry services, AUDIT_JOURNAL_xx. But these additions added functionality that makes it easier for me to extract the journal entries from the System Audit Journal, QAUDJRN.

The two new additions are:

  1. MANAGE_AUDIT_JOURNAL_DATA_MART:  SQL procedure that uses the various AUDIT_JOURNAL_xx to create an output table.
  2. AUDIT_JOURNAL_DATA_MART_INFO:  SQL View that displays information about all the files created with the MANAGE_AUDIT_JOURNAL_DATA_MART SQL procedure.

Monday, October 14, 2024

RPG Cafe updated with Fall 2024 enhancements

The RPG Cafe has been updated with the four changes that will be coming in the latest Technology Refreshes, IBM i 7.5 TR5 and 7.4 TR11.

These enhancements are:

  • In preparation for the switch to the "1970" rule for six long dates, with two digit years, there will be a compile option when used allows you identify where a two digit year is used in the program or module, see here for more details.
     
  • The ability to use the %PROC BiF in the ON-EXIT section of a procedure. Learn more here.
     
  • Two new BiFs, %HIVAL and %LOVAL that will return the largest or smallest possible value that can be held in a variable. The details are here.

I consider these three great additions to the modern RPG language.