Help with Struct

This is a discussion on Help with Struct within the C Programming forums, part of the General Programming Boards category; I am having trouble making sense of this structure. Can anyone take time to comment or note what is happening ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    115

    Help with Struct

    I am having trouble making sense of this structure. Can anyone take time to comment or note what is happening in this code? Thanks.

    Code:
    typedef struct {
        char    sqlcaid[8];
        int     sqlcabc;
        int     sqlcode;
        struct {
        short   sqlerrml;
        char    sqlerrmc[70];
        } sqlerrm;
        char    sqlerrp[8];
        int     sqlerrd[6];
        struct {
        char    sqlwarn0;
        char    sqlwarn1;
        char    sqlwarn2;
        char    sqlwarn3;
        char    sqlwarn4;
        char    sqlwarn5;
        char    sqlwarn6;
        char    sqlwarn7;
        } sqlwarn;
        char    sqlext[8];
    } IISQLCA;

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,753
    Check the relevant documentation.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    That is the SQLCA ("SQL Communications Area") structure from a C program that connects to IBM DB2.

    SQLCAID is a string "SQLCA "
    SQLCABC is the "byte count", or, size of the SQLCA
    SQLCODE is the return code from DB2 about the success or failure of the SQL statement.
    SQLERR* are fields that contain error information, used by module DSNTIAR (on the mainframe, not sure of the name for DB2 LUW) to spit out a full error message.
    SQLWARN* fields are different warning flags used by various different SQL statements.
    SQLEXT may be (not certain on this one) a placeholder for SQLSTATE, a cross platform error code (whereas SQLCODE is a platform specific error code).

    It's using nested structures. No big deal.

    Todd
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    115

    Thanks for your feedback

    I do not have any relevant documentation. The consulting group left us high and dry. I had some C programming classes 10 years ago and was forced to learn as much possible about this program. It is very large. So anyway thanks very much for taking time to help me get thru some of this stuff.

    -Carl

  5. #5
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    What platform?
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-03-2008, 02:10 AM
  2. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM
  3. Replies: 10
    Last Post: 05-18-2006, 11:23 PM
  4. What's wrong with my search program?
    By sherwi in forum C Programming
    Replies: 5
    Last Post: 04-28-2006, 09:57 AM
  5. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21