Hard to say what the problem without seeing the rest of your application. To debug these kinds of things I put in trace statements or errmsg statements to get more information on the problem. For example, put something like: errmsg("In preproc SECTION_9_HIV_COUNSELLING_A_F001. Value of Q6_2 is %d", Q6_2) in your preproc and see what happens.