Thread: Help with Struct

  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
    28,413
    Check the relevant documentation.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    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
    Chappell Hill, Texas
    Posts
    2,332
    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
    Mainframe assembler programmer by trade. C coder when I can.

  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
    Chappell Hill, Texas
    Posts
    2,332
    What platform?
    Mainframe assembler programmer by trade. C coder when I can.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-03-2008, 03: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, 09:40 PM