difference between internal sort and external sort



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

difference between internal sort and external sort

Postby nithyanandhan » Sat Aug 21, 2010 9:57 pm

can anyone explain me what is the difference between the internal sort and external sort? under wat category the dfsort comes under? i head that in jcl while doing sorting if we didnt specify the workfile the jcl will automatically use the sysout statement as the workfile. how far it is? i need a clear view of internal and external sort with respect to their names? thanks in advance.
nithyanandhan
 
Posts: 3
Joined: Wed Jul 07, 2010 11:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: difference between internal sort and external sort

Postby dick scherrer » Sat Aug 21, 2010 11:28 pm

Hello,

The "name" of the sort excutable has nothing to do with internal versus external sorting.

Internal sorting is done when the sort is invoked from within an application program (say a COBOL program using the SORT statement).

External sorting is done when the sort is invoked directly in the JCL.

i head that in jcl while doing sorting if we didnt specify the workfile the jcl will automatically use the sysout statement as the workfile. how far it is?

You need to read the documentation for the sort product that is being used on your system to learn about "workfiles" and "sysout". You also need to change where you "hear" things - this source is completely off the mark.

How far is what?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: difference between internal sort and external sort

Postby steve-myers » Sun Aug 22, 2010 12:26 am

Mr. scherrer's discussion is good but not quite my definition. As far as I'm concerned, an internal sort is when you use a function like the C library's qsort function. With qsort all of the data is in memory, and no external storage is required. I personally consider the sort function as in the Cobol SORT verb or the PL/I PLISRTx functions that use an external sort product, such as DFSORT or Syncsort as external sorts, though Mr. scherrer regards them as internal sorts.

Back in the early 90s I wrote an Assembler qsort, based on the qsort example in the excellent K & R "The C Programming Language," that used an interface modeled very closely on the C language standard library qsort function. My qsort has served me well for nearly 20 years for internal sorts. In 20 years I did an external sort using the Assembler interface to the external sort just twice, and once was to compare my qsort with external products. My conclusion was I was better than the external products for a few hundred, or even a few thousand items because of the external products start up costs, but once that was overcome they beat my code handily.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: difference between internal sort and external sort

Postby dick scherrer » Sun Aug 22, 2010 12:49 am

Hi Steve,

Probably a good thing to keep in mind is that less than 1% of the people working on business applications on an IBM mainframe are familiar with "qsort". A similar (but a bit larger) group is familiar with a "finger sort" or a "bubble sort" as many were required to write such as part of their training. . . And that may no longer be part of the training.

As you've written 2 assembler executions/invocations of the system sort product you've done 2 more than i have<g>. All of the assembler i've worked with (other than helping students with homework) have been "internals" or other "system" type code and not processors of lots of external data.

Once COBOL took over for business applications, very few places still used assembler to process large amounts of business data - the organizations are unwilling/unable to support a large amount of assembler work.

Oh, btw, "Mr Scherrer" was my Dad's dad . . . ;)

Have a great weekend,

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: difference between internal sort and external sort

Postby steve-myers » Sun Aug 22, 2010 6:16 am

Well, the comment about sort training is all too true. I've done "bubble" sorts in Assembler. They look very elegant; lots of BXH and BXLE instructions, and very few instructions over all. Efficent it's not, but it sure does look pretty. Of couse, most of the readers here will be scratching their heads. BXH? BXLE? What the ???? are they. Even people that have had alleged Assembler training are probably asking that question, which may reflect on the quality of Assembler training and usage. Efficient sorting is actually quite hard; that's why we pay the big bucks for DFSORT or Syncsort.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: difference between internal sort and external sort

Postby Frank Yaeger » Mon Aug 23, 2010 11:20 pm

can anyone explain me what is the difference between the internal sort and external sort? under wat category the dfsort comes under?


From what I've seen, the common definition is that an external sort uses the sort product directly (e.g. PGM=SORT) whereas an internal sort calls the sort product from a program (e.g. COBOL calls DFSORT). But as you can see from the previous posts, that definition is not universally accepted.

DFSORT is a sort utility. It can be called directly or from a program.

This reference might be of help in regard to direct calls to DFSORT vs program calls to DFSORT:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0528173317

i head that in jcl while doing sorting if we didnt specify the workfile the jcl will automatically use the sysout statement as the workfile. how far it is?


No, that's not true. If you don't specify workfiles, DFSORT will use dynamically allocated work files. The SYSOUT DD contains DFSORT messages.

i need a clear view of internal and external sort with respect to their names?


DFSORT can be called directly using PGM=SORT or PGM=ICEMAN. DFSORT can be called from a program using LINK, ATTACH or XCTL with EP=SORT or EP=ICEMAN.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: difference between internal sort and external sort

Postby Michael B » Fri Sep 03, 2010 10:27 am

Internal sort is when an application program calls sort. External sort (AKA 'stand alone sort') is when you call the sort program directly, via JCL. Either may have (but is not required to have) an input routine (to only select certain records, or certain fields of selected records, etc.) and and output routine (to do something with the records after they are sorted, such as print a report). In a COBOL program the input routine is the reserved word 'INPUT PROCEDURE' followed by a SECTION name that performs the procedure. The output routine is the reserved word 'OUTPUT PROCEDURE' followed by a SECTION which prints the report (or what ever it is you want to do). If you don't need an input procedure (i.e. you want every field of every record) use the reserved word USING file-name and likewise if you don't want the output procedure code GIVING file-name. Stand alone sorts may also have input procedures and output procedures if desired. The input procedure is called sort exit 'E15' and is a program you write which will select the records you want (and reformat the fields, if you tell it to) the output procedure is 'E35', which you will write to do whatever you need to after the records are sorted.

A million years ago my mentor told me "One day you'll get a job and your boss will tell you to sort something. Ask him if he wants an internal sort or an external sort. If he says 'internal' but doesn't give a reason, that means he doesn't know how to do external. If he says 'external' but doesn't give a reason, that means he doesn't know how to do internal. If he says one or the other and gives a reason (such as easier to code, will run faster etc.) then he understands both. If he says 'you're the programmer, do it however seems better to you' then you can bet your paycheck that he doesn't understand either of them.
Michael B
 
Posts: 2
Joined: Fri Sep 03, 2010 9:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: difference between internal sort and external sort

Postby nithyanandhan » Mon Sep 13, 2010 11:20 pm

thank you for all who posted reply for this .i am very glad to see this replies. and i am clear about the sort now.
thanku again. :)
nithyanandhan
 
Posts: 3
Joined: Wed Jul 07, 2010 11:37 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post