Home > AS/400 Tips > iSeries administrator tips > Simplify API-generated lists processing with a generic list processing procedure -- part I
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Simplify API-generated lists processing with a generic list processing procedure -- part I


Ron Turull
02.13.2006
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Admin tip ... Simplify API-generated lists processing with a generic list processing procedure – Part I by Ron Turull
Ron Turull

In the last few installments, we have been discussing the open-list APIs. If you followed along in the sample code provided with those articles, you may have noticed that compared to the "regular" list APIs (i.e., the list APIs that write their entire output to a user space and while your program waits), the open-list APIs do not require nearly as much "overhead" programming. Complicated data structures are usually kept to just one or two, you don't need to deal with pointers and user spaces, and you simply call an API to get entries from the list.

Well, some time ago, I got tired of all that overhead programming, and decided to create a procedure that would hide the detail of lists and greatly simplify the process of using them. It doesn't hide all the details -- it is just one procedure after all -- but it hides what for most programmers is the most complicated, error-prone part: retrieving list entries.

More Information

How the "regular" list APIs generate lists

APIs such as the List Objects (QUSLOBJ) API or the List Jobs (QUSLJOB) API produce formatted lists of entries, with each entry having the exact same format. The format is "selectable" by the calling program and list-producing APIs usually support several formats.

For example, the List Objects API supports a format that produces entries that contain just the object name, library name, and object type. This same API also supports a format that gives you, in every entry, everything you get when you do a DSPOBJD command with DETAIL(*FULL).

The problems and merits of list processing

Lists generated by APIs, even with simple formats, are complicated creatures. They involve complex data structures and control information that clouds the real data. And, getting to the actual entries involves a intricate process of pointers and offsets.

On the positive side, all the list-generating APIs use a standard data structure format for the control information. That provides us with the ability to code a generic procedure that can handle retrieving a entry from any list, no matter which API generated it and no matter what the format of the list entries.

The Get List Entry procedure

The code shown GETLISTE.RPG defines a procedure, GetListE, that lets you quickly and easily retrieve an entry from a list created by any one of the "regular" list-generating APIs. No need to worry about coding the data structures and doing the pointer arithmetic involved in processing a list. Just tell the procedure which entry number you want, and it will expeditiously return it to you.

In the next installment, we'll discuss the code that makes up the GetListE (Get List Entry) procedure, and we'll see an example of how to use it.

-----------------------------------
About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years' experience programming for and managing AS/400-iSeries systems.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries administrator tips
Analyze the health of your IBM i server with iScore
Researching high availability for your System i shop
Translating Linux for IBM i admins: Using GUI to make it easy
Translating Linux for IBM i admins: Working with jobs and networking
OpenOffice: What to know before making the transition from Microsoft Office
OpenOffice: An enterprise open source solution
Database performance comparisons on IBM i
Translating Linux for IBM i admins: User profile commands
Modern System i reports using Client Access
Tips for installing Lotus Domino server on a System i partition

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts