View previous topic :: View next topic
|
Author |
Message |
abhi.5873
New User
Joined: 28 Jan 2013 Posts: 8 Location: India
|
|
|
|
Hi
I have requirement like
File contains
abc 002
bcd 001
cde 004
abc 003
xyz 008
output
abc 003
bcd 001
cde 004
xyz 008
My intenion is to copy all the records in the file and for the duplicates i want the last record of the duplicate occurance record. here the key is first three letters. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You want it in Cobol? First sort the file, whilst that is happening, write and test the code. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
why not use <sort>/<icetool> ...
something along the lines of
Code: |
****** ***************************** Top of Data ******************************
...
000004 //ICE EXEC PGM=ICETOOL
000005 //TOOLMSG DD SYSOUT=*
000006 //DFSMSG DD SYSOUT=*
000007 //IN DD *
000008 ABC 002
000009 BCD 001
000010 CDE 004
000011 ABC 003
000012 XYZ 008
000013 //OUT DD SYSOUT=*
000014 //TOOLIN DD *
000015 SELECT FROM(IN) TO(OUT) ON(1,3,CH) LAST
****** **************************** Bottom of Data **************************** |
to obtain
Code: |
********************************* TOP OF DATA **********************************
ABC 003
BCD 001
CDE 004
XYZ 008
******************************** BOTTOM OF DATA ******************************** |
|
|
Back to top |
|
|
abhi.5873
New User
Joined: 28 Jan 2013 Posts: 8 Location: India
|
|
|
|
Thanks enrico-sorichetti :
It is working |
|
Back to top |
|
|
|