View previous topic :: View next topic |
Author |
Message |
rajkumarfit Beginner
Joined: 19 Dec 2005 Posts: 8 Topics: 5
|
Posted: Wed Mar 22, 2006 9:42 am Post subject: Finding a sorted file |
|
|
HI
Can anyone tell me is there a way to check whether a file is sorted or not, so that i can use binary search directly in Cobol..
Rajkumar |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Mar 22, 2006 11:07 am Post subject: |
|
|
rajkumarfit,
No. Why not run a simple SORT step before running the pgm and then load that into a table in that way you don't have to worry about if the file is sorted or not.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Thu Mar 23, 2006 12:55 am Post subject: |
|
|
Unless you program for it, you cannot tell if the file is sorted or not.
Binary search in COBOL will be used on a table (array) whereas, you have a file as input. Are you suggesting that, you will be reading the file into a table? IMHO, this is not a good idea for two reasons. First, the number of records and (an extension of first) the size of COBOL table (array).
You might want to sort the file and load it to VSAM KSDS. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
 |
|
|