04
Wed, Dec
6 New Articles

Want to Know All the MI Object Types Supported by Your IBM i?

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Retrieve the exact table of MI object types via the undocumented API QLICNV.

On IBM i, historically there are two flavors when referring to objects. At the MI level, MI objects are categorized by a 2-byte MI object type code (1-byte type code and 1-byte subtype code). At the OS level, external objects (also known as CL objects) are categorized by external symbolic type names—for example, *FILE. An external object may consist of one or more MI objects. Each MI object type also has a corresponding descriptive external object type name; for example, the external object type name of a cursor object (with MI object type hex 0D50) is *MEM (Member). As you might know, the number of MI object types changes from release to release. This makes sense for an object-based system that has been evolving continuously.

 

Strictly speaking, only the object types that are visible at the OS level are external object types. For example, cursor object (*MEM) isn't a valid external object type. Here, the term "external object type" refers to the descriptive name of an MI object type.

 

As you might know, there are a couple of ways to find out which MI object types are supported by a specific IBM i VRM (version, release, and modification level):

  • The Internal object types document provides a map from MI object types to external object types.
  • The Convert Type (QLICVTTP) API allows you to convert an external object type to corresponding MI object type and vice versa.

 

Unfortunately, the above methods either cannot be used programmatically or don't completely fulfill our requirement. For example, the QLICVTTP API refuses to convert an MI object type whose subtype code is greater than or equal to hex 50 (or, in other words, object types that are not strictly said external object types)—for example, cursor object (hex 0D50) whose external type is *MEM.

 

So is it possible to retrieve the exact table of MI object types supported by the current IBM i VRM? Yes, and the answer lies in a program object, QSYS/QLICNV.

Hello, QLICNV

The following is quoted from a post at the MI400-L mailing list hosted by midrange.com, in which Dave McKenzie mentioned the QLICNV program (possibly the first time in this mailing list):

 

- Subject: Object types in the QSYS file system (and in save files)

- From: Dave McKenzie <davemck@xxxxxxxxxx>

- Date: Thu, 15 Feb 2001 15:13:46 -0800

 

...

There's a table of object types in the pgm QSYS/QLICNV which you can see by

dumping it with SST. It includes internal types (e.g. x0C90, data space index,

AKA access path) as well as external types (e.g. x1901, file). On my V4R4

machine it has 287 types....

 

--Dave

 

The "table of object types in the pgm QSYS/QLICNV" mentioned by Dave resides in the associated space of the QLICNV program. The format of QLICNV's associated space is the following:

 

1. CHAR(32). Unknown

2. BIN(4). Number of MI object type entries available

3. CHAR(28). Unknown

4. CHAR(11) Array of MI object type entries

4.1. CHAR(7) External object type name

4.2. CHAR(4) MI object type code and subtype code

 

Additionally, since the QLICNV program is in the user domain and therefore can be accessed from user state programs, once the system pointer to QLICNV is available, a user program can access the table of MI object types stored in QLICNV's associated space via the Set Space Pointer from Pointer (SETSPPFP) MI instruction. Note that the initial public authority of QLICNV is set to *EXCLUDE and therefore cannot be accessed by a user with neither proper private authority to QLICNV nor the *ALLOBJ special authority. Thus, you should not resolve the system pointer to QLICNV using the Resolve System Pointer (RSLVSP) MI instruction. Instead, you should use the resolved system pointer to QLICNV (with authorities set in it) stored in the System Entry Point Table (SEPT), which I discussed in my article "Are You Taking Full Advantage of the System Entry Point Table Object?". The offset of QLICNV's system pointer in the SEPT is hex 0490; therefore, when referring to it as an array element of the system pointer array stored in SEPT, the array subscript is hex 4A.

Applicable Example Programs of Listing MI Object Types via QLICNV

The steps for retrieving the table of MI object types stored in QLICNV's associated space are quite straightforward:

  1. Get QLICNV's system pointer stored in the SEPT. (System built-in _SYSEPT is very handy for retrieving the space pointer addressing SEPT's associate space.)
  2. Obtain a space pointer addressing QLICNV's associated space via the SETSPPFP instruction.
  3. Work with the 11-byte MI object type entries via the returned space pointer.

 

