The sqlca variable in the ecpg_log() was declared with an unnecessarily widescope, so I moved to the appropriate place.Please see attached.