z/OS message

ICE046A: Sort capacity exceeded

ICE046A means DFSORT ran out of intermediate storage before it could finish the sort. All of its work space, whether disk work data sets or Hiperspace, was full, and the record count in the message shows roughly how far it got.

Other names for this code

Also written as ICE046A SORT CAPACITY EXCEEDED, ICE046A RECORD COUNT, DFSORT ICE046A, sort capacity exceeded, ICE046A SORTWK.

What it means

A sort that doesn't fit in main storage writes partly sorted strings of records to intermediate storage, then merges them. That storage is the sort work data sets (SORTWK01, SORTWK02 and so on, coded in JCL or allocated dynamically) and, where available, Hiperspace. ICE046A means every bit of that space was used up.

The message reads SORT CAPACITY EXCEEDED - RECORD COUNT: n. The count is either an estimate or the number of records DFSORT had read when it ran out. Comparing it with the real input size tells you how far short the work space was.

DFSORT tries hard to avoid this failure. If a work data set allows secondary extents, DFSORT takes them and carries on rather than failing with SB37. ICE046A appears only when no space is left anywhere. DFSORT uses only the first volume of a multi-volume work data set, so extra volumes don't add capacity.

How much work space a sort needs depends on the input size, the main storage it gets, how random the records are, the available Hiperspace, and the values for options such as DYNALLOC, FILSZ, AVGRLEN and DYNSPC. The A suffix marks a critical error, and the step normally ends with return code 16.

Common causes

  • The input grew. A sort that ran for years with fixed SORTWK space fails the day the file passes what that space can hold.
  • DFSORT couldn't work out the input size, for example when records are passed in by a program or an exit. Message ICE118I warns about this, and dynamic allocation is then based on a guess.
  • Work data sets were coded in JCL with small primary space and no secondary space.
  • Main storage was too small. A small region forces more, shorter strings and an intermediate merge (reported by ICE247I), which needs more work space.
  • With variable-length records, the average record length DFSORT assumed was far from the real one.
  • VLSHRT was in effect and the control fields were much longer than the average record, so short records were padded and took far more work space than their real length.

How to find the problem

  1. Note the record count in ICE046A and compare it with the real number of input records. A large gap means the work space was far too small.
  2. Look in the same SYSOUT for ICE118I (unknown file size), ICE254I (dynamic allocation details), ICE247I (intermediate merge) and ICE098I (variable-length record estimates). Each points at a different fix.
  3. Check the SORTWK DD statements in the JCL, if any, and their SPACE values. Check DFSPARM or OPTION statements for DYNALLOC, FILSZ and AVGRLEN settings.
  4. Check the REGION on the job or step, and any MAINSIZE setting.

How to fix it

  • Use dynamic allocation and give it more work data sets, for example OPTION DYNALLOC=(SYSDA,16), instead of fixed SORTWK DD statements.
  • When the input size can't be read, tell DFSORT how many records to expect with OPTION FILSZ=E500000 (an estimate). Use a value close to the real count.
  • If you keep SORTWK DD statements, make them bigger and spread them across more data sets.
  • Increase the REGION or MAINSIZE so that DFSORT builds longer strings and needs less work space.
  • For variable-length input, give a realistic AVGRLEN.
  • With VLSHRT and long control fields, shorten the control fields if possible.

IBM documentation

IBM documentation: ICE046A. Use the documentation for your installed release.

Report a correction to WND Software.

Questions

Why does ICE046A appear when the SORTWK data sets have secondary space?

DFSORT uses secondary extents when they exist, but each work data set can still run out of extents or room on its volume. ICE046A means all of them filled. Add more work data sets or improve the size estimate.

Will adding a second volume to SORTWK01 help?

No. DFSORT uses only the first volume of a multi-volume work data set. Use more work data sets instead.

Is ICE046A the same as an SB37 abend?

Both mean space ran out, but DFSORT handles the B37 condition on its own work data sets itself. When it can't continue, it ends with ICE046A instead of an SB37 abend.