Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamic order by clause in a cursor? Is it possible?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Treefarn

New User


Joined: 16 Jun 2005
Posts: 1

PostPosted: Thu Jun 16, 2005 7:32 pm    Post subject: Dynamic order by clause in a cursor? Is it possible?
Reply with quote

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?
Back to top
View user's profile Send private message

sangiah

New User


Joined: 10 Jun 2005
Posts: 62

PostPosted: Tue Jun 21, 2005 12:22 pm    Post subject:
Reply with quote

Can u use dynamic sql
Back to top
View user's profile Send private message
kulkarni_alok

New User


Joined: 07 Jul 2005
Posts: 4

PostPosted: Fri Jul 08, 2005 12:06 am    Post subject:
Reply with quote

go to the link www.mainframeweek.com/code/showcode.php/0075/mw75db21.txt
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us