Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Extract records with date greater than some date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL
Author Message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 9:51 am    Post subject: Extract records with date greater than some date
Reply with quote

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
View user's profile Send private message
References
PostPosted: Fri May 09, 2008 9:51 am    Post subject: Re: Extract records with date greater than some date Reply with quote

gcicchet

Active User


Joined: 28 Jul 2006
Posts: 153

PostPosted: Fri May 09, 2008 10:12 am    Post subject:
Reply with quote

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
View user's profile Send private message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 10:26 am    Post subject:
Reply with quote

Excellent. Thanx a lot. Working fine. icon_biggrin.gif
Back to top
View user's profile Send private message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 10:28 am    Post subject:
Reply with quote

Hi,

what is the function of NULLOUT=RC4 here?
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 6019
Location: 221 B Baker St

PostPosted: Fri May 09, 2008 10:37 am    Post subject:
Reply with quote

Hello,

If nothing is "included", the execution will set an RC=04.
Back to top
View user's profile Send private message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 10:44 am    Post subject:
Reply with quote

oh!!! Thanks. icon_smile.gif
Back to top
View user's profile Send private message
arcvns

Active User


Joined: 17 Oct 2006
Posts: 201
Location: Trivandrum, Kerala

PostPosted: Fri May 09, 2008 10:45 am    Post subject:
Reply with quote

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
View user's profile Send private message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 10:52 am    Post subject:
Reply with quote

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
View user's profile Send private message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 10:58 am    Post subject:
Reply with quote

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
View user's profile Send private message
Premdev

New User


Joined: 05 Feb 2008
Posts: 18
Location: Coimbatore

PostPosted: Fri May 09, 2008 12:01 pm    Post subject:
Reply with quote

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
View user's profile Send private message
gcicchet

Active User


Joined: 28 Jul 2006
Posts: 153

PostPosted: Fri May 09, 2008 12:05 pm    Post subject:
Reply with quote

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
View user's profile Send private message
arcvns

Active User


Joined: 17 Oct 2006
Posts: 201
Location: Trivandrum, Kerala

PostPosted: Fri May 09, 2008 1:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1