Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort by date in specified date format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort by date in specified date format
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Apr 12, 2008 2:44 am    Post subject:
Reply with quote

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

http://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    Post subject: Reply to: Sort by date in specified date format
Reply with quote

Thanks Frank
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jul 29, 2008 11:34 pm    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us