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 

difference between MERGE & SORT

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


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Sun Jul 04, 2004 4:26 am    Post subject: difference between MERGE & SORT Reply with quote

hi all,

We all know that to MERGE datasets we have to have the individual datasets SORTED, then only we can merge them.
Thus MERGE consists of two steps :
1) Sort the individual datasets.
2) Then merge the datastes.

But the whole process of MERGING can be done in one step using SORT only i.e by using following JCL :

//step1 exec pgm=sort
//sysout dd sysout=*
//sortin dd dsn=dataset1,disp=shr
// dd dsn=dataset2,disp=shr
// dd dsn=dataset3,disp=shr
//sortout dd dsn=dataset4,disp=old
//sysin dd *
sort fields=(1,80.ch,a)
/*

That to in the above JCL we don't have the constarint of sorting the merging datasets.

Thus, why & when to use MERGE ,when the merging requirement can be conviniently fulfilled using above SORT JCL.

Plzz put to rest my doubt.

Thanx in advance

P.R.Mohanty
Kanbay
_________________
Priya Ranjan Mohanty
Consultant
Kanbay Software (I) pvt. Ltd.
Hyderabad
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sun Jul 04, 2004 5:54 pm    Post subject: Reply with quote

As you say, sort is a two-part process whether done externally by you or internally by the sort product. Merge is a one-part process.

If the records in the separate files are already in sorted order, then merge is the more efficient choice. As an example, if you have a large master file that's kept in sorted order and a small transaction file that's kept in sorted order, it would be more efficient to merge the two files rather than sort them. If the large master file is already sorted, but the small transaction file is unsorted, it would probably be more efficient to sort the small transaction file and then merge the two files.

If you have unsorted files and need to sort them together, you can either sort them individually and then merge them, or sort them all at once. Which method is more efficient in that case depends on a lot of factors such as file size, file attributes, and available memory, hiperspace, data space, memory objects and/or space work, etc.

If in doubt, try both methods to see which is more efficient in a given instance.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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 -> Utilities 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