|
View previous topic :: View next topic
|
| Author |
Message |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Hello,
Is there any way to remove the duplicates fully(both records) using SORT?
Example:
Input File:
31267892017-01-01
31267892017-01-11
31354322017-04-03
11245622017-03-03
11245622017-03-03
The Expected output file:
31354322017-04-03
11245622017-03-03
I was able to get each unique record by using XSUM, but not able to remove the 1st 2 records totally.
If any idea please suggest. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| Is there any way to remove the duplicates fully(both records) using SORT? |
Yes. Take a look at the ICETOOL - SELECT operator. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
1.First two records are not duplicate. So why are they missing in output?
2."11245622017-03-03" is a duplicate so why is that even present in the output when you said you don't want duplicates at all?
3. Please do some research next time as this is being very common problem discussed several times on this forum.
4. SELECT with NODUPS. |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Thank you. I got it thru ICE TOOL.
Actaully The business requirement came like.
| Code: |
31267892017-01-01
31267892017-01-11
31354322017-04-03
11245622017-03-03
11245622017-03-03 |
If 1st part of key, 3126789 is same as next record, but dates are different..exclude both records from process. if dates are also same..then include only one record from that.
Below was my solution.
in 1st step I used below SORT
| Code: |
SORT FIELDS=(01,4,CH,A, /* COMP NO
05,09,CH,A, /* COMP NO
14,10,CH,D) /* DATE
SUM FIELDS=NONE,XSUM |
In JCL:
| Code: |
SORTOUT DD DSN=PMIT.SBDOM.PMIDJ297.SORT1,
DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(100,10),RLSE),
DCB=(RECFM=FB,LRECL=80)
SORTXSUM DD DSN=PMIT.SBDOM.PMIDJ297.INDUPS,
DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(100,10),RLSE),
DCB=(RECFM=FB,LRECL=80) |
2nd Step:
| Code: |
PSD29715 EXEC PGM=ICETOOL
TOOLMSG DD SYSOUT=*
DFSMSG DD SYSOUT=*
SYSOUT DD SYSOUT=*
SYSPRINT DD SYSOUT=*
IN DD DSN=PMIT.SBDOM.PMIDJ297.SORT1,DISP=SHR
OUTNOD DD DSN=&SORTFILE,DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(100,10),RLSE),
DCB=(RECFM=FB,LRECL=80)
OUTDUP DD DSN=PMIT.SBDOM.PMIDJ297.INDUPS2,DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(100,10),RLSE),
DCB=(RECFM=FB,LRECL=80)
TOOLIN DD
SELECT FROM(IN) TO(OUTNOD) ON(01,13,CH) NODUPS
SELECT FROM(IN) TO(OUTDUP) ON(01,13,CH) ALLDUPS
//*
|
Then My SORTFILE have only desired records.
Code'd |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
bshkris,
Thanks for posting your solution. But the sort positions in the control cards does not seem to correspond to the sample data posted earlier? - the key seemed to be of length=7, but your control cards use a 13 byte key (COMP NO).
Looks like you have Syncsort, AFAIK DFSORT does not support the XSUM parameter. Topic will be moved to the correct forum. |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
I have another block with SORT.
I need to append the message to my input record. The out file have 250 bytes length.
Now, I want add( I/p rec + message).
I have my SORT card as below.
SORT FIELDS=COPY
OUTREC FIELDS=(1,23,1Z,
C'- 2 OR MORE SCHD DRILL RECORDS FOR THE SAME CCT NO, CPY NO WERE',
C'RECEIVED WITH THE SAME DRILL DATE ONCE REC WAS ACCEPTED.')
END
But the above one is syntax issue.
Please throw some ideas how we can add the multiple line messages to a record using SORT.
Thanks. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
For a new problem start a new thread. And use the code tags or we won't know where to start. And cut and paste your sysout - using the code tags.
This topic is being locked. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|