Example ILE RPG program t175.rpgle below, which is provided by the open-source project i5toolkit, achieves the above-mentioned steps:

 

     /**

      * @file t175.rpgle

      *

      * Output of T175 might like the following:

      *   0E09 ALRTBL

      *   1B01 AUTL

      *   1E05 BLKSF

      *   1937 BNDDIR

      *   ...

      */

 

     h dftactgrp(*no)

 

     fQSYSPRT   o    f  132        disk

 

      /copy mih-comp

      /copy mih-ptr

      /copy mih-undoc

 

     d sept_spp        s               *

     d sept            s               *   dim(7000)

     d                                     based(sept_spp)

     d                 ds

     d qlicnv                          *

     d qlicnv_ptr                      *   procptr overlay(qlicnv)

     d map_entry_t     ds                  qualified

     d   ex_type                      7a

     d   mi_type                      4a

     d spp             s               *

     d map_table       ds                  qualified

     d                                     based(spp)

     d                               32a

     d   num_ent                     10i 0

     d                               28a

     d   ent                               likeds(map_entry_t)

     d                                     dim(512)

     d i               s             10i 0

     d ws              s              1a

     d mi_type         s              4a

     d ex_type         s              7a

 

      /free

           // locate QLICNV's system pointer in SEPT

           sept_spp = sysept();

           qlicnv = sept(x'4A');

 

           // retrieve space pointer addressing the associated

           // space of QLICNV

           spp = setsppfp (qlicnv_ptr);

 

           for i = 1 to map_table.num_ent;

               mi_type = map_table.ent(i).mi_type;

               ex_type = map_table.ent(i).ex_type;

 

               except MAPREC;

           endfor;

 

           *inlr = *on;

      /end-free

 

     oQSYSPRT   e            MAPREC

     o                       mi_type

     o                       ws

     o                       ex_type

 

i5/OS Programmer's Toolkit also provides a Qshell utility command, lsobjtypes, that prints all supported MI object types to the standard output following the same rationale. C source code of lsobjtypes is available at https://i5toolkit.svn.sourceforge.net/svnroot/i5toolkit/qsh/lsobjtypes.c. To locate a specific entry by MI object type or external object type in the output of lsobjtypes, you can connect lsobjtypes and a grep command with a pipeline metacharacter (|). For example, the following QShell command locates the entry of Java Program (*JVAPGM):

 

> lsobjtypes | grep 0250

  0250  JVAPGM         

  $                    

 

The following Shell commands sort the output of lsobjtypes by MI object type in the QShell and PASE Shell environments, respectively:

 

lsobjtypes | sort -k 1.1,1               # in QShell

qsh_out -c "lsobjtypes" | sort -k 1.1,1  # in PASE Shell environment

 

Additional Considerations

Where should we use this method?

 

Although the method of listing MI object types via QLICNV has been tested at V6R1 and earlier VRMs, you ought to pay attention to the fact that the QLICNV program is not an API officially documented by IBM and could possibly be changed in the future. So, the method introduced here is more suitable for tool programs being aware of their target VRMs.

 

Calling QLICNV to Convert MI Object Types to and from External Object Types

 

As a program object, QLICNV can be called to convert an input MI object type to a corresponding external object type and vice versa (if you have *EXECUTE authority to it). However, since QLICNV expects parameters passed to it as scalar data objects rather than space pointers, QLICNV can be called only from MI programs. Gene Gaunt wrote a very nice post in the MI400-L mailing list that describes the parameter list of QLICNV: http://archive.midrange.com/mi400/200201/msg00029.html. In that post, Gene also provided a nice MI program that "calls the undocumented API (QLICNV) for all 65536 MI object types (from X"0000" through X"FFFF") and builds a list of the valid object types in that range."

 

Different Sets of MI Object Types Supported by Different IBM i VRMs

 

Investigating the difference between sets of MI objects supported by different IBM i VRMs sometimes can be helpful for understanding the evolving progress of the platform. The following is the output of a PASE Shell diff command being applied to the output of the lsobjtypes command on V5R2 and V5R4, respectively, from which you can find out that there was no time zone (*TIMZON) object as of V5R2. Actually, the *TIMZON object type along with the time zone-related commands (e.g., WRKTIMZON) and the QTIMZON system value were introduced in V5R3 to achieve more effective time-zone management.

 

57a58

> 0DEE  OHCUR 

75a77

> 0E11  PDFMAP

85a88,89

> 0EA7  SORTSEQ

> 0EA8  MRD   

138a143

> 1907  PRTIMG

177a183

> 192F  TIMZON

186a193

> 1939  NWSCFG

281a289

> 1E51  OLBSF 

284a293

> 1EB2  POBSF 

291d299

< 2001  SOMOBJ

 

Note:

> lines are from lsobjtypes' output at V5R4

< lines are from lsobjtypes' output at V5R2

 

At the End

Like many of my articles, this article is based largely on the research of IBM i experts who have been contributing to the platform and the IBM i community for decades. It's their continual efforts that allow the younger generation of developers to learn about this excellent platform. They and the platform itself have taught us not only ways to build better software but also the scientific attitudes of software design. I sincerely thank them!

Junlei Li

Junlei Li is a programmer from Tianjin, China, with 10 years of experience in software design and programming. Junlei Li began programming under i5/OS (formerly known as AS/400, iSeries) in late 2005. He is familiar with most programming languages available on i5/OS—from special-purpose languages such as OPM/ILE RPG to CL to general-purpose languages such as C, C++, Java; from strong-typed languages to script languages such as QShell and REXX. One of his favorite programming languages on i5/OS is machine interface (MI) instructions, through which one can discover some of the internal behaviors of i5/OS and some of the highlights of i5/OS in terms of operating system design.

 

Junlei Li's Web site is http://i5toolkit.sourceforge.net/, where his open-source project i5/OS Programmer's Toolkit (https://sourceforge.net/projects/i5toolkit/) is documented.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: