I have an application with a web front end with a cobol/db2 back end. The results from DB2 get sent back to the web page 10 at a time. There is an Order by clause which sorts these results by an account #.
If I ask the user on the webpage what column to sort by, is there a way on the mainframe end to alter the cursor, so instead of sorting account #, it could sort by account #7 or name or dollar amount.
What I was picturing was an 'order by x' clause, where x is an integer. Based on what the user indicated on the web page, x would be assigned the column number, and the cursor would sort accordingly.
But that doesn't seem to be possible, as I am getting bind problems, that the order clause is invalid because x is not a column of the results table. (SQL=-208).
Is it possible to do this in the declare cursor statement, other than by writing separate cursors for each possibility?