initialise out_do_z at beginning of ifs, set to zero if required