Posted: Mon Oct 05, 2009 10:18 am Post subject: Sort comma dlmtd fl & only last record per key in O/P
Hi, I have a comma delimited file. The layout of the file is:
(The key columns have an asterisk)
Code:
*TACTIC EVNT ID CHAR 20 X(20)
*TACTIC EVNT ID TYP CD Numeric 5
*TACTIC EVNT SRVC ID Numeric 5
*TACTIC ID CHAR 50 X(50)
*STRTGY SRC CD CHAR 2 X(2)
*TRGT TYP CD CHAR 3 X(3)
SUPRS_CD_1 Numeric 3 9(3)
SUPRS_DT_1 Date 8 YYYYMMDD
SUPRS_CD_2 Numeric 3 9(3)
SUPRS_DT_2 Date 8 YYYYMMDD
SUPRS_CD_3 Numeric 3 9(3)
SUPRS_DT_3 Date 8 YYYYMMDD
SUPRS_CD_4 Numeric 3 9(3)
SUPRS_DT_4 Date 8 YYYYMMDD
SUPRS_CD_5 Numeric 3 9(3)
SUPRS_DT_5 Date 8 YYYYMMDD
SUPRS_CD_6 Numeric 3 9(3)
SUPRS_DT_6 Date 8 YYYYMMDD
Timestamp Timestamp 19 YYYY-MM-DD HH:MM:SS
I need to create an output file such that it has only the latest record for each key value.
Thus I need to sort the file by the key fields and the timestamp field. In order to be able to SORT I have to fiest convert the file to a positional one. Then I want to use only the LAST record for each key in order to get the latest record.
With the above statements I am able to convert the file to a positional oen and then SORT it. But is there a way by which I can have only the LAST record for wach key in the output file. Or do I need to create another step to do it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum