update a56
set a56.p601=0, 
    a56.remdate=curdate(), 
    a56.remtime=curtime(), 
    a56.remuser='{user_pswd}'
where a56.nr01={peg_nnn}
   && a56.p601<>0;
/*peg_end*/

update a56, i01, i01 as i01_1
set i01_1.p3051=0, 
    i01_1.remdate=curdate(), 
    i01_1.remtime=curtime(), 
    i01_1.remuser='{user_pswd}'
where a56.nr01={peg_nnn}
   && i01.p07=1
   && i01.p06=a56.nr01
   && i01_1.p3051=i01.nr01;
/*peg_end*/
