I've found this problem with "ecpg" (I even tried moving up to version 2.9)
where the code:
exec sql include sqlca;
exec sql type APC_LAYO_FLD is struct { long apcl_id; char apclf_sect_flg[2];
};
exec sql type APC_LAYOUT is struct { long apcl_id;
};
exec sql begin declare section; APC_LAYOUT PL; APC_LAYO_FLD PLF;
exec sql end declare section;
int
print_template()
{
exec sql begin declare section; char curr_sect[5];
exec sql end declare section;
if (1) { exec sql declare fld_curs cursor for select apc_layo_fld.* from apc_layo_fld
where apcl_id = :PL.apcl_id and apclf_sect_flg = :curr_sect order by apclf_ln_nbr,
apclf_col_nbr; } exec sql open fld_curs;
}
If I remove the "if", or change the structure reference ":PL.apcl_id" to
a constant it doesn't abort. I think this has something to with the
"open" being outside of the block. I try and dig into the code a bit as time
permits. Thanks.
Tim Nelson