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



The 2 files have the same format name and are created from the same dds but the 
field name prefix are different.

In the program I have it as
  select afield1,afield2,afield3 from filea where afield1 <> ' ' ...
   union select bfield1,bfield2,bfield3 from fileb where bfield1<> ' ' ...

which works fine.

I did something like the following that errored out.

 create view filevew  as
  select afield1,afield2,afield3 from filea
   union select bfileld1,bfield2,bfield3 from fileb

 UNION and UNION ALL for CREATE VIEW not valid.


I then created lf with 2 record formats with same selected fields as above :

        R AREC  PFILE(FILEA)
          AFIELD1 R
          AFIELD2 R
        AFIELD3 R
        K AFIELD1
        K AFIELD2
      K AFIELD3

        R BREC  PFILE(FILEB)
          AFIELD1 R
          AFIELD2 R
        AFIELD3 R

        K BFIELD1
        K BFIELD2
      K BFIELD3

But when I do a select I get :

select * from LFFILE1
File LFFILE1 in SUDLIB has more than one format.

Thanks,
Sudha


-----Original Message-----
From: rob@dekko.com [mailto:rob@dekko.com]
Sent: Wednesday, November 06, 2002 12:54 PM
To: midrange-l@midrange.com
Subject: Re: LF on 2 files with 'UNION'


This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I ran this following script from iSeries Navigator:
CREATE TABLE rob.sud1 (column1 INTEGER NOT NULL, column2 VARCHAR(100)
ALLOCATE(20));
CREATE TABLE rob.sud2 (column1 INTEGER NOT NULL, column2 VARCHAR(100)
ALLOCATE(20));
INSERT INTO rob.sud1 VALUES(1,'AAA');
INSERT INTO rob.sud1 VALUES(2,'BBB');
INSERT INTO rob.sud2 VALUES(3,'CCC');
INSERT INTO rob.sud2 VALUES(4,'DDD');
CREATE VIEW rob.sudviewa AS
  SELECT column1, column2 FROM rob.sud1
  UNION
  SELECT column1, column2 FROM rob.sud2;
SELECT * FROM rob.sudviewa;
And I got all four rows.

I tried this simple program:
     FSUDVIEWA  IP   E             DISK    RENAME(SUDVIEWA:SUDVIEWAR)
     FQSYSPRT   O    F  132        PRINTER
     ISUDVIEWAR     01
     OQSYSPRT   D    01
     O                       COLUMN1
     O                       COLUMN2
and I get:
Message Type . . . . . . . . . . . . . :   RNX
Additional Message Info  . . . . . . . :   1011
Message Data . . . . . . . . . . . . . :
             Undefined record type is found in file SUDVIEWA.

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin




Vern Hamberg <vhamberg@centerfieldtechnology.com>
Sent by: midrange-l-admin@midrange.com
11/06/2002 01:12 PM
Please respond to midrange-l

        To:     midrange-l@midrange.com
        cc:
        Fax to:
        Subject:        Re: LF on 2 files with 'UNION'


Sudha

Do the 2 files have the same format, same field names? Just different sets
of data? Then you can build a single-format logical (which SQL can handle)
and specify the 2 files as the based-on files of the CRTLF command.

IIRC, a problem with views, performance-wise, is that the view LF really
stores only the SELECT statement and maybe an access plan, not the actual
access path. So the SELECT is run every time you access the view. This may
be why RPG can't use it, since native IO doesn't know how to run SQL
statements.

HTH

Vern

At 11:48 AM 11/6/2002 -0600, you wrote:
>I am trying to fine tune a performance issue I have in my project where I
>am using a 'Union' over 2 large files.  This returns me a distinct result
>of selected fields from both the files, which is wonderful.  But the time
>taken is quite significant since each call creates a union. I cannot
>create a view on Union, so I am trying to find an easier way to do this
>like say via maybe a LF.  Is this possible?  Else, creating 2 separate
>indexes/views on the 2 files on the selected fields will help?
>
>TIA,
>Sudha
>
>Sudha Ramanujan
>SunGard Futures Systems
>sramanujan@sungardfutures.com
>(312)577-6179


_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

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