Sample date conversion program using vugen scripting in Load runner

//Main Function
Action()
{
char *ConvDate;

//Call date conversion function
dateConv("10/JUL/2009", ConvDate);
lr_output_message("date is %s",ConvDate);
return 0;
}

//Date conversion function
dateConv(char *MyDate, char *ReqDate)
{
lr_save_var(MyDate,2,0,"Date");
lr_save_var(MyDate+3,3,0,"pMonth");

lr_output_message("Month is %s",lr_eval_string("{pMonth}"));

if(strcmp(lr_eval_string("{pMonth}"),"JAN")==0)
lr_save_string("01","Month");
/*  Similar rest of the code goes here....*/
else if(strcmp(lr_eval_string("{pMonth}"),"DEC")==0)
lr_save_string("12","Month");

lr_save_var(MyDate+7,4,0,"Year");

ReqDate = lr_eval_string("{Month}/{Date}/{Year}");
lr_output_message("date is %s",ReqDate);

return 0;
}

No comments:

Post a Comment