Wednesday, September 9, 2026

Separating parts of qualified job name with SQL

In a previous post I explained how I could extract the parts of the qualified job name using the LOCATE_IN_STRING scalar function. With the latest Technology Refreshes, IBM i 7.6 TR2 and 7.5 TR8, a number of Db2 for i scalar functions and a table function were added to make this easier. These are:

  • JOB_NAME scalar function:  Returns the job name
  • JOB_NUMBER scalar function:  Returns the job number
  • JOB_USER scalar function:  Returns the job user
  • JOB_NAME_DETAILS table function:  Returns all of the above

All of the above are found in the library SYSTOOLS.

Wednesday, September 2, 2026

Validating CL commands with SQL

There has been an API to validate CL commands for as long as I can remember, but is not simple to use. Fortunately, as part of the latest Technology Refreshes, IBM i 7.6 TR2 and 7.5 TR8, a Db2 for i scalar function was introduced that performs the same function.

CHECK_COMMAND_SYNTAX requires one parameter, the command string to be validated. The string can be up to 32,000 characters, which should cover most command strings I use. It returns a Boolean value:

  • True = the command string is valid
  • False = the command string is invalid

Here are a couple of examples I made and ran in ACS's Run SQL Scripts, RSS: