× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Based variables
  • From: "M. Lazarus" <mlazarus@xxxxxxxx>
  • Date: Fri, 08 Dec 2000 12:00:27 -0500

Hi all,

  I have a program that uses a based (not to waste unused memory) array, 
DIM'ed to the max (32,767).  The reason I chose that route is for 
performance.  The application must output the same batch data multiple 
times, once for each store.

  In order to do this via a *PF, I would have to read each batch over and 
over in order to output the batch for each store.  That just rubs me wrong, 
since there can be up to 5,000 stores and an undetermined number of batches.

  My solution was to read through a batch, loading the array via an 
externally described DS referencing the input file, moving the pointer up 
for each record.

  So far, this works well, since the current expected maximum number of 
records per batch is less than 5,000.  I'm trying to think ahead and would 
like to accommodate a much larger batch.
Input record length that I am storing in the array is 148.

  According to the RPG manual, ALLOC can handle 16,776,704 bytes.  Is there 
a way I can create a based field that would handle the maximum 
length?  That would bump up the maximum records from 32,767 to 113,356 
(16776704 / 148).

  I know that this can be done via a *USRSPC, but wouldn't that incur 
additional disk I/O?


Store file = primary

        Store ID
           1
           5
           6
          10
         etc... (5,000 maximum)


Batch file = secondary

        Batch  Seq#
          1     1
          1     2
          2     1
          2     2
          2     3
          2     4
        etc.    etc.

Output

Store   Batch  Seq#
   1      1     1
   1      1     2
   1      2     1
   1      2     2
   1      2     3
   1      2     4
   5      1     1
   5      1     2
   5      2     1
   5      2     2
   5      2     3
   5      2     4
   6      1     1
   6      1     2
   6      2     1
   6      2     2
   6      2     3
   6      2     4
        etc.    etc.


  Any suggestions?

  TIA.

  -mark

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.