Can you please let me know How many work files we need to use for Sorting. On what basis we will decide these many work files we need to use and what is the minimum fields or minimum length we need to use for sorting?
Huh? Where did you get that from? Do you think you need 12 work data sets for sorting 5 records and sorting 500,000 records and sorting 5,000,000 records? That makes absolutely no sense.
As Parikshit correctly stated, the amount of work space needed depends on the amount of data to be sorted. It also depends on the resources available for a particular run. For example, DFSORT can use memory objects, expanded storage or data space when appropriate along with virtual storage, which can reduce the amount of work space needed or even eliminate it entirely. That's why we recommend using DFSORT's dynamic allocation feature instead of specifying SORTWKdd DDs. Dynamic allocation allows DFSORT to adjust the work space it allocates automatically for each particular DFSORT run.