Re: Pro*C Variables and Define Tokens

From: Marek Pytlik <pytlik_at_ra.cs.umb.edu>
Date: 24 Sep 92 12:11:38 GMT
Message-ID: <1992Sep24.121138.6821_at_cs.umb.edu>


In article <1992Sep22.175344.5214_at_cbfsb.cb.att.com> gerette_at_cbnewsb.cb.att.com (marianne.g.pittorino) writes:
>
>I am having trouble declaring Pro*C variables using #define tokens. In my
>(UNIX) application, we have an include header file that has #define tokens
>for all our data elements. When declaring a 'C' or database variable, we
>always use the #define token. For example, if a customer name variable were
>needed, we code:
>
> char custname[CUSTNAME_SZ + 1]; /* add one for NULL byte */
>
>This helps us easily maintain the application if data elements should change
>size. I have found, however, that the Pro*C compiler (pcc) reports an error
>when I use this construct:
>
>Precompiling x.pc
> 20 VARCHAR custname[CUSTNAME_SZ + 1];
> 20 ........................^
> PCC-S-0018: Expected "<unsigned_integer>", but found "CUSTNAME_SZ" at
> line 20 in file x.pc
>
> 25 where cust_id = :cust_id;
> 25 ........................................^
> PCC-S-0026: Undeclared host variable "cust_id" at line 25 in file x.pc
>
>
>I understand that the second error (PCC-S-0026) is really a result of the first
>error. What I cannot believe is that the Pro*C precompiler cannot recognize
>#define tokens (and, by the way, it balks at the "+" sign as well). This is
>very important to our application; it took many months to standardize all our
>code with the #define tokens. Does anyone know how to get this to work?
>
>
>
>Marianne

To make this work, before precompilation, put the code thru preprocessor.

Mark Received on Thu Sep 24 1992 - 14:11:38 CEST

Original text of this message