parse SAM commands