|
Phil, Afraid I'm not going to be much help as I've never used imbedded SQL out of C. Perhaps somebody else can jump in? Does it work if you don't make hostDS an array? What is the EXACT text of the message you are getting? Include the second level text please. Also, are you getting it at compile or run time? Bob -----Original Message----- From: c400-l-admin@midrange.com [mailto:c400-l-admin@midrange.com]On Behalf Of Phil Sent: Friday, June 21, 2002 5:34 PM To: c400-l@midrange.com Subject: RE: [C400-L] Embedded SQL - SQLC Bob, I've tried a few things. Here are two versions based on the example in the Host Programming Languages manual, one using an external description (which I'm not sure is supported) and one where the struct is defined in the pgm. The DDS is at the bottom (no null-capable fields). I am trying to select a number of records and have them inserted into a struct, the way in SQLRPG you can select many records and have them inserted into a MODS. I truely appreciate your help!! Phil #pragma mapinc("EMPLOYEE","*LIBL/EMPLOYEE(*all)","both","d",," ") #include "EMPLOYEE" SAMPLER_both_t hostDS[10]; EXEC SQL include SQLCA; main() { EXEC SQL declare CURSOR cursor for select firstname, midinit, lastname, salary, bonus, comm from EMPLOYEE; EXEC SQL open CURSOR; EXEC SQL fetch from CURSOR into :hostDS; } Here's another which is out of the Host Programming manual on pg 26 & 27: typedef _Packed struct { char FIRSTINIT; char MIDINIT; _Packed struct{ short LASTNAME_LEN; char LASTNAME_DATA[15]; } LASTNAME; float SALARY; float BONUS; float COMM; } empDS; empDS hostDS[10]; EXEC SQL include SQLCA; main() { EXEC SQL declare CURSOR cursor for select substr(firstname,1,1), midinit, lastname, salary, bonus, comm from EMPLOYEE; EXEC SQL open CURSOR; EXEC SQL fetch from CURSOR into :hostDS; } DDS for EMPLOYEE: A UNIQUE A R SAMPLER A FIRSTNAME 10 A MIDINIT 1 A LASTNAME 15 A SALARY 7F A BONUS 7F A COMM 7F A K LASTNAME > -----Original Message----- > From: c400-l-admin@midrange.com [mailto:c400-l-admin@midrange.com]On > Behalf Of Bob Crothers > Sent: Friday, June 21, 2002 5:42 PM > To: c400-l@midrange.com > Subject: RE: [C400-L] Embedded SQL - SQLC > > > Can you post the pertinent parts of your code? If different files are > involved, make sure you note that. > > I take it that this is a compile time error. > > Bob > _______________________________________________ This is the C programming iSeries / AS400 (C400-L) mailing list To post a message email: C400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/c400-l or email: C400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-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.