kabeldag,
In addition to
Anonymous Monk's advice, see
Implementing Dispatch Tables for the general case. If you have a situation where a different block of code needs to be run depending on your 30 different formats and you can determine the format relatively easy - dispatch tables are the way to go.