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

Sort on different fields, removing duplicates on diff fields


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
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
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
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

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Apr 16, 2020 8:12 pm
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
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
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
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

Global Moderator


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

PostPosted: Sun Apr 19, 2020 6:50 am
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
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

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Mon Apr 20, 2020 8:10 pm
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 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