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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


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