View previous topic :: View next topic
Author
Message
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Hi,
i need to sort a file based on the date.
some of the records from the file are:
21000000412.02.2007
21000000524.03.2008
21000000511.09.2007
i need to extract only the records in which the date are 01.04.2007 and above.
Prema.
Title edited
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
try this
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
21000000412.02.2007
21000000524.03.2008
21000000511.09.2007
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,NULLOUT=RC4
INCLUDE COND=(16,4,CH,GE,C'2007',&,
13,2,CH,GE,C'04',&,
10,2,CH,GE,C'01')
/*
Gerry
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Excellent. Thanx a lot. Working fine.
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Hi,
what is the function of NULLOUT=RC4 here?
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
If nothing is "included", the execution will set an RC=04.
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
oh!!! Thanks.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Hi Premdev,
I just tried with the above sort and input and I got the below results.
Input
Code:
21000000412.02.2007
21000000524.03.2008
21000000511.09.2007
Output
Code:
21000000511.09.2007
Quote:
i need to extract only the records in which the date are 01.04.2007 and above.
As per the above requirement, the second record should also get extracted, right??
Thanks,
Arun
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Hi,
In the records below,
210000000
210000000
210000002
210000002
210000003
210000003
210000003
210000003
210000000 occurs two times, 210000002 occurs two times and 210000003 occurs four times. Similarly i need to get the occurrence for the records in the whole file.
Is it possible using sort?
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Quote:
As per the above requirement, the second record should also get extracted, right??
yes. the problem is bcoz
16,4,CH,GE,C'2007',&,
13,2,CH,GE,C'04'
i guess. Vl let you know the solution at the earliest.
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Quote:
As per the above requirement, the second record should also get extracted, right??
Hi Arun,
This is working...
INCLUDE COND=((16,4,CH,GE,C'2007',&,
13,2,CH,GE,C'04',&,
10,2,CH,GE,C'01'),OR,
(16,4,CH,GE,C'2008',&,
13,2,CH,GE,C'01',&,
10,2,CH,GE,C'01'))
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi Arun,
thanks for pointing out the error, I should start using glasses, anyhow try this code
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
21000000412.02.2007
21000000524.03.2008
21000000511.09.2007
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:16,4,85:13,2,87:10,2)
OUTFIL INCLUDE=(81,8,CH,GE,C'20070401'),BUILD=(1,80)
Gerry
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Quote:
210000000 occurs two times, 210000002 occurs two times and 210000003 occurs four times. Similarly i need to get the occurrence for the records in the whole file.
Is it possible using sort?
It is possible, but how do you go with the date selection, which date do you want for duplicates on position 1-19 or you dont need the date field at all???
Thanks,
Arun
Back to top
Premdev New User Joined: 05 Feb 2008Posts: 24 Location: Coimbatore
Hi Arun, i dont want the date fields to be included...
Back to top
Please enable JavaScript!