Thursday, July 16, 2020

Viewing all of the subsystems autostart jobs in one place

view subsystem autostart jobs using sql

If I needed to see which autostart jobs were in my IBM i partitions I would either have to use the Display Subsystem Description command, DSPSBSD, to view the autostart jobs for each subsystem or use an API. Fortunately the latest Technology Refreshes include a Db2 for i View that gives me the information I want.

Before I give examples of using the new View I want to show how to get to the same information using the DSPSBSD command so that you can compare the data from the two.

If I want to see what autostart jobs there are in the QCTL subsystem I would use the following command:

DSPSBSD SBSD(QCTL)

When the Enter key is pressed the following menu is displayed:

                       Display Subsystem Description

Subsystem description:   QCTL
Status:   ACTIVE

Select one of the following:

     1. Operational attributes
     2. Pool definitions
     3. Autostart job entries
     4. Work station name entries
     5. Work station type entries
     6. Job queue entries
     7. Routing entries
     8. Communications entries
     9. Remote location name entries
    10. Prestart job entries

I take option 3, and the following is displayed:

                        Display Autostart Job Entries 

Subsystem description:   QCTL

Job            Job Description     Library
QSTRUPJD         QSTRUPJD          QSYS

As you can imagine this takes time to get the information about the autostart jobs in one subsystem. If I wanted to know all the autostart jobs from multiple subsystems I would have to repeat this for each one. This is when the existing method becomes a pain!

Now I can use the SQL View: AUTOSTART_JOB_INFO, which is found in the library QSYS2. This View has just five columns. I am not going to list them here as the columns' name describe what is contained within.

Let me display the same information:

SELECT * 
FROM QSYS2.AUTOSTART_JOB_INFO
WHERE SUBSYSTEM_DESCRIPTION = 'QCTL'
AND SUBSYSTEM_DESCRIPTION_LIBRARY = 'QSYS'

Here I am displaying all the columns from the View, but only from the subsystem description QCTL in the library QSYS.

SUBSYSTEM                   AUTOSTART  JOB
_DESCRIPTION  SUBSYSTEM     _JOB       _DESCRIPTION  JOB
_LIBRARY      _DESCRIPTION  _NAME      _LIBRARY      _DESCRIPTION
------------  ------------  ---------  ------------  ------------
QSYS          QCTL          QSTRUPJD   QSYS          QSTRUPJD

That was easy. Now how about all the autostart jobs from all subsystems:

SELECT * 
FROM QSYS2.AUTOSTART_JOB_INFO
ORDER BY 1,2,3

I could not be bothered to enter the column names for the sort, I just entered the number that corresponds to where in the View the column is found.

The results, below, are just a subset of what was returned:

SUBSYSTEM                   AUTOSTART  JOB
_DESCRIPTION  SUBSYSTEM     _JOB       _DESCRIPTION  JOB
_LIBRARY      _DESCRIPTION  _NAME      _LIBRARY      _DESCRIPTION
------------  ------------  ---------  ------------  ------------
QBRM          Q1ABRMNET     QBRMNET    QBRM          Q1ACNETJD
QINMEDIA      QBASE         QSTRUPJD   QSYS          QSTRUPJD
QINMEDIA      QCTL          QSTRUPJD   QSYS          QSTRUPJD
QINMEDIA      QSNADS        QZDSTART   QGPL          QSNADS

That was so easy, especially when compared to how it would have to be done using the DSPSBSD command:

  1. Find all of the subsystem description objects.
  2. Use the DSPSBSD command for each one, as I do not know which ones have autostart jobs and which do not.
  3. Take option 3 from the menu.
  4. Record the names and whatever else I need of each autostart job..
  5. Go to step 2.

This would take a long time. Using the View will save me all that time I can use for doing something more productive.

 

You can learn more about the AUTOSTART_JOB_INFO SQL View from the IBM website here.

 

This article was written for IBM i 7.4 TR2 and 7.3 TR8.

4 comments:

  1. I tried it on my V7R3M0 but getting 'AUTOSTART_JOB_INFO in QSYS2 type *FILE not found.'

    ReplyDelete
    Replies
    1. The most common reason for this is that you do not have the Db2 PTFs for the latest TR loaded. Check with your Tech Support.

      Delete
  2. I tried and worked well. Thanks you for the query. Just wondering can we also find out subsystem jobs using SQL query ?

    ReplyDelete

To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.