|
View previous topic :: View next topic
|
| Author |
Message |
srikm
New User
Joined: 19 May 2006 Posts: 4
|
|
|
|
Hi
Iam struck in a production issue
Following is my requirement..
I have data as follows(no,of I/P records.12)
-------------------
99999XXXX0000
99999XXXX0000
99999XXXX0001
99999XXXX0001
99999XXXX0002
99999XXXX0002
99999XXXX0003
99999XXXX0003
99999XXXX0003
99999XXXX0004
99999XXXX0004
99999XXXX0004
-------------------
after JCL Sort it should look like.(no,of O/P records.9)
-------------------
99999XXXX0000
99999XXXX0001
99999XXXX0002
99999XXXX0003
99999XXXX0003
99999XXXX0003
99999XXXX0004
99999XXXX0004
99999XXXX0004
-------------------
I will be very much thankfull if any one can provide a
SELCOPY/JCL SORT example to solve the above issue.......
Thanks
KMSrinivas
09880191795 |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You haven't given enough information for anyone to provide a solution.
The only pattern I see is that you're removing duplicates for the 0000, 0001 and 0002 records, but keeping duplicates for the 0003 and 0004 records. Is that the "rule" you want to use to get from input to output or is it something else? If it's something else, what is it?
Is the "key" all of the bytes or just some of the bytes?
What is the RECFM and LRECL of the input file? |
|
| Back to top |
|
 |
srikm
New User
Joined: 19 May 2006 Posts: 4
|
|
|
|
Thanks for reply
i will explain you clearly
i want to remove duplicates of 0000, 0001 and 0002 records, but keeping duplicates for the 0003 and 0004 .
KEY is
------
99999 0000 =====actual record
0123456789XYZ =====field num
____
^ ^
can be anything
key : 012349XYZ ===field number
RECFM and LRECL : VB and 1067
waiting for your reply.....
Thanks
KMSrinivas |
|
| Back to top |
|
 |
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. It wasn't clear to me what your key was (it would have helped if you'd just given the starting position and length of the key or keys), so I assumed i was just the 4-byte number in positions 14-17. You can change the job appropriately for other keys.
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
* Reformat 0003 and 0004 records to:
* |RDW|seqnum..|data|nnnn|
INREC IFTHEN=(WHEN=(14,4,ZD,GT,+2),
BUILD=(1,4,5:SEQNUM,8,ZD,13:5)),
* Reformat 0001, 0002 and 0003 records to:
* |RDW|00000000|data|nnnn|
IFTHEN=(WHEN=NONE,
BUILD=(1,4,5:C'00000000',13:5))
OPTION EQUALS
* Sort on seqnum and nnnn.
SORT FIELDS=(5,8,ZD,A,22,4,ZD,A)
* Remove duplicates:
* For 0003 and 0004 records, each record has a different
* seqnum so dups are not removed. For 0001, 0002 and 0003
* records, each record has a seqnum of 00000000, so dups
* are removed.
SUM FIELDS=NONE
* Remove seqnum.
OUTREC BUILD=(1,4,5:13)
/*
|
|
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Hi,
I think we can use SORT FIELDS= NONE, to elimanate the duplicate records, then after we should use SKIP REC. i.e where we need to ignore the NONE condition.
I guess it will works.
let me know if iam wrong. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
bshkris,
You mean SUM FIELDS=NONE, not SORT FIELDS=NONE.
See my post above for the solution which does use SUM FIELDS=NONE, but doesn't use SKIPREC. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|