View previous topic :: View next topic |
Author |
Message |
rasprasads Beginner
Joined: 10 Dec 2002 Posts: 59 Topics: 20 Location: Chennai
|
Posted: Mon Jun 09, 2003 11:27 pm Post subject: Internal Tables - Clarification |
|
|
I have declared the following internal table :
Code: | 05 WS-ARRAY OCCURS 100000 ASCENDING ARRAY-KEY INDEXED BY IND-A.
10 ARRAY-KEY.
15 A-NR PIC X(00009).
15 AS-NR PIC 9(5). |
I am loading data into this table, but find they are not actually sorted in ascending order in some cases. For example i am giving two unordered sets:
Code: |
7L558552300003
7L558552300004
00300620200001
00300620200002
|
Code: |
7BW00132500004
67C00252300001
|
Why is this happening even when i am giving ASCENDING clause ? _________________ Rasprasad S |
|
Back to top |
|
|
Glenn Beginner
Joined: 23 Mar 2003 Posts: 56 Topics: 3
|
Posted: Tue Jun 10, 2003 12:04 am Post subject: |
|
|
The ASCENDING clause does not sort the data, merely specifies to the system to expect the data to be sorted for purposes of the SEARCH ALL. |
|
Back to top |
|
|
rasprasads Beginner
Joined: 10 Dec 2002 Posts: 59 Topics: 20 Location: Chennai
|
Posted: Tue Jun 10, 2003 12:31 am Post subject: |
|
|
Glenn,
Thanks a lot for the information.
Then i should sort the table first before going to the SEARCH ALL. Right ?
Meanwhile which is the best way to SORT internal tables ? _________________ Rasprasad S |
|
Back to top |
|
|
CaptBill Beginner
Joined: 02 Dec 2002 Posts: 100 Topics: 2 Location: Pasadena, California, USA
|
Posted: Tue Jun 10, 2003 3:08 pm Post subject: |
|
|
You are responsible for ensuring that the data in the table is in either ascending or descending order, so yes you must sort it before loading the table.
Personally I would have a step prior to running the program which sorts the table into the desired sequence. DFSORT, SYNCSORT or some other sort tool will do the job. You could also build a routine in the program to sort the table data, but that just adds complexity to the program. |
|
Back to top |
|
|
|
|