Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
write the last occurance of a record in file .

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
abhi.5873

New User


Joined: 28 Jan 2013
Posts: 8
Location: India

PostPosted: Fri Mar 22, 2013 1:20 pm    Post subject: write the last occurance of a record in file .
Reply with quote

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
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Fri Mar 22, 2013 1:24 pm    Post subject: Reply to: write the last occurance of a record in file .
Reply with quote

You want it in Cobol? First sort the file, whilst that is happening, write and test the code.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10495
Location: italy

PostPosted: Fri Mar 22, 2013 1:29 pm    Post subject: Reply to: write the last occurance of a record in file .
Reply with quote

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
View user's profile Send private message
abhi.5873

New User


Joined: 28 Jan 2013
Posts: 8
Location: India

PostPosted: Fri Mar 22, 2013 2:12 pm    Post subject: Reply to: write the last occurance of a record in file .
Reply with quote

Thanks enrico-sorichetti : icon_smile.gif
It is working
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Splitting one record in a file to 10 ... mf_123 DFSORT/ICETOOL 5 Tue Aug 21, 2018 8:51 pm
No new posts CLOB Column data to External File usi... lalitmehta12 DB2 5 Tue Aug 21, 2018 7:22 pm
No new posts Join 2 File using a Join Key scorp_rahul23 DFSORT/ICETOOL 6 Tue Aug 14, 2018 7:36 am
No new posts JCL to send email along with formated... wik123 JCL & VSAM 5 Thu Aug 09, 2018 9:48 am
No new posts How can we create a flat file in JAVA... jasorn Java & MQSeries 2 Wed Aug 08, 2018 3:08 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us