× 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: Re: Pre runtime Array
  • From: dhandy@xxxxxxxxxxx (Douglas Handy)
  • Date: Thu, 12 Aug 1999 02:43:32 GMT

Keshav,

>Where would one use a  pre run time array & how?.Examples will help!!

I haven't used one since RPG II, so I won't post an example.

RPG II had a limit of 15 chain or demand files (and later full
procedural files).  Sometimes monolithic programs needed more than
this to perform validation or obtain cross-reference information.  And
we couldn't CALL a subprogram because CALL did not exist.

So to circumvent the limit, one option was to read some small lookup
files into pre-run time arrays, then use LOKUP instead of CHAIN.  On
the S/3/32/34/36, this in some cases was also a potential performance
boost by eliminating the disk I/O for a frequently accessed small
file.  But it had the downside of file changes not being reflected
until the program was reloaded.

On the S/38 and AS/400, single-level storage has mostly eliminated the
concern over disk I/O -- it will probably not have a page fault if
accessed enough, and if not accessed enough, the memory is probably
best used for something else anyway.

The limit of 15 C/D/F files was also increased to 50 with RPG III, and
completely lifted with RPG IV.

So, to answer where one would use it, my recommendation is to not use
it in new code.  (Someone else may not agree.)

As to how, you use it almost like a compile time array.  Except that
instead of listing the array entries in the source, they get
dynamically loaded when the program is initiated.  Unlike a compile
time table though, you typically want to over allocate the array size
to allow for growth in the underlying file.  This also means you may
need special checks to see if your look-up field is blank or zero,
because you probably will have blank/zero entries in the array which
may or may not be considered "valid", depending on business rules at
hand.

Another one of the many things that can seem odd to new RPG
programmers looking at old RPG code, but was more widely used at the
time.

If you go back far enough, they were also useful for reading in your
array entries from a card deck...

Doug
+---
| 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
+---END



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.