MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Internal Tables - Clarification

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Mon Jun 09, 2003 11:27 pm    Post subject: Internal Tables - Clarification Reply with quote

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
View user's profile Send private message
Glenn
Beginner


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Tue Jun 10, 2003 12:04 am    Post subject: Reply with quote

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
View user's profile Send private message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Tue Jun 10, 2003 12:31 am    Post subject: Reply with quote

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
View user's profile Send private message
CaptBill
Beginner


Joined: 02 Dec 2002
Posts: 100
Topics: 2
Location: Pasadena, California, USA

PostPosted: Tue Jun 10, 2003 3:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group