OPTION DYNALLOC tells DFSORT that it may dynamically allocate sortwork datasets—temporary work files used during the sort or merge. Instead of you coding SORTWK01, SORTWK02, … in JCL, DFSORT asks the system (MVS) to create and allocate work datasets as needed. That is useful when the amount of work space is variable or when you want to avoid maintaining a long list of SORTWK DD statements. This page explains what DYNALLOC does, when to use it, how it interacts with SORTWK and FILSZ, and typical syntax.
During a sort or merge, DFSORT needs work space—temporary datasets—to hold data between phases. You can supply that space by defining SORTWK01, SORTWK02, … in your JCL. Alternatively, if your installation allows it, DFSORT can request that the system create and allocate those datasets at run time. That run-time creation is called dynamic allocation. OPTION DYNALLOC enables this: DFSORT may allocate additional work datasets (or, depending on installation, use only dynamically allocated work) instead of relying solely on the SORTWK DDs you provide.
The trade-off is that you give up explicit control over where the work datasets go (volume, storage group). Some shops require sortwork on specific devices; in those cases they use explicit SORTWK DDs instead of or in addition to DYNALLOC.
You code OPTION DYNALLOC in SYSIN. Exact syntax can vary by DFSORT version and installation. Common forms:
12OPTION DYNALLOC,FILSZ=E5000000 SORT FIELDS=(1,80,CH,A)
Providing FILSZ along with DYNALLOC helps DFSORT decide how much space to request; without a good estimate, it may under-allocate (risk of ICE046A, ICE083A, SB37-04) or over-allocate. See the FILSZ estimation tutorial for details.
| Aspect | DYNALLOC | Explicit SORTWK DDs |
|---|---|---|
| Who allocates | DFSORT requests; system allocates at run time | You define SORTWK01, SORTWK02, … in JCL |
| Control over location | Usually system default volumes/storage | You choose volume, unit, storage group |
| JCL maintenance | Minimal; no SORTWK DDs needed | Must size and maintain SORTWKnn |
| When size varies | DFSORT can request more or less via FILSZ | Must size for worst case or use many DDs |
If you code both SORTWK DDs and OPTION DYNALLOC, behavior depends on your installation. Some installations use a option such as DYNAUTO=IGNWKDD: in that case, DFSORT may ignore your SORTWK DDs and use only dynamically allocated work. Others may use your SORTWK datasets first and then allocate more dynamically if needed. Check your site’s DFSORT installation guide to see how SORTWK and DYNALLOC interact so you can design JCL and options correctly.
DFSORT’s shipped default for the number of dynamically allocated work datasets is often a small number (e.g. 4). For large sorts, that may not be enough; you may need to specify a larger number via DYNALLOC=(,n) or equivalent, or provide explicit SORTWK DDs. Your installation may have overridden the default; refer to local documentation or your systems programmer.
FILSZ gives DFSORT an estimate of input (or total) size so it can plan how much sortwork to request. With DYNALLOC, a good FILSZ is important so that the dynamically allocated datasets are sufficient. SIZE (or MOSIZE) controls how much memory DFSORT uses; that can affect how much data is kept in memory versus written to sortwork, and thus how many work datasets are needed. So for reliable DYNALLOC behavior, combine it with a realistic FILSZ and appropriate SIZE when tuning.
JOINKEYS steps run internal sort/merge tasks that also need sortwork. DYNALLOC and size-related options may need to be specified in the control DD used by the join (e.g. JNF1CNTL), not only in the main SYSIN, depending on your DFSORT release. See the JOINKEYS performance tuning tutorial and your product documentation for where to specify DYNALLOC and FILSZ in JOINKEYS.
When you sort cards, you need extra tables to put piles on. You can either bring your own tables (SORTWK in JCL) or tell the teacher “get me as many tables as I need” (DYNALLOC). DYNALLOC means the teacher gets the tables for you when you need them, so you don’t have to bring a fixed number. You still have to say roughly how many cards you have (FILSZ) so they bring enough tables!
1. What does OPTION DYNALLOC do in DFSORT?
2. When might you prefer DYNALLOC over coding SORTWK DDs in JCL?
3. Can you use both SORTWK DDs and DYNALLOC together?
4. What can influence how much space DYNALLOC allocates?
5. Why might a shop still use explicit SORTWK DDs instead of DYNALLOC?