jmayer here is my code, thanks
#define MSG_ERROR for(msg_i=0;msg_i<msg_length();msg_i++) { logf(ERROR, "method: %s msg[%d]: %s",method,msg_i, msg[msg_i]); }
cr::zSla_ViolationDate(...)
{
string wc,perSID,method;
int zcount, msg_i, i, fetch_val;
object zobj, zfound, fetch_obj,cr_domset,cr_dob,gl;
perSID = argv[3];
fetch_val = 0;
method = "zSla_ViolationDate";
wc= "(status_flag =2 OR status_flag=12) AND obj_id='%s' ";
send_wait(0, top_object(), "call_attr", "atev", "sync_fetch", "STATIC",format(wc,perSID), -1, 0);
if(msg_error())
{
MSG_ERROR
}
else{
zcount = msg[1];
if (zcount > 0){
zfound = msg[0];
for (i=0;i<zcount;i++){
send_wait(0, zfound, "dob_by_index", "DEFAULT", i, i);
if (msg_error()) {
MSG_ERROR
}
else {
zobj = msg[0];
send_wait(0, zobj, "call_attr","fire_time", "get_val");
if (msg_error()) {
MSG_ERROR
}
else {
if ( (fetch_val == 0) || (fetch_val < (int)msg[0])){
fetch_obj = zobj;
fetch_val = msg[0];
}
}
}
}
wc = format("persistent_id = '%s'",perSID);
send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "RLIST_STATIC",wc, -1, 0);
if (msg_error())
{
MSG_ERROR
}
cr_domset=msg[0];
send_wait(0,cr_domset, "dob_by_index", "DEFAULT", 0,0);
if (msg_error())
{
MSG_ERROR
}
cr_dob = msg[0];
send_wait(0, top_object(), "get_co_group");
if (msg_error())
{
MSG_ERROR
}
gl = msg[0];
send_wait(0,gl,"checkout",cr_dob);
if (msg_error())
{
MSG_ERROR
}
cr_dob.zSlaViolatedDate= fetch_val;
if (msg_error())
{
MSG_ERROR
}
send_wait(0,gl,"checkin");
if (msg_error())
{
MSG_ERROR
}
}
}
}