MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting records to get the most recent record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Piscesian
Beginner


Joined: 17 Dec 2004
Posts: 14
Topics: 8
Location: Monrovia,California

PostPosted: Sat Jul 02, 2005 1:35 am    Post subject: Sorting records to get the most recent record Reply with quote

Hi,
My requirement is to get the last updated event from the input file.
I/p file structure:
Code:

A1-1      A2-8                      A3-37       A4-48
333507 2005-06-29-21.05.54          HALFWRKD   2005-06-29-20.58.37.35
333507 2005-06-29-21.05.54          IASLFTCD   2005-06-29-20.58.37.35
333507 2005-06-29-21.15.53          HALFWRKD   2005-06-29-20.58.37.35
333507 2005-06-29-21.15.53          IASLFTCD   2005-06-29-20.58.37.35
333508 2005-06-29-21.30.15          IDRDTL     2005-06-29-20.59.37.31
333508 2005-06-29-21.40.15          IDRDTL     2005-06-29-20.59.37.31



O/P file required:

Code:

333507 2005-06-29-21.15.53          HALFWRKD   2005-06-29-20.58.37.35
333507 2005-06-29-21.15.53          IASLFTCD   2005-06-29-20.58.37.35
333508 2005-06-29-21.40.15          IDRDTL     2005-06-29-20.59.37.31


In the above example, the event HALFWRKD occured last at the time 2005-06-29-21.15.53 (Field A2)
Ditto for rest of the events IASLFTCD and IDRDTL.
Can this be achieved using DFSORT in a single pass?
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Jul 02, 2005 10:18 am    Post subject: Reply with quote

You can use the following DFSORT/ICETOOL job to do this in one pass:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
  SELECT FROM(IN) TO(OUT) ON(37,8,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(37,8,CH,A,8,19,CH,D)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Piscesian
Beginner


Joined: 17 Dec 2004
Posts: 14
Topics: 8
Location: Monrovia,California

PostPosted: Tue Jul 05, 2005 8:37 pm    Post subject: Reply with quote

Frank,
Thanks a lot for your solution.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group