View previous topic :: View next topic
|
Author |
Message |
Vamshi Veludandi
New User
Joined: 17 Mar 2009 Posts: 27 Location: Bangalore
|
|
|
|
Hi,
I have a requirement where in I need to remove a particular record when ever it appears twice.
Input
Code: |
AAA
BBB
$$$
$$$
XXX
$$$
ZZZ
|
Output
Code: |
AAA
BBB
$$$
XXX
$$$
ZZZ
|
This should happen only for '$$$' . Other records can have duplicates.
Is it possible to get the job done thru SORT/REXX ?
A code snippet for the same would be very much helpful.[/code] |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can we get a bit of cliarification?
Doui you only have one value for which you want to remove the duplicates, or are there others?
Code: |
In:
$$$
$$$
%%%
%%%
AAA
AAA
$$$
%%%
Out:
$$$
%%%
AAA
AAA
$$$
%%%
|
Or is it just the one value? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You can do it in any programming language - not just rexx. As for Dfsort - I will leave that to the experts. |
|
Back to top |
|
|
Vamshi Veludandi
New User
Joined: 17 Mar 2009 Posts: 27 Location: Bangalore
|
|
|
|
Hi,
Its only one value '$$$' for which we need to remove the duplicates. Other duplicates like 'AAA' should remain intact.
Thanks
Vamshi. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Vamshi Veludandi,
You can use a DFSORT job like the following:
Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAA
BBB
$$$
$$$
XXX
$$$
ZZZ
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(81:SEQ=8))
OUTFIL OMIT=(1,3,CH,EQ,C'$$$',AND,81,8,ZD,GT,1),BUILD=(1,80)
/* |
OUTPUT
Code: |
AAA
BBB
$$$
XXX
$$$
ZZZ |
Thanks, |
|
Back to top |
|
|
|