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
 

 

excluding records with date field value equal to todays date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
hiravibk
Warnings : 1

Active User


Joined: 14 Dec 2008
Posts: 103
Location: India

PostPosted: Tue Apr 07, 2009 10:43 am    Post subject: excluding records with date field value equal to todays date
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: 356
Location: New York

PostPosted: Tue Apr 07, 2009 3:44 pm    Post subject:
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 Moderator


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

PostPosted: Tue Apr 07, 2009 9:51 pm    Post subject:
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: 103
Location: India

PostPosted: Wed Apr 08, 2009 2:58 pm    Post subject:
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 Moderator


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

PostPosted: Wed Apr 08, 2009 8:25 pm    Post subject:
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    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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm


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