15
Mon, Apr
5 New Articles

What's Your Partition ID?

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

The new (V5R3) Retrieve Partition Information (dlpar_get_info) API returns information about configuration and CPU utilization of the logical partition where this API was called. At least that's what the API documentation says.

But finding information about dlpar_get_info and its cousin dlpar_set_resources can be challenging for touch-typists. If you're lazy and you type only a partial name into the API Finder, you may see results—but for the most part, you won't see a link for this API if you type its full name into the API Finder.

Try it. Go to the API Finder and type in "dlpar_get_info" (without the quotes). Go ahead; I'll wait....

Now try it again, only this time, be a bit lazy and enter only the first five characters of the API name. Try it with just "dlpar" (again, without the quotes).

Voila!

You'll see a list of two APIs that deal with partition information, something like the following:

http://www.mcpressonline.com/articles/images/2002/What11010600.jpg

These two APIs allow you to retrieve and change partition information. The Retrieve Partition Information API is dlpar_set_resources, which is an interesting name in and of itself. It returns the current configuration of the partition from which the API was called. The information is similar to that returned by the MATMATR MI instruction. The information is in a more useable form and is easier to retrieve using this API than using MI, of course. The gotcha is that you have to be on V5R3 or later to use it; otherwise, you need to perform MI programming or license the RPG xTools from Linoma Software to get this kind of information.

Fortunately, surveys indicate that most iSeries shops have moved to V5R2 or later, which I hope means V5R3 (or later). Personally, I have little use for V5R2 and would recommend jumping directly to V5R3 if you can.

To use this API, you need an RPG IV prototype. The following source code provides this prototype:

     D RtvPtnInfo      PR            10I 0 extProc('dlpar_get_info')
     D  rtnDataStruct                 1A   OPTIONS(*VARSIZE
     D  nFormat                      10I 0 Value
     D  nInLen                       10I 0 Value

I've named this prototype RTVPTNINFO to more closely resemble what it does and to make it easier for me to remember.

The first parameter, which is the return data parameter named RTNDATASTRUCT, is declared as a 1-byte field that includes OPTIONS(*VARSIZE). This allows us to specify a field (or more accurately, a data structure) of a different length than that of the declaration.

The actual length is controlled by the third parameter. So, for example, if you wanted to call this procedure and pass to it a data structure named MYDS1, it might look something like this:

      /free
         rtvPtnInfo(myDS1 : 1 : %size(myDS1));
      /end-free

In virtually every other API that came before this one, the length of the return parameter immediately followed the return parameter. That is, the length would traditionally have fallen as the second parameter, not the third. But who said the iSeries was trying to be consistent?

OK, regardless of the unexpected parameter sequence, the API returns the information about the current partition. Before you ask, no, you can't get information about other partitions by using these APIs.

The partition information is returned to the first parameter in two formats. The format of the data returned is controlled by the second parameter. Once again, previously the format ID of APIs was traditionally an 8-byte character value that was effectively used like a record format name; OBJD0100 is one example. This API uses integers instead: Pass a value of 1, and the first format is returned; pass a 2, and the second format is returned. I actually prefer this style of format ID—so much in fact that I chose it for my RPG xTools service program.

The two formats return different types of information. The first format returns information that is effectively static as it relates to the partition—that is, information that is unlikely to change without reconfiguring the partition, such as the partition size.

The second format returns information that is likely to change at any time, such as the total CPU time used and CPU time unused. But a number of static properties are also returned in the second format.

The format of the return value for the first format is as follows:

     D XT_RTVPTNINF1   DS                  Qualified
     D  version                      10I 0
     D  reserved1                    10I 0
     D  maxMem                       20I 0
     D  minMem                       20I 0
     D  memInc                       20I 0
     D  DspWheelRotation...
     D                               20I 0
     D  LPAR                         10I 0
     D  flags                        10I 0
     D  phyProc                      10I 0
     D  minVirtProc                  10I 0
     D  maxVirtProc                  10I 0
     D  minProcCap                   10I 0
     D  maxProcCap                   10I 0
     D  procCapInc                   10I 0
     D  minIntCap                    10I 0
     D  maxIntCap                    10I 0
     D  ThreadsPerProc...
     D                                5I 0
     D  reserved2                     6A  
     D**  Note: NAME is in UTF-8 CCSID(1208)
     D  name                        256A
     D  DefProcCap                   10I 0
     D  DefVirtProc                  10I 0
     D  DefMem                       20I 0
     D  DefCapWgt                    10I 0
     D  DefIntCap                    10I 0

The format of the return value for the second format is as follows:

     D XT_RTVPTNINF2   DS                  Qualified
     D  version                      10I 0
     D  reserved1                    10I 0
     D  OnlineMem                    20I 0
     D  TotalCPUTime                 20I 0
     D  IntCPUTime                   20I 0
     D  AdlCPUTime                   20I 0 
     D  UnusedCPUTime                20I 0
     D  DispatchLatency...
     D                               20I 0
     D  flags                        10I 0
     D  phyProc                      10I 0
     D  onlineProc                   10I 0
     D  phyProcCapSharedPool...
     D                               10I 0
     D  UnusedProcCap                10I 0
     D  procCap                      10I 0
     D  VarCapWgt                    10I 0
     D  UnusedVarCapWgt...
     D                               10I 0
     D  minReqProcCap                10I 0
     D  intCap                       10I 0
     D  maxLicCap                    10I 0
     D  groupID                       5I 0
     D  sharedPoolID                  5I 0
     D  intThreshold                  5I 0
     D  reserved3                     2A
     D  UnusedIntCap                 10I 0
     D  reserved4                     4A

The following is an example of retrieving partition information using this API, along with the two formats:

     H dftactgrp(*NO) 

     D myDS1           DS                  LikeDS(XT_RTVPTNINF1)
     D myDS2           DS                  LikeDS(XT_RTVPTNINF2)
      /free
        *inlr = *ON;
         rtvptnInfo(myDS1 : 1 : %size(myDS1));
         rtvptnInfo(myDS2 : 2 : %size(myDS2));
         return;
      /end-free

Compile the above example with DBGVIEW(*SOURCE) and then step into the code. Set a break point at the RETURN statement and then call the program. When the breakpoint is met, display the content of MYDS1 and MYDS2. Since they are both qualified data structures, their subfields will be displayed with the data that is contained in them.

Managing Partitions

More and more iSeries are being shipped and installed with at least two partitions. At some point in the near future, I expect most to be multiple-partition boxes. The tools to determine partition configuration and modify it are slowly becoming exposed to the application developer. It's important to play with this stuff early so that it doesn't become just another feature.

Bob Cozzi is a programmer/consultant, writer/author, and software developer of the RPG xTools, a popular add-on subprocedure library for RPG IV. His book The Modern RPG Language has been the most widely used RPG programming book for nearly two decades. He, along with others, speaks at and runs the highly-popular RPG World conference for RPG programmers.

BOB COZZI

Bob Cozzi is a programmer/consultant, writer/author, and software developer. His popular RPG xTools add-on subprocedure library for RPG IV is fast becoming a standard with RPG developers. His book The Modern RPG Language has been the most widely used RPG programming book for more than a decade. He, along with others, speaks at and produces the highly popular RPG World conference for RPG programmers.


MC Press books written by Robert Cozzi available now on the MC Press Bookstore.

RPG TnT RPG TnT
Get this jam-packed resource of quick, easy-to-implement RPG tips!
List Price $65.00

Now On Sale

The Modern RPG IV Language The Modern RPG IV Language
Cozzi on everything RPG! What more could you want?
List Price $99.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

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: