Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT trick needed

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

New User


Joined: 21 Mar 2005
Posts: 29
Location: pune

PostPosted: Tue May 02, 2017 4:35 am    Post subject: SORT trick needed
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: 2284
Location: @my desk

PostPosted: Tue May 02, 2017 8:59 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1736
Location: NY,USA

PostPosted: Tue May 02, 2017 10:42 pm    Post subject:
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: 29
Location: pune

PostPosted: Thu May 04, 2017 9:14 pm    Post subject:
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: 2284
Location: @my desk

PostPosted: Fri May 05, 2017 1:42 am    Post subject:
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: 29
Location: pune

PostPosted: Sat May 06, 2017 1:25 am    Post subject:
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: 1825
Location: UK

PostPosted: Sat May 06, 2017 1:30 am    Post subject:
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.    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us