D ds_Cust DS Qualified Inz
D ARCust 3 Dim( 50000 ) Ascend
D Cust 3p 0 Overlay(ARCust:1)
D Cycle 1a Overlay(AECust:3)
Saludos,
Leonel Mejía Chinchilla
Ingeniero en Software
Gerencia Regional de Tecnología y Operaciones
BAC | Credomatic Network
Tel: (506) 2527-9000 ext.1576 Fax: (506) 2295-9407
email: lmejia@xxxxxxxxxxxxxxxxx
AVISO DE CONFIDENCIALIDAD: La información contenida en este mensaje es
confidencial y solamente dirigido a la(s) persona(s) mencionadas arriba.
Si el lector de este mensaje no es el interesado, favor de regresarlo al
remitente quedando estrictamente prohibido la difusión, distribución o
reproducción de este comunicado.
CONFIDENTIALITY NOTICE: The information contained in this electronic
message is privileged and confidential and is intended for the use of the
individual(s) named above and others who have been specifically authorized
to receive it. If you are not the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this message
is strictly prohibited. If you have received this message by mistake,
please destroy it immediately, and notify the sender.
From: Kurt Anderson <kurt.anderson@xxxxxxxxxxxxxx>
To: "RPG programming on the IBM i / System i (rpg400-l@xxxxxxxxxxxx)"
<rpg400-l@xxxxxxxxxxxx>
Date: 10/11/2011 11:14 a.m.
Subject: %lookup on a Data Structure Array
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
I'm trying to reduce some program I/O for program processing millions of
records. I've identified a file that I feel could be loaded into an array
instead of having the program chain out for every record. Usually this
file is between 100-1000 records. However one of our clients has 20,000
records in the file. So before making the change, I decided to do a
little reading on %lookup, to make sure I'd be using it correctly.
http://www.ibmsystemsmag.com/ibmi/developer/rpg/iSeries-EXTRA--Look-Before-You--Lookup/
It turns out that I had misunderstood how to trigger the binary search
with a %lookup. I thought sorting the array was enough, however to get
the binary search one needs to explicitly specify Ascend or Descend on the
array.
So I went to add Ascend to a data structure array, and it won't let me:
D ds_Cust DS Qualified Inz Dim( 50000 ) Ascend
D Cust 3p 0
D Cycle 1a
Error: RNF3501E Keyword is not allowed for a data-structure definition;
keyword is ignored.
I tried adding the Ascend keyword to the subfield that I use in the
lookup, but it doesn't like that either (I wasn't expecting this to work,
but at this point I'm grasping at straws).
I suppose I could make these two fields their own arrays. Though I'm not
really a fan of that. I love using data structures to group like-data
together.
Is there any way to get the new data structure array lookups to use a
binary search?
Kurt Anderson
Sr. Programmer/Analyst
CustomCall Data Systems
As an Amazon Associate we earn from qualifying purchases.