Swifty - 2011-10-26

REXX/SQL returns the results of a SELECT statement in a stem variable. There is no intrinsic order of retrieval for such variables, so it is impossible to tell what order the results columns were in.

The column orders were almost certainly known when the data was retrieved from the database; could the column list be added to the values returned in the stem?

For example, Select Persnum,Salary from employee_details and Select Salary,Persnum from employee_details may return exactly the same results.

Persnum and Salary may well both be 6-digit numbers, but I wouldn't want to get them in the wrong order! OK, I know that the stem defines which column the data came from, but it is still true that the returned stems could be identical, giving you no idea what order you asked for the data.

If I'm executing a user-supplied statement, I cannot tell which order to display the results columns, without deciphering it from the SQL, and that gets VERY complicated!