Mainframes 360
The one stop destination for System Z professionals

Saturday, April 5, 2014

DFSORT and amazing new data-processing tricks

DFSORT and amazing new data processing tricks

In a perfect world, data columns would be neatly aligned and easy to sort, edit and display. But here, in the real world, data can get unorderly and messy! DFSORT is a high-performance sort, merge, copy and data-processing tool.

Let's establish an input file BOOK.ORDERS, we would like to process in our example.
DFSORT is adept at helping you sort the data. The SORT FIELDS=(p,m,f,s) control statement can sort records by various data columns.
DFSORT can filter and limit the records in the output. The INCLUDE COND=(column1,operator,column2) and INCLUDE COND=(column1,operator,constant) tests allow certain records to be kept. In contrast, the OMIT COND statement deletes records.

Select the orders on computer books:
Select the orders with costs between $2000 and $3000:
Select the orders that are 90 days and older:
DFSORT can sum records. are added together. SUM FIELDS=(p,m,f) will treat records with the same sort or merge keys as one whole and add them up.

Total order costs breakup by subject-area:
DFSORT can reformat records. Reformat is possible at pre- and post- processing stages through INREC and OUTREC FIELDS respectively. INREC and OUTREC build the records item by item.

Report containing book-title, followed by a space and then order-cost in $Z,ZZ9.99 format:
Did you know that DFSORT has many new tricks up its sleeve to perform these feats and much more.
  • Overlay specific parts of records
  • Parse delimited fields
  • Justify data
  • Test for numeric data
  • Handle numeric values that have separators and decimal points
  • Conversion to another format
  • Reformat different records in different ways
  • Add sequence numbers
In this article, I will share some of my favourite DFSORT tricks.

Abracadabra! Overlay specific fields

OVERLAY is a new parameter that can be used on INREC, OUTREC and OUTFIL statements to change data in specific columns, without affecting the rest of the record. OVERLAY can also be used add fields at the end of the record. With OVERLAY, you can concentrate on just the fields on interest without building the entire record item-by-item.

Earlier overlays can be seen by later overlays. A single OUTREC OVERLAY can be extremely powerful!

To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.