There’s a better approach than you described.
Use preprocessor and alx-task to build different application versions for different OS version.
Then you will have one alx + set of folders with cod files, where every folder has cod files for particular platform version. Alx file will contain directives to install cod files from the suitable folder, according to the connected device OS version.
2
solved Blackberry Version checking