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


  • Subject: Embedded SQL and Externally Described Data Structure
  • From: "Sneddon, Jim" <JSneddon@xxxxxxxxxxxxxxxxxxxxx>
  • Date: Wed, 4 Apr 2001 08:53:19 -0700

I've started using SQL in RPG and I can use a data structure based on the
file so that I don't have to hard code every field name in the file:

For Example:

D ResvhistR       E DS               ExtName( RESVHIST)

then I can open a cursor on the file RESVHIST with a SELECT * FROM RESVHIST
WHERE... blah blah blah

When I do a FETCH next from -cursor- into :ResvhistR I get all my field
names automatically without having to list every field under the ResvhistR
data structure and without having to name every field in the select
statement.

Is there some way to do this from a multiple-file join SQL statement? Like 
SELECT *
FROM RESVHIST, SHWFIL, DETLHIST 
WHERE ...blah blah blah

I tried to set up another data structure overlaid by the 2 or 3 files I need
but the compiler says I can't have a data structure as a subfield of another
data structure.

If I set up a data structure with all the fields I want hard-coded then it
works fine.... but I have to list every field name in the SELECT statement
and then have them in the same order in my data structure. 

I just wondered if I could take advantage of the external definitions for
each file and not have to worry about defining every single field I need
with multiple files. 

Thanks
Jim Sneddon
AS400 RPG Programmer
Allstate Ticketing
jsneddon@allstateticketing.com
www.showtickets.com

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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 ...


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.