|
In the example below I would add a "DEPENDING ON PRICE-TABLE-LIMIT" to the description of prices (the OCCURS might have to be 0 TO 1500) where PRICE-TABLE-LIMIT is defined as S9(4) COMPUTATIONAL (or BINARY if that works better on the AS400/i series for subscripts) and use PRICE-TABLE-LIMIT as the subscript to load the prices. This way the SEARCH ALL will only look at the number of entries actually loaded rather than all 1500 entries possible. It is still a good idea to initialize the table to HIGH-VALUES but it shouldn't be necessary. The use of a limit should speed the search in most cases and if the table doesn't have to be initialize the modest amount of time to initialize is saved. On Tue, 29 Nov 2005 12:01:30 -0600, you wrote: >-----Original Message----- >From: cobol400-l-bounces@xxxxxxxxxxxx >[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Richard Casey >Sent: Friday, November 25, 2005 8:17 PM >To: COBOL Programming on the iSeries/AS400 >Subject: RE: [COBOL400-L] SEARCH all problems > >Daniel, > >Do a > > MOVE HIGH-VALUES TO PRICE-TABLE > >before you load your inventory data in. > >SEARCH ALL requires the contents of the table (the ENTIRE contents!) to be >in ascending order, otherwise "the results of any SEARCH ALL statement will >be unpredictable." (quote from manual!). > >Unless you specifically initialize the table, the unused entries contain >spaces (hex 40) which are less than numbers (hex F0-F9). That makes the >table out of order, and confuses the SEARCH ALL. > >Hope this helps! >Richard > > >-----Original Message----- >From: cobol400-l-bounces@xxxxxxxxxxxx >[mailto:cobol400-l-bounces@xxxxxxxxxxxx]On Behalf Of Daniel Mielke >Sent: Friday, November 25, 2005 5:42 PM >To: 'COBOL Programming on the iSeries/AS400' >Subject: [COBOL400-L] SEARCH all problems > > > > >Hi all, > >Why can't I get my "search all" to work? This is driving me nuts! > > > >01 PRICE-TABLE. > > 05 prices occurs 1500 times > > ascending key is inv-code > > indexed by ws-price-rec. > > 10 inv-code pic x(5). > > 10 unit-price pic 9(7)v9(4). > > > > > >move "005 " to hold-me. > >SEARCH all prices > > at end > > display hold-me " not found" > > when inv-code (ws-price-rec) = hold-me > > move unit-price of PRICES (ws-price-rec) > > to current-unit-price > > move "N" to eor-UNIT-PRICE. > > > >display > > " price$" > > current-unit-price. > >PRICES 06ED90 CHAR(16) DIMENSION(1500) > 06ED90 (1) '0001 00000106538' > 06EDA0 (2) '0002 00000109909' > 06EDB0 (3) '0003 00000108581' > 06EDC0 (4) '0004 00000121800' > 06EDD0 (5) '0005 00000113959' > 06EDE0 (6) '0006 00000135300' > 06EDF0 (7) '0007 00000091994' > 06EE00 (8) '0008 00000106900' > 06EE10 (9) '001 00000052100' > 06EE20 (10) '002 00000049490' > 06EE30 (11) '003 00000042310' > 06EE40 (12) '004 00000041450' > 06EE50 (13) '005 00000026410' > 06EE60 (14) '006 00000025010' > 06EE70 (15) '007 00000028200' > >Daniel Mielke > >Business Systems Analyst
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.