| Author |
Message |
Premdev
New User
Joined: 05 Feb 2008 Posts: 18 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.
Please help me to achieve the same as early as possible.
Thanks in advance.
R's,
Prema.
Title edited |
|
| Back to top |
|
 |
References
|
Posted: Fri May 09, 2008 9:51 am Post subject: Re: Extract records with date greater than some date |
 |
|
|
 |
gcicchet
Active User
Joined: 28 Jul 2006 Posts: 156
|
|
|
|
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 2008 Posts: 18 Location: Coimbatore
|
|
|
|
Excellent. Thanx a lot. Working fine.  |
|
| Back to top |
|
 |
Premdev
New User
Joined: 05 Feb 2008 Posts: 18 Location: Coimbatore
|
|
|
|
Hi,
what is the function of NULLOUT=RC4 here? |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 6033 Location: 221 B Baker St
|
|
|
|
Hello,
If nothing is "included", the execution will set an RC=04. |
|
| Back to top |
|
 |
Premdev
New User
Joined: 05 Feb 2008 Posts: 18 Location: Coimbatore
|
|
|
|
oh!!! Thanks.  |
|
| Back to top |
|
 |
arcvns
Active User
Joined: 17 Oct 2006 Posts: 201 Location: Trivandrum, Kerala
|
|
|
|
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 2008 Posts: 18 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 2008 Posts: 18 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 2008 Posts: 18 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
Active User
Joined: 28 Jul 2006 Posts: 156
|
|
|
|
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 |
|
 |
arcvns
Active User
Joined: 17 Oct 2006 Posts: 201 Location: Trivandrum, Kerala
|
|
|
|
| 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 |
|
 |
|
|
|