At 03:57 PM 5/5/98 -0700, Darlene Brengle wrote:
>A company is upgrading from Advanced/36 to AS/400. They have files with
>multiple record types and want to reuse as much code as possible (with
>the necessary changes for the AS/400). Right now the plan is to use
>external data structures to define the fields (for the new code) and
>create logicals to define the fields for use with Query. However, some
>of the fields are packed. What have others done in the past to handle a
>similar situation? Any and all suggestions would be greatly appreciated!
>Direct replies are OK to dkbrengle@juno.com. 

Darlene,

There are a couple of solutions. Using RPG3, you could build DDS for each 
record and declare externally described data structures to bring the 
definitions into the programs. Using RPG4, you can specify a packed or binary 
field directly in a data structure, so you could also use /COPY. Either way, 
this pretty much precludes using externally described RPG files (E instead of 
F), but you can READ, WRITE and UPDAT(e) to/from the data structure, so you 
really don't lose any functionality except KLISTs (You still need data 
structures for multiple field keys). Or, you could actually create a physical 
file for each record type and combine them with a multi-format logical file. 
Legacy code could make use of a format selector program so that no changes 
would be required in the RPG2 programs. This was the solution I chose most of 
the time when I was doing conversions. Format selectors are simple programs 
that are only used during record insert (write) operations. The system calls 
them tr!
ansp
arently and passes the output buffer. The program knows about the record and 
can positionally examine the buffer to determine the correct record name (to 
identify which physical file the record belongs in). It returns the correct 
record name, and the system automagically puts the data there. Note, if you opt 
for this solution, don't use CL. The invocation overhead of initializing 
automatic storage will kill you if you insert a lot of records.

hth
Pete

Pete Hall
peteh@inwave.com 
http://www.inwave.com/~peteh/

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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 ...

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.