>> What is a multiformat logical file? 

> Multis combine multiple physical files that contain similar keys (I think)
> under one logical file. They are read in the key order. RRNs are
> meaningless, since you're looking at many physicals, hence you can have the
> same RRN for different records.

> It's an AS/400 (IBM?) only technique, originating somewhere before true
> logicals or something. I don't really know the history, just that they are
> associated with S36 in my thinking.

Multi-format logicals can accomplish more than just this. I have used them to
combine multiple instances of the same file. By this I mean that I have been at
places where they keep each year of sales history in a different file (named
like SALES91, SALES92, etc.). A multi-format logical is a way to combine all
years into a single logical, so that you don't have to process each physical
individually.

                   R  RSALES91                               PFILE(SALES91)
                   K  SHIPDATE
                   K  ORDER#
                   R  RSALES92                               PFILE(SALES92)
                   K  SHIPDATE
                   K  ORDER#
                       ...

Having similar keys is normally the case, but it not required. There is a place
holder in the key field list to omit a key. The keys specified must be similar.

                   R  REC1                                         PFILE(FILE1)
                   K  FIELD1
                   K  FIELD2
                   K  FIELD3
                   R  REC2                                         PFILE(FILE2)
                   K  FIELD1
                   K  *NONE
                   K  FIELD4

In this example, FIELD2 does not exist in the second file. Although FIELD4 
may or may not exist in the second file, I am using FIELD4 as the third key.
Even though FIELD4 has a different name than FIELD3, it's size and
attibutes match.

RRN's still matter and are meaningful, as they are the RRN of the record in
the physical file. When you are using a multi-format logical file, the record
format name of the last record read is in the INFDS. You must use that to
identify the physical file that the record came from.

I do not use these much, but they have come in handy at times. This is
especially true with files such as Sales History where they are kept in separate
files. If I need to look at 5 years of sales, then a logical containing the 5 
years
is kept up-to-date. Each year-end, the logical is re-built with the appropriate
files, so the programs do not need to be changed to reflect the appropriate
files.

Joe Teff
Information Technology Consultant
IBM Certified Specialist - AS/400 RPG Programmer
Quality Data Systems
Minneapolis, MN

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


This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2019 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].