Ganesh Kalam Warnings : 1 New User
Joined: 11 Aug 2005 Posts: 45 Location: India
|
|
|
|
Hi friends,
I have defined an array in the program like this
01 WS-PENDING-TABLE.
05 WS-PD-ENTRIES OCCURS 1800 TIMES
INDEXED BY PD-IX.
10 WS-PD-ENTRY.
15 WS-PD-PARENT-ITEM PIC X(3).
15 WS-PD-MNSTRUSG.
20 WS-PD-COMP PIC X(3).
20 WS-PD-STRT-EA PIC X(2).
15 WS-PD-MNRELTSG.
20 WS-PD-REL-COMP PIC X(3).
20 WS-PD-REL-STRT-EA PIC X(2).
The array contains the following data
234222XX235YY
234222XX123YY
234222XX123YY
234111XX555YY
234111XX333YY
123999XX234YY
123999XX123YY
123888XX555YY
123888XX333YY
.....
....
....
My requirement is, I have to sort the array first on WS-PD-PARENT-ITEM then on WS-PD-COMP and then on WS-PD-REL-COMP so that the array is in the sorted order as shown below
123888XX333YY
123888XX555YY
123999XX123YY
123999XX234YY
234111XX333YY
234111XX555YY
234222XX123YY
234222XX123YY
234222XX235YY
Also i need to have the sorted data in the same array.
Can you please help me in writing this logic
Thanks in advance |
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you think of the requirement having 3 keys, you make it more difficult. It is your program, so you can define the table so that all of the "key" info is contiguous.
Where are you getting the data to put into this array? If the data is read from an external file, you can sort the array data before reading it in your code and moving it into the array.
For up to 1800 entries, i'd suggest using SEARCH ALL to reduce the cpu cycles needed.
When you've read this and continued with your code, post any questions you have here and someone will be able to help. |
|