Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete duplicate records

Status
Not open for further replies.

Newbie2u

MIS
Joined
Apr 13, 2003
Messages
5
Location
US
Have a huge file that with record length around 366.
One field colume 1-20 has the name of a ticket in it. If the name of the ticket appears more than once in the file I want to delete all occurances but one. I know this seems fairly easy but I cannot seem to get anything to work. Can someone point me in the right direction. Thank you so much.
 
Hello Newbie2u,

You can just use a SORT jcl like :

//*
//*===================================================================
//*
//* EXCLUDE DOUBLES IN CONTROL FILE.
//*
//*===================================================================
//SORT EXEC PGM=SORT
//SORTIN DD DSN=Your.File.IN,DISP=OLD
//SORTOUT DD DSN=Your.File.OUT,UNIT=DISK,VOL=SER=XXXXXX,
// SPACE=(CYL,(150,200),RLSE),DISP=(NEW,CATLG),
// DCB=(LRECL=10004,BLKSIZE=20000,RECFM=VB)
//SORTWK01 DD UNIT=3390,SPACE=(CYL,(500,50)),VOL=SER=XXXXXX
//SORTWK02 DD UNIT=3390,SPACE=(CYL,(500,50)),VOL=SER=XXXXXX
//SYSOUT DD SYSOUT=*
//STATOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,20,CH,A),EQUALS
RECORD TYPE=VB,LENGTH=10004
SUM FIELDS=NONE
/*

Regards,

Tzu.
 
If you wanted a simple REXX solution you could try putting the value into a STEM and then checking for the existance of the stem. For example (assuming LINES. is your input);

NewCnt = 0
drop DONE. NEWLINE.
do I = 1 to LINES.0
ticket = left(LINES.I, 20)
if Value('DONE.'ticket) == 1 then iterate I
DONE.ticket = 1
NewCnt = NewCnt + 1
NEWLINE.NewCnt = LINES.I
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top