| Q. What does one understand by the phrase – Formatting of Output Records? Why do we need to format them? | |||
| When we generate an Output using DFSORT sometimes, the records are not in a presentable format. For example, in the output records, there might not be a space between two fields. Or you might want to insert a $ sign for the currency field. You might want to re-order the fields, or display only selected fields/columns in the Output. This type of formatting of records can be done using DFSORT. You can format the records to be sorted in a particular way, prior to the sorting. This is also possible. So, for better presentation/easier understanding of the report, we re-format the records produced in Output. For re-formatting of records, there are mainly 3 tools at your disposal - OVERLAY - It allows you to change (edit) the values in specific columns. IFTHEN - Reformats different records in different ways. The above re-formatting tools can be used with INREC, OUTREC and OUTFIL. INREC - Used to reformat the records before applying sort. | |||
| Q. How to generate a Report, which displays only specific(desired) columns in the Output? | |||
|
In the output report, you are asked to display only the name of the Insurance Agent and the Sales Figure. Since, we want reformat records after applying SORT, we will OUTREC FIELDS Control statement.
Note that, we have written SORT FIELDS=COPY, which simply copies the Input Records to the Output, and displays NAME and SALES Columns. Upon submitting the above Batch JOB/JCL, we get the following Output :
A lot more formatting is possible on the above report. Read on to know more... | |||
| Q. What if I wanted the SALES field/column to be displayed before(first) and then the NAME Field/Column? How do you re-order columns in the Output Report? | |||
| If we would like to display the SALES Column first, and then the agent-names, we can simply change the order in OUTREC FIELDS statement. SORT FIELDS=COPY -
| |||
| Q. I’ve understood, how to re-order the columns, but the above output report looks like greek(Cyrilic) – there should be some space between the fields SALES and NAME. How do you insert a SPACE/SPACES? | |||
| SORT FIELDS=COPY -
If you want to fill in blanks in the last field, you use the syntax c:X, where c is the column till where the padding takes place. For example, OUTREC FIELDS=(60,5,2X,10,20,140:X) | |||
| Q. What if I wanted to insert a Character string like ‘IS SALES FOR’ between the two fields? What if I wanted to insert a Date and Timestamp? | |||
| You can insert characters at any position by tying C'<Characters>'.
Upon submitting the above Batch JOB/JCL, we get the following Output Report, with the Date and Time printed :
In the next tutorial, find out how to replace certain characters/fields, eliminate junk characters like LF, changing lower case to upper case and vice versa and much more.. Hope you’ve enjoyed! |
Bulletin Board
|
|
|
- Re-writing of select JCL and VSAM Tutorials is under-way, orientation would be more hands-on, and practical - New Tutorials on COBOL-VSAM programs shall be put up pretty soon - IMS DB/DC Tutorials to start up in April, 2010 |
Thursday, July 30, 2009
Formatting Output Records – DFSORT Tutorial
Subscribe to:
Post Comments (Atom)
Note :
| © Copyright – Quasar Chunawalla, 2010.
Note : The copyrights of all the material, text and pictures posted in this website belong to the author. Any instance of lifting the material from this website, shall be considered as an act of plagiarism. For any clarifications, please mail at quasar.chunawalla@gmail.com |

1 comments:
Really nice sir....keep it up
Post a Comment