Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to sort and remove the duplicates

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
rajiv rengasamy

New User


Joined: 24 Sep 2008
Posts: 10
Location: Chennai

PostPosted: Wed Jan 20, 2010 9:26 pm    Post subject: Need to sort and remove the duplicates
Reply with quote

Hi All,
i have a file with records,i need to sort and remove the duplicates.I have attached how how the file looks.Can anyone help me the TSO command for Sorting and removing the duplicates.


Regards
Rajiv
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Wed Jan 20, 2010 9:44 pm    Post subject: Reply to: Need to sort and remove the duplicates
Reply with quote

The is no TSO command to SORT a file. There is a SORT command from an ISPF Edit Session. And there is definitely no command to remove duplicates. You'll need to call your SORT program to accomplish this.

If this is something that needs to be done on a regular basis, you might want to consider coding a program (CLIST or REXX) or an ISPF Edit Macro to call the SORT.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jan 20, 2010 9:53 pm    Post subject: Re: Need to sort and remove the duplicates
Reply with quote

rajiv rengasamy wrote:
Hi All,
i have a file with records,i need to sort and remove the duplicates.I have attached how how the file looks.

Please DO NOT use attachments as not everyone is permitted to open them.

By doing so, you reduce the number of people able to help you, so will probably take longer to get a useful reply.

I for one tend to ignore posts with attachments anyway, because if you can not be bothered to either type it in or cut and paste the informastion ............

FWIW - you forgot to attache the attachment.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Wed Jan 20, 2010 10:14 pm    Post subject: Reply to: Need to sort and remove the duplicates
Reply with quote

Quote:
FWIW - you forgot to attache the attachment.
aka an ...
unattached attachment

interesting oxymoron icon_wink.gif
Back to top
View user's profile Send private message
Josh Keller

New User


Joined: 08 Oct 2007
Posts: 36
Location: Columbia, SC

PostPosted: Thu Jan 21, 2010 3:09 am    Post subject:
Reply with quote

Here's a DEDUP edit macro I created a while back.
You can specify the columns to look in when deduping.



Code:
/* REXX DEDUP            */
/*******************************************************************
 * JOSH KELLER
 *
 *
 * REMOVE DUPLICATE LINES FROM A MEMBER
 *
 * USAGE: DEDUP <COL FROM> <COL TO>
 *        ENTER ON THE PRIMARY LINE DURING AN EDIT SESSION.
 *******************************************************************/
"ISREDIT MACRO (ARGS)"
"ISPEXEC CONTROL ERRORS RETURN"
"ISREDIT (MAXLINES) = LINENUM .ZLAST"
PARSE VALUE ARGS WITH COL1 COL2
IF LENGTH(COL1) = 0 THEN COL1 = 1
IF LENGTH(COL2) = 0 THEN COL2 = 80
IF LENGTH(COL2) = 0 & LENGTH(COL1) > 1 THEN COL2 = COL1

LEN = COL2 - COL1 + 1


STAT = MSG("OFF")
DELCNT = 0
HOLDLINE = ''
"ISREDIT SORT" COL1 COL2
MAXLINES = MAXLINES + 0
DO I = 1 TO MAXLINES
  "ISREDIT (LINETEXT) = LINE" I
  LINETEXT = STRIP(LINETEXT)
  IF SUBSTR(HOLDLINE,COL1,LEN) = SUBSTR(LINETEXT,COL1,LEN) THEN DO
    "ISREDIT DELETE " I
    DELCNT = DELCNT + 1
    IF I >= MAXLINES THEN LEAVE
    I = I - 1
    MAXLINES = MAXLINES - 1
    ITERATE
  END
  HOLDLINE = LINETEXT
END
ZEDSMSG = "DELETED "DELCNT "LINES"
ZEDLMSG = ""
"ISPEXEC SETMSG MSG(ISRZ000)"
[/code][/quote]
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Thu Jan 21, 2010 4:07 am    Post subject:
Reply with quote

Nice work, Josh
Personally, I use Mark Zelden's DELDUPS macro.
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us