|
|
| Author |
Message |
priyamnavada
Active User
Joined: 24 Dec 2005 Posts: 57 Location: hyderabad
|
|
|
|
I have a input data as shown below,
142|000001
412|000001
313|000001
142|000001
142|000001
142|000001
I want ouput as shown below,
142|000004
412|000001
313|000001
Please help me in doing so using sort.
Regards,
Priya. |
|
| Back to top |
|
 |
References
|
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1132 Location: Mumbai - India
|
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1132 Location: Mumbai - India
|
|
|
|
Priya,
use this JCL
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
142|000001
412|000001
313|000001
142|000001
142|000001
142|000001
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,3,
TRAILER3=(1,4,5:COUNT=(M11,LENGTH=6)))
/* |
Output:
| Code: |
142|000004
313|000001
412|000001 |
Please note that i have sorted the output based on the first 3 bytes inorder to make SECTIONS work.
The order of records in the output is different from what you have posted.Let me know if this order is OK. |
|
| Back to top |
|
 |
priyamnavada
Active User
Joined: 24 Dec 2005 Posts: 57 Location: hyderabad
|
|
|
|
Hi Aaru,
Thanks a lot. It really worked.
It would be great if you let me know the significance of each commands.
Regards,
Priya. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4574 Location: San Jose, CA
|
|
|
|
Priya,
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:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1132 Location: Mumbai - India
|
|
|
|
Priya,
| Quote: |
| Thanks a lot. It really worked. |
You are welc me.
| Quote: |
It would be great if you let me know the significance of each commands.
|
As Frank suggested, read the manual as all these commands are explained very well.
| Code: |
| SORT FIELDS=(1,3,CH,A) |
First the input records are sorted based on the first 3 bytes.The SORT statement sorts on the first 3 bytes to bring all of the records for each value together, so only one section is produced for each value.
| Code: |
| OUTFIL REMOVECC,NODETAIL, |
From the manuals for REMOVECC
| Quote: |
| REMOVECC tells DFSORT to remove the carriage control character from the first byte of each record. As a result, the data starts in column 1 of the report rather than in column 2. |
NODETAIL
| Quote: |
| NODETAIL tells DFSORT to process the data records in the usual way, but not to write them to the report data set. |
SECTION parameter is used to divide the output into sections by the first 3 bytes. 1,3 tells DFSORT to start a new section every time the value in columns 1-3 changes.
| Code: |
| TRAILER3=(1,4,5:COUNT=(M11,LENGTH=6))) |
TRAILER3 - Is for section trailers
1,4 - First 4 bytes are written to the output
COUNT - Prints a message containing the count of records in a data set.
M11 - edit mask with the pattern as TTTTTTTTTTTTTTT. This is used as per your reqts.
LENGTH=6 - As you wanted only 6 bytes for the count.
Hope this helps. Post if you still have any query. |
|
| Back to top |
|
 |
|
|
|