IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT trick needed


IBM Mainframe Forums -> SYNCSORT
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
bshkris

New User


Joined: 21 Mar 2005
Posts: 41
Location: pune

PostPosted: Tue May 02, 2017 4:35 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue May 02, 2017 8:59 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue May 02, 2017 10:42 pm
Reply with quote

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
View user's profile Send private message
bshkris

New User


Joined: 21 Mar 2005
Posts: 41
Location: pune

PostPosted: Thu May 04, 2017 9:14 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 05, 2017 1:42 am
Reply with quote

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
View user's profile Send private message
bshkris

New User


Joined: 21 Mar 2005
Posts: 41
Location: pune

PostPosted: Sat May 06, 2017 1:25 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat May 06, 2017 1:30 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
Search our Forums:

Back to Top