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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

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