View previous topic :: View next topic
|
Author |
Message |
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi
Could anyone help on how to achieve the below requirement,
My requirement is to eliminate duplicate recs and update the trailer record count.
Input Data :
HDR~record
ABC~1234
ABC~1224
ABC~1233
ABC~1234
ABC~1233
TRL~00005 -count
I want output as below :
HDR~record
ABC~1234
ABC~1224
ABC~1233
TRL~00003 -count
I want to do this using syncsort as we dont have DFSORT in our shop.
Thanks in Advance,
Raj |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
search the forum, the question has been asked and the solution has been given quite a few times. |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi Enricco,
My bad luck When searched i could find the sample's on DFSORT and not on the SYNCSORT.
Can you provide some links for the same. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And did you try any of the DFSORT examples? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
please learn to not misspell people's names
My name is Enrico, not Enricco |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi Bill,
I want to do this using syncsort as DFSORT will not work in our shop.
Enrico,
My apologies for the misspell. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I understand that, really I do.
However, there are enormous similarities between the products. If you find a DFSORT solution which doesn't use IFTRAIL, why don't you try it? |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Yes Bill, as per the DFSORT smaple's i have seen for Trailer count updation. I understand that IFTRAIL is the only way we have for updating the trailer count.
Correct me if i am wrong. |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Hi Raj,
You want the output in same non-sorted order which you have provided or can it be in sorted order ?
Thanks
-3nadh |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi Trinadh,
I want the records to be sorted and then eliminate the duplicates.
I tried with below sort card,
SORT FIELDS=(01,1500,CH,A)
SUM FIELDS=NONE
OUTFIL REMOVECC,
TRAILER1=(1:'TRL~',COUNT,15:'~~')
but i am getting output like below,
TRL~ 251 ~~
I want O/P like below,
TRL~0000000251~~
Any suggestions please, |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Use EDIT. |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Raj,
In your SORT card, COUNT is including Header and Trailer records...I think without those records it should be 249.
And also your sort card will produce duplicate trailer record.
Thanks
-3nadh |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Also your header will no longer be the first record. |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Yes Raj,
As you said it is counting HDR and TRL record too.
Could anyone please suggest some other solution for this. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Aren't you Raj?
If you OMIT the existing trailer, then you can create a new one in OUTFIL. You should be able to adjust, and edit, the COUNT.
You need to deal with the header. Assuming no design on the file, so it can't be sorted "naturally", you want to add one byte to each record, temporarily. If the header, set it to, say, "3", else set it to, say, "7". Sort on that field first, then the rest of the record. Then drop the extra byte after the SORT, can be in OUTFIL since you have one already.
Are you removing entirely duplicated records? Ensure OPTION NOEQUALS for a little more swiftness. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Bill Woodger wrote: |
Aren't you Raj? |
After a day full of stress, this is a good read. |
|
Back to top |
|
|
rajkumarmf1985
New User
Joined: 09 Aug 2010 Posts: 18 Location: bangalore
|
|
|
|
Hi All,
Thanks for your time and valuable suggestions.
Below sort card is working fine for my requirement.
Code: |
OPTION VLSHRT
OMIT COND=(05,04,CH,EQ,C'TRL~')
SORT FIELDS=(1,1500,CH,A)
SUM FIELDS=NONE
OUTFIL REMOVECC,
TRAILER1=(1:'TRL~',COUNT-1=(M11,LENGTH=10),15:'~~') |
The positions of the header and trailer are not changing because data looks like below in the input file,
Code: |
HDR~XXXXXXX
RMB~XXXXX~AAAA~
RMB~XXXXX~ABCB~
RMB~XXXXX~ABBB~
RMB~XXXXX~AEEE~
RMB~XXXXX~AEDB~
TRL~XXXXXXXXXX~ |
Thanks,
Raj.......
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks for letting us know.
For future reference, please learn how to use the Code tags and use them for anything where spacing needs to be preserved. |
|
Back to top |
|
|
|