What is the difference between internal and external sort?

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Post Reply
Dino
Registered Member
Posts: 52
Joined: Tue Jun 18, 2013 12:12 am

What is the difference between internal and external sort?

Post by Dino »

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: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between internal and external sor

Post by Robert Sample »

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.
Dino
Registered Member
Posts: 52
Joined: Tue Jun 18, 2013 12:12 am

Re: What is the difference between internal and external sor

Post by Dino »

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: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between internal and external sor

Post by Robert Sample »

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: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: What is the difference between internal and external sor

Post by William Collins »

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: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: What is the difference between internal and external sor

Post by Anuj Dhawan »

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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SyncSort, SyncTool, SyncGener.”