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

Remove Duplicates and update the count in trailer record.


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Tue Apr 09, 2013 12:18 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Apr 09, 2013 12:19 pm
Reply with quote

search the forum, the question has been asked and the solution has been given quite a few times.
Back to top
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Tue Apr 09, 2013 2:49 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 3:04 pm
Reply with quote

And did you try any of the DFSORT examples?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Apr 09, 2013 3:07 pm
Reply with quote

Quote:
Hi Enricco,


please learn to not misspell people's names

My name is Enrico, not Enricco
Back to top
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Tue Apr 09, 2013 3:37 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 3:45 pm
Reply with quote

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
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Tue Apr 09, 2013 3:52 pm
Reply with quote

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
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Tue Apr 09, 2013 4:41 pm
Reply with quote

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
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Tue Apr 09, 2013 4:56 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 5:02 pm
Reply with quote

Use EDIT.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Tue Apr 09, 2013 5:22 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 5:24 pm
Reply with quote

Also your header will no longer be the first record.
Back to top
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Tue Apr 09, 2013 5:40 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 6:36 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Apr 09, 2013 7:54 pm
Reply with quote

Bill Woodger wrote:
Aren't you Raj?
After a day full of stress, this is a good read. icon_smile.gif
Back to top
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Wed Apr 10, 2013 11:05 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 10, 2013 11:17 am
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top