IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract records with date greater than some date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Fri May 09, 2008 10:12 am
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
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
Reply with quote

Hi,

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

Moderator Emeritus


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

PostPosted: Fri May 09, 2008 10:37 am
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
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: 2481
Location: @my desk

PostPosted: Fri May 09, 2008 10:45 am
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
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
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
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: 1702
Location: Australia

PostPosted: Fri May 09, 2008 12:05 pm
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: 2481
Location: @my desk

PostPosted: Fri May 09, 2008 1:52 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top