Thursday, December 30, 2021

Log4j vulnerabilities for IBM i

ibm blog about log4j

The Log4j vulnerabilities came to light earlier this month. I have not written about it as others have a better understanding of how this effects the operating system we love, and have written good articles about it too.

I was sent this link to an IBM Blog entry that describes what you can to remediate these vulnerabilities. And I thought I would share it with you. The blog post is general to all IBM products, not just IBM i and Power systems.

Please share this link with your IBM i system administrators, and ask them to check if any updates need to be applied to your IBM products and environments.


Mike Mayer sent me a couple more links that might help too:

While these are not related to Log4j, Peder Udesen shared these vulnerabilities in RDi:

Wednesday, December 29, 2021

Searching for member information with SQL

sql view for file members

Db2 optimizes very large SQL tables by dividing the data contained within into partitions. These partitions store rows of data separately from other rows. In Db2 for i these are implemented using something we are all familiar with, members. This allows us, IBM i users, to use the Db2 view SYSPARTITIONSTAT to get information about members in the files and tables in our systems.

Where do we use members? The two scenarios that I am sure spring to all of our minds are in source files and in data files.

I often use SYSPARTITIONSTAT to search for source members that have the same name in multiple source files. This allows me to determine if a member name has already been used. Or if I have multiple versions of the same source member in different source files.

Wednesday, December 22, 2021

Using SQL to retrieve information about output queues

get output queue data from sql view

I have written so many posts there are times when I think I have written one about something useful, and I find to my surprise that I have not. I use the SQL view OUTPUT_QUEUE_INFO often, and I found that I have not written about it. This post makes amends for that oversight.

OUTPUT_QUEUE_INFO has been around since IBM i 7.2. It returns similar information to the Work Output Queue command, WRKOUTQ, whose output is familiar to everyone who uses IBM i.

                         Work with All Output Queues

Type options, press Enter.
  2=Change   3=Hold     4=Delete   5=Work with   6=Releas
  9=Work with Writers   14=Clear

Opt   Queue       Library      Files    Writer     Status 
      OUTPUT      #SYSLOADX        0                RLS
      CGIDEV2     CGIDEV2          0                RLS
      DATAOUTQ    DATALIB          0                RLS
      IASAUDIT    IASUSR13         0                HLD

Wednesday, December 15, 2021

Taking one string and breaking it apart into five consecutive rows

sql split and substring

The question was: How can I break apart a hundred long field into five twenty long fields and then have them returned, one after another, as separate result rows using SQL?

Obviously substring is going to be used, but how to return the resulting rows one after another?

Fortunately the easiest solution for this scenario came in earlier Technology Refreshes for the currently supported releases of IBM i, 7.4 TR4 and 7.3 TR10.

Before I show that I need to have a file with a field that is a hundred characters long:

01 A          R TESTFILER
02 A            FLD001       100A

Wednesday, December 8, 2021

Converting a spool file with bar code to PDF

copy sool file with bar code to ifs

I keep getting asked this question: If I generate a spool file with a bar code in it and I copy it to PDF will the bar code still display?

I wrote about copying spool files to PDF in the IFS in March 2014. What I am going to describe here is based on that post.

If the people who ask the question had read that post they would have discovered how simple this is.

Let me start with the externally described printer file, as I have not used Output specifications for prints in nigh on 30 years. The printer file's definition only needs two lines:

Wednesday, December 1, 2021

Adding 1 month to the end of the month and always get the end of the next month

determine end of any month

I was asked how to make sure if I added 1 month to the last day of this month I would get the end of next month. If I take a date from a month and add one month to it I get the end of the next month.

In RPG if I add one month to January 31 I get February 28, the last day of the next month.

wkDate = d'2022-01-31' + %months(1) ;
dsply wkDate ;

DSPLY  2022-02-28

When I add one month to February 28 I do not get the last day of March, I get March 28.

wkDate = d'2022-02-28' + %months(1) ;
dsply wkDate ;

DSPLY  2022-03-28