IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort on multiple columns of table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sachinmallya83

New User


Joined: 27 Jan 2008
Posts: 4
Location: mumbai

PostPosted: Tue Nov 18, 2008 10:53 am
Reply with quote

If the user wishes to sort on any one of the five fields of a table in either ascending or descending order then how could this be coded in cobol-DB2 using minimum number of queries. We would get the column name and ascending/descending flag from front end and this functionality needs to be incorporated in a stored procedure.
Example:
Field1 Field2 Field3 Field4 Field5
abc 123 abc aaa 111
bcd 234 zxc bbb 222
.................................
If the user clicks on any field name on the front end screen for the first time the data would be displayed in ascesnding order. When he clicks on the same field name for the second time then the data would be displayed in descending order.
Would dynamic SQL be a solution? Can dynamic SQL be used in cobol? If yes , how can we use it for our application.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Tue Nov 18, 2008 11:34 am
Reply with quote

You need to have 10 cursors for this in static SQL.
Dynamic SQL can do this using 2 cursors But Dynamic SQL is usually costly and not preferred in case of online programs.

STFW to get info about Dynamic SQLs.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top