Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort on multiple columns of table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Sort on multiple columns of table
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    Post subject:
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    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 Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 4 Fri Sep 22, 2017 4:56 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us