Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for. I assumed your "key" was in positions 1-10 and your input file has RECFM=FB and LRECL=80. You can change the job appropriately for other keys and attributes.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
aaa
xxx
navneet
aaa
qqq
rrr
bbb
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Add 'A' for 'navneet' and 'B' for other records.
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'B')),
IFTHEN=(WHEN=(1,7,CH,EQ,C'navneet'),OVERLAY=(81:C'A'))
OPTION EQUALS
* Sort on 'A'/'B' and then name.
SORT FIELDS=(81,1,CH,A,1,10,CH,A)
* Remove 'A'/'B'.
OUTREC BUILD=(1,80)
/*
|
SORTOUT has:
Code: |
navneet
aaa
aaa
bbb
qqq
rrr
xxx
|
Quote: |
Can any one tell me what INREC and OUTREC does with some example and where do we use SORT utility in real time. |
INREC reformats records before they are sorted, merged or copied. OUTREC reformats records after they are sorted, merged or copy.
You can use DFSORT for a wide variety of functions.
The best way for you to answer your own questions is to read 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:
Use [URL] BBCode for External Links |
|