IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Get the latest record from the file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Mon Jan 28, 2008 10:28 pm
Reply with quote

Hi,
My input file has the below format.

11111 2008-01-26.42.32.222222 Employee
57676 2008-01-27.35.21.123444 Employee
23455 2008-01-28.56.56.566777 Employee
....
....
....
....
88888 2008-01-25.42.32.222222 Salary
77777 2008-01-26.35.21.123444 Salary
66666 2008-01-27.56.56.566777 Salary
....
....
....

Output file:
23455 2008-01-28.56.56.566777 Employee
66666 2008-01-27.56.56.566777 Salary
...

My requirement is I need the latest record in each category(like Employee,Salary,...)

Thanks
Aneeta
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jan 28, 2008 10:49 pm
Reply with quote

aneetha,

Assuming that you have 26 byte timestamp field (you only show 23 bytes) you can simply sort on that field descending.

Code:

//SYSIN    DD *           
  OPTION EQUALS
  SORT FIELDS=(p,26,CH,D)
/*
p = start position of the time stamp field
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 28, 2008 10:57 pm
Reply with quote

Hello,

Will this yield only the "latest" for each "type"?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 28, 2008 11:05 pm
Reply with quote

Aneeta,

You can use a DFSORT/ICETOOL job like this to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
11111 2008-01-26.42.32.222222 Employee
57676 2008-01-27.35.21.123444 Employee
23455 2008-01-28.56.56.566777 Employee
88888 2008-01-25.42.32.222222 Salary
77777 2008-01-26.35.21.123444 Salary
66666 2008-01-27.56.56.566777 Salary
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(31,10,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(31,10,CH,A,7,23,CH,D)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top