umed
New User
Joined: 13 May 2005 Posts: 38
|
|
|
|
Hi ,
I have a file with 3 types of the records
1. Header Record - first char is "H"
2. Trailer Record - First char is "F"
3. Detailed Record - First char is "D"
Detailed record also contains one timestamp field of format
YYYY-MM-DDThh:mm:ss
I want to sort all these detailed records by date-time in descending
order. Output file should contain header and trailer also. Can anyone
help me in this problem.
Example
H,File-Header
D,111,2007-12-12T11:00
D,555,2007-01-05T13:46
D,444,2007-02-05T14:55
D,222,2007-03-07T13:00
F,005
OUTPUT FILE :
H,File-Header
D,111,2007-12-12T11:00
D,222,2007-03-07T13:00
D,444,2007-02-05T14:55
D,555,2007-01-05T13:46
F,005 |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can do this kind of thing quite easily with the new DATASORT operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Here's an example:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(7,16,CH,D)
/*
|
For complete details on the new DATASORT function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|