ICE251A DFSORT Error: Fix Missing RDW in OUTREC
The ICE251A DFSORT Error is a common issue when processing variable-length (VB) files with DFSORT or ICETOOL. This message usually appears when DFSORT cannot find the expected data because record positions are not calculated correctly for a VB dataset. Understanding how the Record Descriptor Word (RDW) works can help you resolve the problem quickly.
Understanding the Error Message
A typical DFSORT message looks like this:
ICE251A 0 MISSING RDW OR DATA FOR *OUTREC : REASON CODE 03, IFTHEN 0
ICE751I 0 C5-I79519 C6-NONE C7-I76950 C8-I76518 E9-I96983 E7-I76950
ICE052I 3 END OF DFSORT
This is considered a severe DFSORT error and usually causes the sort step to fail.
What Causes This DFSORT Message?
In most cases, the issue occurs when a variable-length file is processed as though it were a fixed-length file.
A VB record contains a 4-byte Record Descriptor Word at the beginning of every record. DFSORT uses this information to determine the actual length of the record.
When field positions are specified without considering these four bytes, DFSORT may attempt to read data from a location that does not exist. As a result, it reports missing data for the OUTREC statement.
Quick Fix for Missing RDW in OUTREC
One of the fastest ways to resolve this issue is to include the RDW when building the output record.
Add (1,4) before the actual data fields in your OUTREC statement.
Example:
//STEP02 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SORTIN DD [email protected],DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY -
INCLUDE COND=(5,1,CH,EQ,C'I') -
OUTREC FIELDS=(1,4,25,10)
/*
In this example:
(1,4)copies the RDW.25,10copies 10 bytes starting at position 25.- The starting position is adjusted to account for the 4-byte RDW.
Although there are several ways to correct the problem, this approach is often the quickest solution.
Understanding VB File Record Positions
When working with variable-length files, remember that the first four bytes belong to the RDW.
DFSORT messages in the spool typically indicate that the actual data starts at position 5.
Suppose your requirement is to extract data beginning at logical position 21. In that case, you must add the RDW offset:
21 + 4 = 25
Therefore, position 25 becomes the correct starting point in the OUTREC statement:
OUTREC FIELDS=(1,4,25,10)
Failing to adjust for the RDW can lead to invalid field references and job failures.
Check DFSORT Messages in the Spool
Before changing your sort statements, review the DFSORT messages generated in the spool output.
These messages often reveal important details such as:
- Record format (VB or FB)
- Dataset characteristics
- Record starting positions
- Additional diagnostic information
This information can help you determine whether the failure is related to incorrect field positioning.
Conclusion
The ICE251A DFSORT Error is often caused by ignoring the 4-byte RDW in a variable-length file. When field positions do not account for the RDW, DFSORT may report missing data and terminate the job.
A simple fix is to include the RDW using (1,4) and adjust subsequent field positions accordingly. Always review the spool messages to confirm the file format and verify the correct starting position before modifying your SORT or OUTREC statements.