Have a sequential file
Columns:
EMP_ID EMP_SAL EMP_DATE
1 100 01/01/2009
4 200 01/01/2005
2 300 01/01/2011
2 400 01/01/2009
1 100 01/01/2010
3 200 01/01/2009
4 100 01/01/2007
3 300 01/01/2006
.
.
.
Output should contain the the emp_ID who has the latest date
Logic to get the ID with last date
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Sort by date and capture the last row (sort and tail commands).
Sort by date in descending order and capture the first row (sort and head commands).
Because this is a parallel job, you do have MKS Toolkit installed and can therefore use UNIX commands such as sort, tail and head.
Sort by date in descending order and capture the first row (sort and head commands).
Because this is a parallel job, you do have MKS Toolkit installed and can therefore use UNIX commands such as sort, tail and head.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 148
- Joined: Thu Apr 10, 2008 12:47 am
The input sequential file contains same emp_id but can have different date. The output should have single row containing emp_id, sal , date which is latest.
Looking at the example it should have output dataset as:
EMP_ID EMP_SAL EMP_DATE
1 100 01/01/2010
2 300 01/01/2011
3 200 01/01/2009
4 100 01/01/2007
Looking at the example it should have output dataset as:
EMP_ID EMP_SAL EMP_DATE
1 100 01/01/2010
2 300 01/01/2011
3 200 01/01/2009
4 100 01/01/2007
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: