What is the difference between internal and external sort?

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Previous topicNext topic

Topic Author
Dino
Registered Member
Posts: 33
Joined: Tue Jun 18, 2013 12:12 am
Zodiac: Sagittarius

What is the difference between internal and external sort?

Post by Dino » Wed Apr 02, 2014 4:26 pm

Hello,

Can anybody tell what's the difference between internal and external sort and when to use which one?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1379
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: What is the difference between internal and external sor

Post by Robert Sample » Wed Apr 02, 2014 5:26 pm

Internal sort is invoked within a program while an external sort invokes the SORT program directly (through JCL, for example). Follow site standards as to which to use -- internal sort uses more resources (language overhead) but is used fairly often for convenience.




Topic Author
Dino
Registered Member
Posts: 33
Joined: Tue Jun 18, 2013 12:12 am
Zodiac: Sagittarius

Re: What is the difference between internal and external sor

Post by Dino » Mon Apr 21, 2014 4:48 pm

That means if I call the SORT from COBOL program it's "internal sort" and while in JCL PGM=SORT is "external SORT", right? Are there any difference in them that way, I mean can I call one SORT program in internal and another SORT in external? And why the name "internal/external"?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1379
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: What is the difference between internal and external sor

Post by Robert Sample » Mon Apr 21, 2014 7:30 pm

The same SORT program is invoked for internal and external sorts -- COBOL merely links to the system SORT program when you perform an internal sort. There is slightly more overhead to internal sorts due to the language processing involved, but these days it would be unusual to see any differences unless you are doing a very small sort, or you look at the SMF data to get CPU time to the millionths of a second. The internal and external are in reference to the program -- inside the program (SORT verb) or outside (JCL SORT).




William Collins
Global Moderator
Global Moderator
Posts: 499
Joined: Sun Aug 25, 2013 7:24 pm

Re: What is the difference between internal and external sor

Post by William Collins » Mon Apr 21, 2014 8:06 pm

COBOL has a SORT verb (and a MERGE). It is up to the implementer (IBM in this case) as to how this is implemented.

I don't know if it has been always, but it seems like forever that IBM has implemented it by using the installed SORT product, which makes a lot of sense. I suspect all COBOL implementations do it in an equivalent way (at least to the extent of not implementing compiler code to do the SORT/MERGE).

There are differences between the two as far as performance is concerned. Have a look at compiler option FASTSRT in the Enterprise COBOL manuals. Also consult you SORT documentation. There is a big difference between SORT doing I/O and COBOL doing it. There is also an overhead in transfer of control to/from SORT.



User avatar

Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: What is the difference between internal and external sor

Post by Anuj Dhawan » Mon Apr 21, 2014 8:26 pm

To add to the replies from Robert and William, yes you got this correct:
Dino wrote:That means if I call the SORT from COBOL program it's "internal sort" and while in JCL PGM=SORT is "external SORT", right?
Are there any difference in them that way, I mean can I call one SORT program in internal and another SORT in external? And why the name "internal/external"?
You should note that if you call it internally or externally, the same SORT product will get invoked. It's very rare that you'll find a site where both (or more) SORT products are installed, however, the possibility of having more than one SORT can not be ruled out though - I observed this only at a site where they were migrating from one SORT product to another and kept the one SORT product in a different library to cross check the changes.


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.

Previous topicNext topic

Return to “SyncSort, SyncTool, SyncGener.”