View Full Version : Dynamic sort of data in ILE????
Guest.Visitor
06-26-2002, 07:23 AM
Erik, I don't have a real clear picture of what it is you need, but I think the QLGSORT API is what you should check out. Bill > Is it possible to dynamically sort data in a physical file within an ILE program?
ejolro
07-11-2002, 08:41 AM
Is it possible to dynamically sort data in a physical file within an ILE program? I have a program that displays data in a subfile. I need to allow the users to select different 'Sorts' of the data for display. The sorts will be multi-field sorts and instead of excluding data the data will be reorganized with the users selection at the top and a default sort after that. The user's will be able to 'Sort' data based on 3 fields with 108 or more possible combinations. The problem is that I can't find a way to get a logical file to do what I need to do. The user can select one of 6 subjects ,fiction or nonfiction, and one of three types of books. It the user picks a subject it will appear at the top of the subfile with the other subjects below it in a default sort order. Fiction or Non-fiction displays both fiction and nonfiction with the selected category at the top. The book types will work in a similar manner. There are six possible subjects defined by an X in one position of an 8 position character field.(Positions 5 and 7 are not used anymore) Fiction/Nonfiction and book type come from a 4 character field. The first character is an F or an N(fiction/nonfiction), the second character is the book type(A, P, or R). The third character is grade level which will always be sorted ascending and the fourth character is not used for the sort. How do I get the sort to work on the subjects if the user picks a subject with an X in postion eight of the subject field instead of a subject with an X in position one? Also, how do I get the secondary sort/s to work? Since this is not Include/Exclude I'm not sure how to proceed. This is a hierarchical look at the possible sorts starting with subject: Sub1 Sub2 Sub3 Sub4 Sub5 Sub6 Fiction Nonfiction Type1 Type2 Type3 Default Grade Level Sort(Ascending) 4 levels Any help would be appreciated. Thank you, Erik J. Osberg
ejolro
07-11-2002, 08:41 AM
Thanks for the help, I ended up using a new TAATOOL, SORTDBF to accomplish the sorts. I built the command in CL, copied it into my ILE program and made the necessary changes. SORTDBF selects the records and sorts them then creates a file in QTEMP. I then overrode the file in the program to the QTEMP file created by SORTDBF. It works wonderfully. Erik
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.