awk issue on AIX

Hi,
two teams at two locations - A & B. At location A, we have AIX 5.3 and at location B, we have AIX 5.1. We execute the below awk command in loc A and it executes successfully(part of a larger script). But the same does not get executed in the loc B server.
We are not able to access the loc B server(for all odd reasons). the command is

time_comjob=$(awk -v var1=$comptd_prog_name -v var2=$end_job_name '$0 ~ var1 {print $0; getline; while ( $6 !~ var2) {print;  getline;} exit 0;}' $prev_logfile |grep -i "$comptd_prog_name.*terminated ok"  |tail -1 |awk '{print $4}')

Sorry guys, the issue we had was a terrible misunderstanding of the requirements. We had written the script based on the requirements given and guys there were testing it for some other condition. This is the first time that I have seen such gross misunderstanding of requirements. :frowning: