Instead of programming your own SQLFetch loop with SQLColumnValue/SQLGetData you can call SQLFetchResultsetValues.
This returns a result set as a 2-dimensional string array. The variable datatypes are then handled automatically.

Even better: Move to DataFlex 2024 and use the new SQLExecutor.
That is much easier to use, has various additional options to return the data (variant arrays, struct arrays) and is faster.

Even if you can't move to DataFlex 2024 right now, it is still better to use SQLFetchResultsetValues as that would make it easier to migrate to SQLExecutor later.