View previous topic :: View next topic
|
Author |
Message |
rajiv rengasamy
New User
Joined: 24 Sep 2008 Posts: 26 Location: Chennai
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
FWIW - you forgot to attache the attachment. |
aka an ...
unattached attachment
interesting oxymoron |
|
Back to top |
|
|
Josh Keller
New User
Joined: 08 Oct 2007 Posts: 36 Location: Columbia, SC
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
Back to top |
|
|
|