Compare & replace contents within a file

I have 2 files

file1

1       TMQUEUE QUE1    STMW633A
100     DMADM   DOMGRPSTMW633A  STMW633A
100     GWADM   GWTGRPSTMW633A  STMW633A
100     GWADM   GWTGRPSTMW633AA STMW633A
100     GWADM   GWTGRPSTMW638A  STMW638A
100     TMSYSEVT        EVTGRPSTMW633A  STMW633A
100     TMSYSEVT        EVTGRPSTMW638A  STMW638A
100     WSL     WSLGRPSTMW633A  STMW633A
100     WSL     WSLGRPSTMW638A  STMW638A

file2

1 TMQUEUE QUE1 1
100 DMADM DOMGRPSTMW633A 1
100 GWADM GWTGRPSTMW633A 1
100 GWADM GWTGRPSTMW633AA 1
100 GWADM GWTGRPSTMW638A 1
100 TMSYSEVT EVTGRPSTMW633A 1
100 TMSYSEVT EVTGRPSTMW638A 1
100 WSL WSLGRPSTMW633A 1
100 WSL WSLGRPSTMW638A 1

First 3 columns in the files are same except the 4th one. I want to replace
1st column in file2 with the 4th column in file1 by comparing first 3 columns from both the files.

Thanks in advance

awk 'NR==FNR{a[$3]=$4;next}
a[$3]{$1=a[$3];print}' file1 file2

If you get errors use nawk or /usr/xpg4/bin/awk on Solaris.

Regards

Thanks. It worked.