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



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
>




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.