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



Michael,

Yes, I would have to identify the libraries using UNION.

This IS a clear and simple way to handle it.

I'd still like to see... a simple function that does
the same thing  ...wouldn't have to type the library
name twice when using interactive sql. :-)

Thanks,

John B.  

------------------------------

message: 4
date: Tue, 17 Feb 2004 17:34:55 -0500
from: "Michael Naughton" <mnaughton@xxxxxxxxxxxx>
subject: Re: SQL question - Library that file resides in as a column
        in SE   LECT stmt ou

Maybe I'm missing something, but if you were thinking of using a UNION,
then you must have been prepared to identify the libraries as part of the
SQL statement, e.g.:

SELECT code, id, seq, startpos FROM lib1/sf
UNION
SELECT code, id, seq, startpos FROM lib2/sf
UNION
SELECT code, id, seq, startpos FROM lib3/sf

in which case  you could just build the library name into the SQL output:

SELECT code, id, seq, startpos, 'lib1'  FROM lib1/sf
UNION
SELECT code, id, seq, startpos, 'lib2' FROM lib2/sf
UNION
SELECT code, id, seq, startpos, 'lib3' FROM lib3/sf

hth

RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> writes:
>I have a SELECT statement, looks like this -
>
>
>SELECT code, id, seq, startpos
>  FROM sf
>     ....+....1....+....2....+....3....+. 
>     Code   ID   Sequence  Start Position 
>     SR10   IT        0            1      
>     SR10   IT        0           36      
>     SR10   IT        0           37      
>     SR10   IT        0           38      
>     SR10   IT        0           39      
>     SR10   IT        0           40      
>     ********  End of data  ********      
>
>
>I'd like the library that the file (sf) resides in to be a column in
>the output of the SELECT statement.
>
>
>     ....+....1....+....2....+....3....+....4....+....5....+ 
>     Code   ID   Sequence  Start Position     Library
>     SR10   IT        0            1          MYLIB
>     SR10   IT        0           36          MYLIB
>     SR10   IT        0           37          MYLIB
>     SR10   IT        0           38          MYLIB
>     SR10   IT        0           39          MYLIB
>     SR10   IT        0           40          MYLIB
>     ********  End of data  ********      
>
>
>
>Is there a Function/Column keyword or something/someway to do this?
>
>
>
>Reason for this is -
>
>I have an file that resides in multiple libraries.
> (identical file, same fields etc.)
>
>I'd like to check some of the field values for validity (in all the
>libraries the file exists.)
>
>I thought I might use "UNION" to put them all together and test them all
>at
>once but this wouldn't do me any good w/o the "originating" library.


Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA  01376
413-863-4357 x444
mnaughton@xxxxxxxxxxxx



------------------------------

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.