I'm not sure i understand the question - you say you are building a table but you don't say how you are building a table. Is this a memory array? Is it a physical table in a database? A spreadsheet or what? If you are reading a file with data in no particular sequence and storing that data in a database table then the order it is stored in the table really makes no difference. A query statement against the table to retrieve the data is where you would sort the data with an "order by" clause. I would like to know how you are populating your table from the file and tell me also what kind of file you are using. If the file is just plain text, comma delimited text, etc. There are a bazillion ways to manipulate data. Please be more specific.
Also, if you are creating a database table from the data your db software should possibly have indexing features to improve the data retrieval with your select statement containing the order by clause. If you insist on making the table be "sequential" the create a temporary table from the file and then create a permanent table from the temporary table by using a select statement that orders the data, e.g.:
table A with one column has 4 rows with (apparently) nonsequetial data -
Widget_ID
--------------
4
2
1
3
You would create a table B with the data sorted in descending order like this:
create table B as select * from table A order by widget_id desc
Last Wiki Answer Submitted: December 30, 2008 3:45 pm by Apickel350 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Since the title of your post is “Arrays” I assume you are talking about an array. Load the array from the file and then use the SORTA keyword to sort the array.
Is this a COBOL question?
Since the title of your post is “Arrays” I assume you are talking about an array. Load the array from the file and then use the SORTA keyword to sort the array.