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

excluding records with date field value equal to todays date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hiravibk
Warnings : 1

Active User


Joined: 14 Dec 2008
Posts: 107
Location: India

PostPosted: Tue Apr 07, 2009 10:43 am
Reply with quote

Hi,

I am doing a sort. My input file has a date field (mm/dd/yyyy).In the output data set i want only records where this date field is not equal to todays date. Please explain me how this can be don using a JCL.

Thank you,
Ravi.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Tue Apr 07, 2009 3:44 pm
Reply with quote

If you are using DFSORT, you can convert your date format into some other format like yyyy-dd--mm and in 2nd step you can compare this with DATE1(-) function as below.

Code:

INCLUDE COND=(1,10,CH,EQ,DATE1(-))


Assumed date is starting at 1st position and length is 10.

I know how to extract a date in mm/dd/yyyy but not sure how to compare with this format field. Wait for other responses.
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: Tue Apr 07, 2009 9:51 pm
Reply with quote

Ravi,

You can use a DFSORT job like the following to do what you asked for. I assumed you 'mm/dd/yyyy' date is in positions 1-10 and your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other positions and/or attributes.

Code:

//S1    EXEC  PGM=SORT                       
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD *                               
04/07/2009                                   
04/06/2009                                   
03/07/2009                                   
04/08/2009                                   
/*
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                           
  OPTION COPY                               
  INREC OVERLAY=(81:7,4,1,2,4,2)             
  OUTFIL OMIT=(81,8,CH,EQ,DATE1),         
    BUILD=(1,80)                             
/*
Back to top
View user's profile Send private message
hiravibk
Warnings : 1

Active User


Joined: 14 Dec 2008
Posts: 107
Location: India

PostPosted: Wed Apr 08, 2009 2:58 pm
Reply with quote

Hi Frank,
The code you have given works fine in some cases.
My file has a record lenght of 125 and the date field which i need to compare does not start at column no:1. So i modified the code as given below
Code:

//sysin dd *
  option copy
  inrec overlay=(126:79,4,73,2,76,2)
  outfile omit=(126,8,ch,eq,date1),
  build=(1,125)
//

But i am getting the following error message.

ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 9 END OF SORT OUT FIELD BEYOND MAXIMUM RECORD LENGTH

I could not make out what is the problem here.


Thank you,
Ravi
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 Apr 08, 2009 8:25 pm
Reply with quote

When I run with an input file having RECFM=FB and LRECL=125 and those control statements, I get RC=0 - no error message. Are you sure those are the control statements you're actually using? If so, then please post the complete output you received in //SYSOUT.
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(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top