|
Thanks, Bruce. I have recently started using embedded sql so I am happy to learn better and/or recommended ways of doing things. I use * because it reduces typo's, and often I need the entire record anyway. You're saying, though, that this is a shortcut which I may pay for later. (and I probably saw it in a manual early on.) Originally I was using SQLCOD to check for errors, etc, and have switched to using SQL State because of recommendations from this list - probably from you. I didn't think there was any level checking ability but now I understand what you were telling me because of *. I did this test: I created a file with 3 fields, and wrote an rpg pgm with embedded sql to select * from file into :hostds. The hostds is an external ds. Then I added a field to the file, and ran the program again (without recompiling). The hostds, which still contained only 3 fields, was inserted correctly. The fourth field was ignored or dropped apparently. So I'm still confused as to why it's bad to use *. Thanks for responses. I don't doubt you're right! I want to understand the "why" is all. If you know of a particular good reference I'll be happy to read it. I've found a lot of references on the mechanics but not much on recommended practices. Thanks, Phil > >Alright Dr. Smith! > >I have two questions: > >1. How is it different (as far as level checking) from Mark's code? > > I am not sure what you mean, but in SQL, you should select the fields that > you want/need and ignore the fields that you don't want/need. > > >2. How do you make the pgm fail with a level check error? > > > In SQL, you don't. SQL and relation database technology is designed to > isolate I/O from the physical structure of the data. The level check > technology is based on native I/O where the I/O is related > directly to, and > reliant upon, the physical structure of the data. These are > checked at open > time. SQL does no such checking as the * is really a > "convenience" item and > not meant to be the programming construct for embedded applications. > > >Normally I use an external ds for my hostds. > > > And you can still do this and maintain isolation, just so long as > you don't > then ask for all the fields (*) to be inserted into that structure. The > field definitions are what you are after in that case and will apply, but > the structure of the record as a whole is ignored. > > =========================================================== > R. Bruce Hoffman, Jr. > -- IBM Certified Specialist - AS/400 Administrator > -- IBM Certified Specialist - RPG IV Developer > > "America is the land that fought for freedom and then > began passing laws to get rid of it." > > - Alfred E. Neuman > > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
As an Amazon Associate we earn from qualifying purchases.
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.