Wednesday, September 23, 2020

Retrieving commands' defaults, CLOB-ing it

using clob with qcdrcmdd api

Last week I wrote about how to use an API to retrieve a command's defaults. I encountered a problem when the string returned by the API would be blank. I did not know what was causing this. Fortunately two people added comments to the post explaining the issue: if the string returned is longer than the size of the result variable blank is returned. I want to thank both of them for letting me know what was causing this problem.

Therefore, if I increased the size of the subfield in the API's result data structure I see the results for those commands I did not see before.

This caused another problem, as I could no longer use the field in the DDS file I had defined before. The maximum size of an alphanumeric field is 32,766 bytes, which proved too small for some of the commands I tested with. My first thought was to use a (SQL) DDL table instead, but the maximum size of a character column is one byte smaller than for the DDS alphanumeric field, 32,765. As these XML strings can be extremely long I will need to insert these into a CLOB, Character Large Object, column as this can contain up to 2,147,483,647 bytes, way more than I could ever need.

My SQL DDL table looks like:

Wednesday, September 16, 2020

Retrieving commands' defaults

qcdrcmdd api to get command definition

I wanted to retrieve the defaults for a number of IBM commands, so I could compare them to those in another IBM i partition. I found an API, QCDRCMDD, would give me a XML string of the command's definition, that I could then write to a file. This file could then be transferred to the other partition and used when comparing the two sets of commands' information.

The output file, OUTFILE, would contain one field, for the XML string, but would need to big enough to contain the longest possible XML string. My guess is that a field of 10,000 characters would be long enough to cover most commands.

01  A          R OUTFILER
02  A            FIELD      10000A

Wednesday, September 9, 2020

Using Navigator for i for SQL index suggestions

using sql index advisor to create indexes

I have been playing with the new release of Access Client Solutions, ACS 1.1.8.5, and have been impressed with it. I have found Navigator for i a bit faster so thought it was time to revisit one of the coolest features included in it, the Db2 for i index advisor.

I have written about using the index advisor using the old Client Access Operation Navigator before. The ACS version of the index advisor is so much easier to use I wanted to encourage you to look at it.

When you access a table or file using SQL the Db2 engine determines the best access path to use to extract the data requested. If there is not a suitable existing access path it will build a temporary one. When it does, it makes an addition to the index advisor table with the suggested key, or if there is already a row it increments the "times used" counter. I can use the index advisor to see which indexes are suggested. If there is a suggested index that has been used many, many times then I will build it to make the SQL faster, as it no longer has to build the temporary access path.

Wednesday, September 2, 2020

Prestart jobs' information using SQL

sql to view prestart jobs

What are prestart jobs? They are batch jobs that run to allow programs on remote systems to communicate with the IBM i partition. They use prestart job entries that are found in the subsystem descriptions of the subsystems in which they run.

Previously the only way you could list the information about prestart jobs was to use the Display Subsystem Description command, DSPSBSD, one subsystem at a time, or the Display Active Prestart Job command, DSPACTPJ, one job at a time. The latest Technology Refreshes, IBM i 7.4 TR2 and 7.3 TR8, introduced the following to Db2:

  • PRESTART_JOB_INFO View
  • PRESTART_JOB_STATISTICS Table function

Both of these are found in the QSYS2 library.

Thursday, August 27, 2020

New Db2 for i poster

Scott Forstie, Db2 for i Business Architect, has updated his Db2 for i poster to include everything from the latest Technology Refreshes, and made it available for download at ibm.biz/Db2foriPoster.

Thank you Scott for doing this.

In the future if that link stops working, as ones for previous posters have, you can download it from here.

Wednesday, August 26, 2020

Difference in Run SQL Scripts

acs run sql scripts content assist

I have had the latest version of Access Client Solutions, ACS, 1.1.8.5 for just over a week. I use "Run SQL Scripts" so much I leave it open all day. It is my favorite part of ACS, as I often start with a simple SQL statement, and then copy that to make it ever more complex until I have the final form of the statement I want to use. Something that is hard to do using the STRSQL interface.

There are several ways to start "Run SQL Scripts". The most common way is from the 5250 emulation display. I will find the option to start it in the "Actions" menu.


Tuesday, August 25, 2020

Wednesday, August 19, 2020

Using multiple data structures to contain the results of a Fetch

single row fetch into multiple data structures in rpg

The germ for this post came from a question from Bob. It is not the question that I wanted to share or the answer I came up with, but the solution he came up with. Bob was presented with an old program with a SQL Cursor definition statement that joined several files together. Within the Cursor definition the original programmer had listed all of the fields in the files, and in the Fetch statement he/she had listed all the fields from the files again.

The question he asked me was this possible to convert from a Cursor Fetching one row at a time to a multiple row Fetch.

In the following examples I am not going to use the files Bob used, but these test files:

Tuesday, August 18, 2020

IBM video: The Legacy and Future of IBM POWER with IBM POWER10

IBM reveals the next generation of IBM POWER10 processor

IBM press release here.

Interview with IBM Cognitive Systems General Manager Stephen Leonard here.

Monday, August 17, 2020

Time to give RPG a new name

help make rpg for i a reality

I was talking to some friends about totally free RPG and I soon got tired having to save "totally free RPG" all the time. Then it struck me this language needs a new name!

Do not worry I am proposing we drop the name "RPG", but the time is right to give it something to show that this is a new version of the programming language. When the AS/400 was launched, 32 years ago, RPGIII from the System/38 was renamed RPG/400. 25 years ago ILE/RPG was brought forth giving us a new paradigm to programming.

Five years ago "totally free RPG" was introduced. It is not ILE/RPG. There are no columns and I can start typing in the first column of the source member, and can continue the way to the last column too. It was something new and different from its antecedents. This is a new version of the programming language and, in my opinion, it deserves a new name.