update a77, z_a77_std as imp01
set a77.p01=imp01.p01, 
    a77.nr01=imp01.nr01, 
    
    a77.remdate=curdate(), 
    a77.remtime=curtime(), 
    a77.remuser='{user_pswd}@std_tables'
     
where (    a77.p01=imp01.p01
        || a77.nr01=imp01.nr01
      )
   && (    a77.p01<>imp01.p01
        || a77.nr01<>imp01.nr01
      )      ;
/*peg_end*/

insert into a77
(nr01, p01, is_std, p300,
remfdate, remftime, remfuser, remdate, remtime, remuser)
select imp01.nr01, 
       imp01.p01, 
       imp01.is_std, 
       imp01.p300, 
       
       curdate() as remfdate, 
       curtime() as remftime, 
       '{user_pswd}@std_tables' as remfuser, 
       curdate() as remdate, 
       curtime() as remtime, 
       '{user_pswd}@std_tables' as remuser 
from z_a77_std as imp01
left join a77 on a77.nr01=imp01.nr01
where a77.nr01 is null;
/*peg_end*/