By using forupdate to both tables during while loop, we are able to update both tables gather.
static void Job6(Args _args)
{
AvTmpEarning AvTmpEarning;
AvTmpEarningDtl AvTmpEarningDtl;
;
while select forUpdate AvTmpEarning
join forUpdate AvTmpEarningDtl
where AvTmpEarning.AccountNum ==AvTmpEarningDtl.AccountNum
{
ttsBegin;
AvTmpEarning.Car_Allowance = 10.10;
AvTmpEarningDtl.Comm_Rate= 6.34;
AvTmpEarning.update();
AvTmpEarningDtl.update();
ttsCommit;
// info(strFmt("%1", AvTmpEarning.Car_Allowance));
}
}