TechTalk: Faster LOKUP

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

As an RPG III and RPG/400 user, I have always wondered why IBM cannot give us an operation that would search an array starting from any array index and backwards to element 1. This would reduce processing time drastically when there is an application that requires storing unique data values in an array.

Sometimes, I have a maximum array size of 999 (or even 9999) and need to scan through the entire array using LOKUP, in order to find out if the new element to be added already exists in the array, even though I know that most of the array is empty.

One technique I always use in such cases is to fill the array backwards. With maximum array size of 9999, the first element is stored at index 9999, the second at 9998, the third at 9997, and so on.

This way, the LOKUP operation can start from the index which is filled and go to the maximum. It certainly makes a lot of difference in the response time when you do this in an interactive program, such as to stop the user from entering a duplicate item number in order entry.

Of course (tongue in cheek) IBM could make our lives much easier by providing a new opcode (LOKDN maybe?) and do this elegantly.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • 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.

  • 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

  • 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: