× 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.



Hello,

These tables have the same identical layout (fields, format names, file
names); just in different libraries.  I tried using a multiple format LF
but, naturally, it blew off because the record format names are the same.

We have programs that work this way in an old application on our system. There are 3 physical files that are built from the same source member (and therefore have identical record formats) But each file ends with the year in which they're created so that we can easily keep them separated by year.

We have programs that need to read 3 years at a time, so we bring them together in a multi-format logcal file as follows:

      A          R CBODETF                   PFILE(CBODET06)
      A                                      PFILE(CBODET05)
      A                                      PFILE(CBODET04)
      A          K CDCUST
      A          K CDWDAT

So this logical is built over all 3 PFs. Unfortunately, this creates two problems:

a) RPG programs won't compile when they reference this LF, since it tries to create 3 record formats with identical names.

b) Every year we have to go back and change the years in the PFILE statements.

To fix the first problem, whenever we compile the RPG programs that use it, we create a temporary copy with only one PF in it. Usually we just go into the DDS and comment out the last 2 PFILEs like this:

      A          R CBODETF                   PFILE(CBODET06)
      A***                                   PFILE(CBODET05)
      A***                                   PFILE(CBODET04)
      A          K CDCUST
      A          K CDWDAT

Then we build a temporary copy of this file in QTEMP and use that copy to compile the RPG program. Once compiled the RPG progam runs over the live file without any problems.

Now, this is code that was written in 1991 and I don't really feel like changing it, so I go through the (rather small) extra effort of changing the years in the LF every January, and re-build it.

But, if I had to do it over again, I'd try to find a better solution. I'd start with SQL to see if a UNION of these files performed well enough (considering that I might have to order the query, and this may cause it to have to build an index or something like that.)

In any case, I think I'd put all of the logic into a service program, and I'd design that service program so that the caller doesn't have to know anything about the files. That way, I can change the service program to access the three files any way I want, and don't have to worry about changing all of the programs every time.

Just something to consider.

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.