I am surprised you are interested in working in awk. Not many do any more :-) :-( Be aware that for the most part, when you write an awk script you are using on big while loop (while there is still input) and applying the same tests and condition checks to each line.
Not sure I know what WSN is, but can offer advice. Understand that $0 is the entire input line, blanks are the default field separator, and you will have $1, $2, ...$N number of fields per line. You can change the field separator using the -F'' argument on the command line. Your script must start with a { and end with a }