View previous topic :: View next topic
|
Author |
Message |
MOHIT KUMAR GUPTA
New User
Joined: 16 Apr 2020 Posts: 6 Location: India
|
|
|
|
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 |
|
 |
MOHIT KUMAR GUPTA
New User
Joined: 16 Apr 2020 Posts: 6 Location: India
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
While code tags for your code are not provided, nobody at this forum is going even to read your topic. |
|
Back to top |
|
 |
MOHIT KUMAR GUPTA
New User
Joined: 16 Apr 2020 Posts: 6 Location: India
|
|
|
|
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 |
|
 |
MOHIT KUMAR GUPTA
New User
Joined: 16 Apr 2020 Posts: 6 Location: India
|
|
|
|
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 |
|
 |
MOHIT KUMAR GUPTA
New User
Joined: 16 Apr 2020 Posts: 6 Location: India
|
|
|
|
Any other way to achieve this ?? My way is failing in one of the condition. |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3087 Location: NYC,USA
|
|
|
|
ICETOOL SELECT ? |
|
Back to top |
|
 |
MOHIT KUMAR GUPTA
New User
Joined: 16 Apr 2020 Posts: 6 Location: India
|
|
|
|
Rohit Umarjikar wrote: |
ICETOOL SELECT ? |
If possible could you please share the example for this.. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2217 Location: USA
|
|
|
|
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 |
|
 |
|
|