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 

Get maximum timestamp from two different colums in to a file

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


Joined: 23 Jun 2006
Posts: 10
Topics: 4
Location: CHENNAI

PostPosted: Wed Oct 04, 2006 9:41 am    Post subject: Get maximum timestamp from two different colums in to a file Reply with quote

My input file looks like this.

2006-02-2616.14.032005-09-2908.31.28
2006-07-1016.00.522006-10-0400.59.18
2005-09-2908.31.282005-05-2908.31.28
2006-08-0122.52.492006-09-0400.59.18

From 1 to 18 positions I have one time stamp and from 19 to 18 positions I have another time stamp.I need the maximum time stamp of all these timestamps in a file.

The out put of the above should be

2006-10-0400.59.18

I have searched the forum but I could not find any solution.Please help me in finding the solution.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Wed Oct 04, 2006 10:20 am    Post subject: Reply with quote

sreenivask,

Try this job.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
2006-02-2616.14.032005-09-2908.31.28                     
2006-07-1016.00.522006-10-0400.59.18                     
2005-09-2908.31.282005-05-2908.31.28                     
2006-08-0122.52.492006-09-0400.59.18                     
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  OUTFIL OUTREC=(01,18,/,                               
                 19,18)                                 
/*                                                       
//STEP0200 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=&T1,DISP=SHR                           
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=(01,18,CH,D)                               
  OUTFIL ENDREC=1                                       
/*



Hope this helps...

Cheers

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Oct 04, 2006 10:32 am    Post subject: Reply with quote

Here's a DFSORT job that will do what you asked for in one copy pass. For each record, it gets the maximum timestamp. Then it gets the maximum of all the maximums.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB)
//SORTOUT DD DSN=...  output file (FB/18)
//SYSIN    DD    *
  OPTION COPY
* If 1,18 > 19,18, keep 1,18
  INREC IFOUTLEN=18,
   IFTHEN=(WHEN=(1,18,CH,GT,19,18,CH),
     BUILD=(1,18)),
* Else keep 19,18
   IFTHEN=(WHEN=NONE,
     BUILD=(19,18))
* Get MAX timestamp.
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(MAX=(1,18,UFF,
      EDIT=(TTTT-TT-TTTT.TT.TT)))
/*

_________________
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
sreenivask
Beginner


Joined: 23 Jun 2006
Posts: 10
Topics: 4
Location: CHENNAI

PostPosted: Thu Oct 05, 2006 12:44 am    Post subject: Reply with quote

Thanks a lot.
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