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 

How to extract oldest and latest rec in seq using syncsort?

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


Joined: 01 Feb 2004
Posts: 5
Topics: 2

PostPosted: Fri Feb 13, 2004 6:30 pm    Post subject: How to extract oldest and latest rec in seq using syncsort? Reply with quote

Hi All,

I need to extract the oldest and latest dates from a sequential file.

For example.

I have a sequential file which is not in sorted order,

Code:

02052004
02012004
02122004
02112004
02082004


I want the o/p as

Code:

02012004  02122004


which is nothing but the oldest and latest dates of the month.

Is there any soultion for the above problem in Syncsort?.

I found few updates from the links but counldn't satisfying my requirement.If I have missed any,please provide me the same

suggestion are most welcome.

rgds,
Amjad Sad
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Feb 13, 2004 7:34 pm    Post subject: Reply with quote

Amzad,

The following JCL will give you desired results.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
02052004                                                       
02012004                                                       
02122004                                                       
02112004                                                       
02082004                                                       
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD    *                                             
  SORT FIELDS=COPY
  OUTFIL REMOVECC,NODETAIL,                                     
    TRAILER1=(MIN=(1,8,ZD,M11),X,         $ OLDEST DATE
              MAX=(1,8,ZD,M11),           $ LATEST DATE
              80:X)                 
/*   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amzad
Beginner


Joined: 01 Feb 2004
Posts: 5
Topics: 2

PostPosted: Mon Feb 16, 2004 9:49 am    Post subject: Reply with quote

Kolusu,

Thank you very much,it work as expected.

I have another problem.My input file is VB format with lenght of 24004 and I want the o/p as sequential file in FB format as 80 bytes with MIN and MAX date in the file.

FYI : Date is in position of 3988(+4) for VB.

I tried but in vain,so could you please help regarding this.

rgds,
Amjad
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 16, 2004 10:26 am    Post subject: Reply with quote

Amjad,

Try the following JCl.
Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=YOUR VB INPUT FILE,
//            DISP=SHR         
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD    *                                   
   SORT FIELDS=COPY                                 
   INREC FIELDS=(1,4,                               
                 3992,8)                             
   OUTREC FIELDS=(1,12,80:X),CONVERT                 
   OUTFIL REMOVECC,NODETAIL,                         
     TRAILER1=(C'MIN:',MIN=(5,8,ZD,M11),X,           
               C'MAX:',MAX=(5,8,ZD,M11))             
/*           


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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