Using #define

You can use #define values in a declare section to dimension arrays and initialize variables. When you use #define in a host variable declaration, place it before the host variable declaration that uses it. For example, the following two examples are valid:

#define PLEN  26 
 CS_CHAR name[PLEN]; 

and:

exec sql begin declare section; 
 #define  PLEN  26 
 exec sql end declare section; 
     ... 
 exec sql begin declare section; 
 CS_CHAR  name[PLEN]; 
 exec sql end declare section; 

You can use #define to declare symbolic names. Make the declaration before using it in the application. For example, to define “10” symbolically, use this nomenclature:

exec sql begin declare section;
 #define count_1 10
 CS_CHAR var1[count_1];
 exec sql end declare section;