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

selecting records using date format mm/dd/yy


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Jul 29, 2009 3:25 am
Reply with quote

Hi,

I need to select records from a dataset (LRECL=80 and RECFM=FB) which are created in last 45 days.

My file contain data as below:

FEAIX115 06/01/08 (DATE FIELD start at 10th Position)
FEAIX116 07/03/08
FEAIX117 07/05/07
FEAIX118 09/22/07
FEAIX120 06/13/09
FEAIX121 06/16/09
FEAIX122 07/02/09
FEAIX123 06/01/09
FEAIX124 06/05/09
FEAIX125 08/04/09
My Sysin contain the below code..
SORT FIELDS=COPY
INREC FIELDS=(1,11,13,2,15,2,2X,19,61)
INCLUDE COND=(10,6,Y2W,GE,Y'DATE1'-45)

But my output is showing "FEAIX118" which is created in 2007.
Can anybody let me know what I am missing? Please correct me.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jul 29, 2009 3:49 am
Reply with quote

The INCLUDE statement is processed before the INREC statement. Y'DATE1'-45 is a constant in the form yymmdd but the field you're comparing it to is yy/mm/dd so you won't get a match. You need to reformat the field to yymmdd so you can compare them. You can use INREC with UFF to extract yymmdd from yy/mm/dd and then use OUTFIL INCLUDE to do the compare. OUTFIL is processed after INREC.

I'd show you how to do it, but I'm having trouble matching your INREC to your input data since you say the date starts at 10, but you have 1,11 etc in INREC so I don't know what you want the output to look like.

If you need more help with this, show me an example of your input records with ubb code tags and the expected output with ubb code tags. Tell me the RECFM and LRECL of the input file and the starting position, length and format of each input and output field.
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Jul 29, 2009 4:25 am
Reply with quote

I tried using OUTFIL INCLUDE and UFF in Inrec Build, but still I am getting the same problem.
My Input data - Input file record Length=80 and RECFM=FB
Code:

FEAIX115 06/01/08
FEAIX116 07/03/08
FEAIX117 07/05/07
FEAIX118 09/22/07
FEAIX120 06/13/09
FEAIX121 06/16/09
FEAIX122 07/02/09
FEAIX123 06/01/09
FEAIX124 06/05/09
FEAIX125 08/04/09


Output Record Length =80 and Recfm=FB, Output will contain below records

Code:

FEAIX121 06/16/09
FEAIX122 07/02/09
FEAIX125 08/04/09
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 29, 2009 5:40 am
Reply with quote

surya_pathaus,

use the following control cards.

Code:

//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC OVERLAY=(81:10,8,UFF,ZD,LENGTH=6)               
  OUTFIL BUILD=(1,80),INCLUDE=(81,6,Y2W,GE,Y'DATE1'-45) 
/*
Back to top
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Thu Jul 30, 2009 1:38 am
Reply with quote

Kolusu,

When I executed the JCL with the code provided by you, following data is written into output

Code:

FEAIX115 06/01/08 
FEAIX116 07/03/08 
FEAIX117 07/05/07 
FEAIX118 09/22/07 
FEAIX121 06/16/09 
FEAIX122 07/02/09 
FEAIX125 08/04/09 


When I compared the output 2009 data (FEAIX120,FEAIX123,FEAIX124 are execluded) is compared successfully and required records (FEAIX121,FEAIX122,FEAIX125) are written into output. As I understood, Y2W window starts from 2009 year.. I think that is the reason it is not comparing the records which are from 2008 and 2007.

Let me know your comments and suggestions.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 30, 2009 3:51 am
Reply with quote

surya_pathaus,

Looks like your shop has set the Y2past value to 1909. If you looked at the sysout you should have found
Code:

ICE168I 0 CENTURY WINDOW FOR Y2 FORMAT FIELDS IS FROM 1909 TO 2008


which tells you the century window used. You can override the Y2PAST option to increase the century window

use the following control cards
Code:

//SYSIN    DD *
  OPTION Y2PAST=1929                                   
  SORT FIELDS=COPY                                     
  INREC OVERLAY=(81:10,8,UFF,ZD,LENGTH=6)               
  OUTFIL BUILD=(1,80),INCLUDE=(81,6,Y2W,GE,Y'DATE1'-45)
//*


and your sysout will have this

Code:

ICE168I 0 CENTURY WINDOW FOR Y2 FORMAT FIELDS IS FROM 1929 TO 2028   
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top