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 

Finding a sorted file

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


Joined: 19 Dec 2005
Posts: 8
Topics: 5

PostPosted: Wed Mar 22, 2006 9:42 am    Post subject: Finding a sorted file Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 22, 2006 11:07 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu Mar 23, 2006 12:55 am    Post subject: Reply with quote

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