Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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 & VSAM
View previous topic :: :: View next topic  
Author Message
Premdev

New User


Joined: 05 Feb 2008
Posts: 24
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.

Prema.

Title edited
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

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: 24
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: 24
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

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: 24
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
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2238
Location: @my desk

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: 24
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: 24
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: 24
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

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

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
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2238
Location: @my desk

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
Premdev

New User


Joined: 05 Feb 2008
Posts: 24
Location: Coimbatore

PostPosted: Thu May 22, 2008 7:18 am    Post subject:
Reply with quote

Hi Arun, i dont want the date fields to be included...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us