Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort on different fields, removing duplicates on diff fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
MOHIT KUMAR GUPTA

New User


Joined: 16 Apr 2020
Posts: 6
Location: India

PostPosted: Thu Apr 16, 2020 5:54 pm    Post subject: Sort on different fields, removing duplicates on diff fields
Reply with quote

Hi

Please help me on below job optimization. Where i am trying to combine two syncsort steps in one step.

Step 1: Output file of this step will be input to second step.
Code:
01,CH,A,          **BUY-SELL INDICATOR
             111,08,PD,A,          **ORDER QUANTITY   
             16,10,CH,D)           **BATCH DATE       
OUTREC FIELDS=(1:1,1157,243X)                         
END   


Step 2:
Code:
SORT FIELDS=(59,06,PD,A,           **ACCOUNT NUMBER                   
             52,06,PD,A,           **SECURITY NUMBER                   
             66,10,CH,A,           **TRADE DATE                       
             109,01,CH,A,          **BUY-SELL INDICATOR               
             111,08,PD,A)          **ORDER QUANTITY                   
SUM FIELSORT FIELDS=(59,06,PD,A,           **ACCOUNT NUMBER   
             52,06,PD,A,           **SECURITY NUMBER   
             66,10,CH,A,           **TRADE DATE       
             109,DS=NONE                    **REMOVE DUPLICATE /PICK LATEST REC
END 


In the first step input file is getting sorted on 6 different keys.

In the second step we are removing duplicates with same keys which is used in first step but having only five keys. One key which is not included in this step is "batch date(16,10,CH,D)" So while removing duplicate, most recent batch date records will be picked and rest will be deleted based on the given key in second step.

I searched to get existing case for this type of requirement but failed. So please help me to combine both step in one step if possible.

Note - I have Syncsort/ICETOOL license in my workshop.
Back to top
View user's profile Send private message

MOHIT KUMAR GUPTA

New User


Joined: 16 Apr 2020
Posts: 6
Location: India

PostPosted: Thu Apr 16, 2020 6:26 pm    Post subject:
Reply with quote

For example please assume i need to sort records from 1 to 25 position and remove duplicates based on 1 to 14 position.

Input file :

Step 1 Input file:

Code:
11 Melvin PAID 2020-01-10 
11 Melvin PAID 2020-01-13 
11 Melvin PAID 2020-01-14 
12 Peter   PAID 2020-01-10
12 Peter   PAID 2020-01-09

Output of step 1 as input file in step 2

Code:
11 Melvin PAID 2020-01-14 
11 Melvin PAID 2020-01-13 
11 Melvin PAID 2020-01-10 
12 Melvin PAID 2020-01-14 
12 Peter   PAID 2020-01-10
12 Peter   PAID 2020-01-09

Output of step 2 -

Code:
11 Melvin PAID 2020-01-14 
12 Melvin PAID 2020-01-10
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 802
Location: Maryland

PostPosted: Thu Apr 16, 2020 8:12 pm    Post subject:
Reply with quote

While code tags for your code are not provided, nobody at this forum is going even to read your topic.
Back to top
View user's profile Send private message
MOHIT KUMAR GUPTA

New User


Joined: 16 Apr 2020
Posts: 6
Location: India

PostPosted: Fri Apr 17, 2020 12:33 am    Post subject:
Reply with quote

sergeyken wrote:
While code tags for your code are not provided, nobody at this forum is going even to read your topic.


Thanks Sergeyken. I have updated my query with code tag.
Back to top
View user's profile Send private message
MOHIT KUMAR GUPTA

New User


Joined: 16 Apr 2020
Posts: 6
Location: India

PostPosted: Fri Apr 17, 2020 2:19 am    Post subject:
Reply with quote

I achieved the desired result in one step using below sort card.

Code:

 SORT FIELDS=(59,06,PD,A,           **ACCOUNT NUMBER     
              52,06,PD,A,           **SECURITY NUMBER   
              66,10,CH,A,           **TRADE DATE         
              109,01,CH,A,          **BUY-SELL INDICATOR
              111,08,PD,A,          **ORDER QUANTITY     
              16,10,CH,A)                               
 OUTFIL FNAMES=(SORTOUT),                               
         NODETAIL,REMOVECC,OUTREC=(1400X),               
                SECTIONS=(59,06,                         
                   52,06,                               
                   66,10,                               
                   109,01,                               
                   111,08,TRAILER3=(1,1157))             
 END                                                     
Back to top
View user's profile Send private message
MOHIT KUMAR GUPTA

New User


Joined: 16 Apr 2020
Posts: 6
Location: India

PostPosted: Sat Apr 18, 2020 2:53 am    Post subject:
Reply with quote

Any other way to achieve this ?? My way is failing in one of the condition.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Sun Apr 19, 2020 6:50 am    Post subject:
Reply with quote

ICETOOL SELECT ?
Back to top
View user's profile Send private message
MOHIT KUMAR GUPTA

New User


Joined: 16 Apr 2020
Posts: 6
Location: India

PostPosted: Mon Apr 20, 2020 10:33 am    Post subject:
Reply with quote

Rohit Umarjikar wrote:
ICETOOL SELECT ?


If possible could you please share the example for this..
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 802
Location: Maryland

PostPosted: Mon Apr 20, 2020 8:10 pm    Post subject:
Reply with quote

MOHIT KUMAR GUPTA wrote:
Rohit Umarjikar wrote:
ICETOOL SELECT ?


If possible could you please share the example for this..


http://google.com
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    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 Problem while trying to manipulate re... amitc23 DFSORT/ICETOOL 3 Tue Jun 30, 2020 1:19 pm
No new posts Removing Hyphens and Dots using Syncsort PORYES SYNCSORT 8 Tue Apr 28, 2020 9:52 pm
No new posts Please help - SORT with SUM fields an... clearskynot DFSORT/ICETOOL 6 Thu Apr 09, 2020 11:01 am
No new posts On a team working on a new project fo... zCMHII All Other Mainframe Topics 2 Mon Apr 06, 2020 9:15 pm
No new posts Accumulating fields using syncsort Hemant L SYNCSORT 6 Fri Feb 07, 2020 2:55 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us