MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
amzad Beginner Joined: 01 Feb 2004 Posts: 5 Topics: 2
Posted: Fri Feb 13, 2004 6:30 pm Post subject: How to extract oldest and latest rec in seq using syncsort?
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
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
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Feb 13, 2004 7:34 pm Post subject:
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
amzad Beginner Joined: 01 Feb 2004 Posts: 5 Topics: 2
Posted: Mon Feb 16, 2004 9:49 am Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Feb 16, 2004 10:26 am Post subject:
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
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