View previous topic :: View next topic
Author
Message
seema_285 New User Joined: 14 Oct 2010Posts: 13 Location: pune
Hi,
I want to do some manipulations on date which is in mm/dd/yyyy format in my input file.
I want to extract records which have date before two months of current date.
How to do this using sort.??
I have tried with following sort card but got an user abend.
Code:
SORT FIELDS=COPY
OUTFIL OUTREC=(01,10,ZD,LT,&DATE2P(MD4/)-2)
OUTFIL OUTREC=(01,10,ZD,GT,&DATE2P(MD4/)-2)
Please suggest some solutions.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello and welcome to the forum,
One easy thing to do is write a bit of code to generate the sort control statements.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
seema_285,
Welcome to the forums!
Are you just considering the month alone and not the date (dd) part?
Can you provide some sample input and expected output out of it?
Back to top
seema_285 New User Joined: 14 Oct 2010Posts: 13 Location: pune
Hi Arun,
PFB the input output details:
Input: 08/05/2010
08/08/2010
10/05/2010
08/18/2010
09/18/2010
08/19/2010
Processing shud be: (input date {mm/dd/yyyy}) - (current date (10/18/2010){mm/dd/yyyy} >= 30 days OR 2 months
Output: 08/05/2010
08/08/2010
08/18/2010
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
Hello Seema.
Here is an example of a SyncSort for z/OS job that should help you:
Code:
//SORT1 EXEC PGM=SORT
//SORTIN DD *
08/06/2010
08/09/2010
10/06/2010
08/19/2010
09/19/2010
08/20/2010
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(20:7,4,1,2,4,2,40:&DATENS=(4MD))),
IFTHEN=(WHEN=(44,2,CH,EQ,C'01'),
OVERLAY=(44:C'11',40:40,4,ZD,SUB,+1,EDIT=(TTTT))),
IFTHEN=(WHEN=(44,2,CH,EQ,C'02'),
OVERLAY=(44:C'12',40:40,4,ZD,SUB,+1,EDIT=(TTTT))),
IFTHEN=(WHEN=NONE,
OVERLAY=(44:44,2,ZD,SUB,+2,EDIT=(TT)))
OUTFIL INCLUDE=(20,8,ZD,LE,40,8,ZD),BUILD=(1,10)
/*
Here is the output produced by the step above:
Code:
08/06/2010
08/09/2010
08/19/2010
Please let us know if you have any further questions.
Regards,
Back to top
seema_285 New User Joined: 14 Oct 2010Posts: 13 Location: pune
Thanks Alissa.
This has worked..
But my question is that Can we do the same with in built date functions in sort like &DATE,&DATE1 or &DATE2 ?
Please let me know if you could help me on this.
Thanking you in anticipation.
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
Seema,
I don't understand your question. Can you please provide an example?
Thanks,
Back to top
seema_285 New User Joined: 14 Oct 2010Posts: 13 Location: pune
Alissa,
Can we rewrite the same sort card with the help of &date or &date paramenters in SYNCSORT....
e.g.
SORT FIELDS=COPY
OUTFIL OUTREC=(01,10,ZD,LT,&DATE2P(MD4/)-2)
OUTFIL OUTREC=(01,10,ZD,GT,&DATE2P(MD4/)-2)
I tried but did not get the results.
Let me know if you could throw some light on it.
Thanks.
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
You need to reformat your input date field for the comparison. You can code something like this for 60 days:
Code:
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(12:7,4,1,2,4,2)
OUTFIL INCLUDE=(12,7,CH,LT,&DATE1-60),OUTREC=(1,10)
/*
Back to top
seema_285 New User Joined: 14 Oct 2010Posts: 13 Location: pune
Thank you so much Alissa...
Back to top
Please enable JavaScript!