View previous topic :: View next topic
|
Author |
Message |
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
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 |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
hiravibk Warnings : 1 Active User
Joined: 14 Dec 2008 Posts: 107 Location: India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|