|
You've never had to use cursors. Since the beginning you've been able to do SELECT INTO. The SELECT INTO is used when you only need to return a single row of 1 or more columns. HTH, Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121
-----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jake M Sent: Wednesday, September 20, 2006 2:22 PM To: RPG programming on the AS400 / iSeries Subject: Re: Simple Display file problem That looks great. So, no declaring, opening and closing cursors? That is pretty neat. cheers, Jake. On 9/20/06, rob@xxxxxxxxx <rob@xxxxxxxxx> wrote:Great points. One "point of information" though. It's not /Exec Sql Select ItemNumber, ItemDescription From ItemFile Where ItemNumber = :Item; It's Exec Sql Select ItemNumber, ItemDescription From ItemFile Where ItemNumber = :Item; No slash. Actually it's Exec Sql Select ItemDescription into :ItemDescription FromItemFile WhereItemNumber = :Item; After all, if you already know the item number, why move those bytes around again? And, on a cursorless select you need theinto. But that'sjust details. Your points are well taken. Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com "Alan Campin" <Alan.Campin@xxxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 09/20/2006 01:49 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Simple Display file problem <snip> Thanks for that insight. Can SQL be used in free-form inV5R4 withoutthe use of /EXEC and and /END-EXEC tags in C specs? Or do westill have touse /EXEC and /END-EXEC but can get rid of the C specs. We arestill on V5R3and will take some time to get there but such things are really good to know. </snip> New syntax is /Exec Sql Select ItemNumber, ItemDescription From ItemFile Where ItemNumber = :Item; No /End-Exec. Just a semi-colon. Asked my boss to get V5R4 on order. <snip> Yes IBM did give us an easy way create an LF & include onlythe fieldsyou need... </snip> Except the catch. It works and increases performance a lotbut if I needto bring in five tables into a program, I am going to haveto define 5different logical views unless I can do some joins. Evenhaving a toolto do this, a lot of work and difficult to maintain. I havebuilt systemusing the techniques but a ton of work. <snip> all true Alan. But does a 600 CPW i5 have the horsepower to run pure SQL instead of RPG? My guess is it does not. Fetching thru an SQL cursor must be slower than setll and reade. The mapping ofmore than afew SELECT columns would quickly become more cpu intensivethan a bytecopy into a record format. </snip> Actually the opposite is true. 1. New SQL I/O system is 5 to 7 times faster than DDS file. 2. New SQL Index system is 2 to 3 times faster than DDS indexes. 3. SQL has a new query optimizer that is a lot more efficient. 4. Reading in only the data you need is always going to befaster thanreading the entire record. A lot of reasons for thisprimarily having todo with buffers. IBM optimizes the moves but byte moves are just not going to be significant. Record I/O is the most expensivething in thesystem. 5. The other thing with SQL is that you can read multiplerecords intoan array mapped to a user space. You cannot do that withRecord I/O. Ifyou are reading multiple tables with selects and reading in multiple records into a user space, the performance is going to beway faster.All the work is going to happen at the machine level. Igave an examplein a previous post. In short, what used to be true is just not true anymore andit is onlygoing to get better. SQL is present and the future. The only reason I see to continue a lot of record I/O is severely unnormalized databases. -- This is the RPG programming on the AS400 / iSeries(RPG400-L) mailing listTo post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries(RPG400-L) mailing listTo post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.-- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.