Here's a DFSORT job that will do what you asked for. I assumed the maximum length of a field is 20, but you can change the job accordingly for the correct maximum length.
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB)
//SORTOUT DD DSN=... output file (FB)
//SYSIN DD *
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:http://www.ibm.com/servers/storage/supp ... tmpub.html