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

Sort by date in specified date format


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

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Sat Apr 12, 2008 2:26 am
Reply with quote

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
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: Sat Apr 12, 2008 2:44 am
Reply with quote

You can use the technique discussed in the "Sort records between a header and trailer" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
umed

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Sat Apr 12, 2008 3:02 am
Reply with quote

Thanks Frank
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: Tue Jul 29, 2008 11:34 pm
Reply with quote

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
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top