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

Need to sort and remove the duplicates


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajiv rengasamy

New User


Joined: 24 Sep 2008
Posts: 26
Location: Chennai

PostPosted: Wed Jan 20, 2010 9:26 pm
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

Global Moderator


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

PostPosted: Wed Jan 20, 2010 9:44 pm
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: 8797
Location: Welsh Wales

PostPosted: Wed Jan 20, 2010 9:53 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 20, 2010 10:14 pm
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
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: 1353
Location: Israel

PostPosted: Thu Jan 21, 2010 4:07 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
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
Search our Forums:

Back to Top