Pro*C Variables and Define Tokens
Date: Tue, 22 Sep 1992 17:53:44 GMT
Message-ID: <1992Sep22.175344.5214_at_cbfsb.cb.att.com>
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 Received on Tue Sep 22 1992 - 19:53:44 CEST