|
Frank, I am using the DESCRIBE to populate the standard SQLDA data structure, (I didn't show the SQL INCLUDE statement). I then process the data from the SQLDA to determine the field type, char, or Numeric,packed, etc.,(SQLTYPE) D* SQL Descriptor area D SQLDA DS D SQLDAID 1 8A D SQLDABC 9 12B 0 D SQLN 13 14B 0 D SQLD 15 16B 0 D SQL_VAR 80A DIM(SQL_NUM) D 17 18B 0 D 19 20B 0 D 21 32A D 33 48* D 49 64* D 65 66B 0 D 67 96A D* D SQLVAR DS D SQLTYPE 1 2B 0 D SQLLEN 3 4B 0 D SQLRES 5 16A D SQLDATA 17 32* D SQLIND 33 48* D SQLNAMELEN 49 50B 0 D SQLNAME 51 80A D* D SQLVAR2 DS D SQLLONGL 1 4B 0 D SQLRSVDL 5 32A D SQLDATAL 33 48* D SQLTNAMELN 49 50B 0 D SQLTNAME 51 80A D* End of SQLDA This was done in order to create a standard prompt window application that was dynamic in nature that I could use in numerous applications. There maybe a better way to do this but at the time I did this, I was pushed for a deadline....as always. Russell Conerly ------------------- > Hi Russell, > I am fairly familiar with SQL, but one thing eludes me. > I read the manuals, thats where I get my information > but I just cannot comprehend what the SQL DESCRIBE is > for. (Incidently the SQL manuals require that I bend > my brain into the 4th dimension before I grasp even the > slightest glimmer, but at least we have documentation.) > I dont know what DESCRIBE does nor have I ever had a > need to use it. If I knew what it did I probably would > use DESCRIBE. > If possible can I ask you to give me your understanding > of what DESCRIBE is and how to use it. > > Yous in hope, > Frank Kolmann > > *************** REPLY SEPERATOR **************** > from: Russell Conerly <rconerly@xxxxxxxxxxx> > subject: Re: SQLRPGLE - Dynamic selection > > Here's a snippet... > eval statement = 'Select ' > + %trim(Field1) + ',' > + %trim(field2) + > ' from ' + %trim(filename) > C/EXEC SQL > C+ PREPARE SQLSTMNT FROM :statement > C/END-EXEC > > C/EXEC SQL > C+ DESCRIBE SQLSTMNT INTO :SQLDA USING ALL > C/END-EXEC > > C/EXEC SQL > C+ DECLARE A1 CURSOR FOR SQLSTMNT > C/END-EXEC > ...etc. > Hope this helps. > Russell Conerly > > > _______________________________________________ > 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-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.