View previous topic :: View next topic
|
Author |
Message |
aneeta
New User
Joined: 08 Dec 2005 Posts: 48 Location: Chennai
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Will this yield only the "latest" for each "type"? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|