MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Include recs with date field > current date -151 days

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
raogln
Beginner


Joined: 06 Jun 2005
Posts: 2
Topics: 1

PostPosted: Mon Jun 06, 2005 5:03 pm    Post subject: Include recs with date field > current date -151 days Reply with quote

Hi all, i've a date field in my input file as yymmdd

i want to include recs with date field > current date - 151 days.

Is there anyway to do it. This is urgent. Can anyone help me pls.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Jun 06, 2005 5:45 pm    Post subject: Reply with quote

Raogln,

The following JCL will give you the desired results. I assumed that your input date starts at pos 1 for 8 bytes.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DSN=Your Input Dataset,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT DATASET,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *                       
  SORT FIELDS=COPY                     
  INCLUDE COND=(1,8,ZD,GT,&DATE1P-151)   
/*                                   


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raogln
Beginner


Joined: 06 Jun 2005
Posts: 2
Topics: 1

PostPosted: Mon Jun 06, 2005 6:41 pm    Post subject: Reply with quote

Thanks for the solution. But my date field has only 6 bytes (format YYMMDD). Will this still work?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Jun 06, 2005 7:02 pm    Post subject: Reply with quote

Raogln,

sure we need to tweak the control cards a bit. First you need to expand the 6 bytes of date(yymmdd) to 8 bytes(CCYYMMDD). If your input file has an lrecl of 80 bytes , then we expand the date at the end(81st byte) of every record and then validate that field to select the records.

Use the following control cards.

Code:

//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC FIELDS=(1,80,                       $ TOTAL LRECL     
                1,6,Y2T)                    $ EXPAND YY TO YYYY
  OUTFIL INCLUDE=(81,8,ZD,GT,&DATE1P-151),  $ INCLUDE DATE-151
  OUTREC=(1,80)                             $ STRIP DATE AT END
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed May 10, 2006 6:39 pm    Post subject: Reply with quote

Here's an easier way to do this with DFSORT:

Code:

//S1 EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*
//SORTIN  DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD  *
  SORT FIELDS=COPY
  INCLUDE COND=(1,6,Y2T,GT,Y'DATE1'-151)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group