View previous topic :: View next topic
|
Author |
Message |
Sureet Mookherjee
New User
Joined: 08 May 2009 Posts: 19 Location: India
|
|
|
|
I have a input file which has a date feild with century field missing
i want all the records which has dates greater than 1-Jan-1980
I/P file:
---+----1----+----2----+
CODY BANKS 120289
JAMES BOND 042904
MILLER KING 011580
CHARLES WRIGHT 111600 |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sureet Mookherjee,
Which sort product do you have? And what version is it? You can find this info in the SYSOUT of any job run.
Does your date field start at a fixed position in the input file? It would be better if you post the sample data/code in "Code" tags. |
|
Back to top |
|
|
Sureet Mookherjee
New User
Joined: 08 May 2009 Posts: 19 Location: India
|
|
|
|
sort product is SYNCSORT FOR Z/OS 1.3.2.0R
yeah the name field starts from col 1 to 14 and date field start from 20 to 25 they are in fixed position[/code] |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
you can use the following SORT card.
Code: |
OPTION COPY
INCLUDE COND=(20,6,CH,GT,C'010180')
|
|
|
Back to top |
|
|
Sureet Mookherjee
New User
Joined: 08 May 2009 Posts: 19 Location: India
|
|
|
|
I have tried this one but its not working |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
I tried with the data provided by you and working fine for me.
ooh, I have not seen your last post, I am using DFSORT and yours is SYNCSORT. I am not sure about syntax of SYNCSORT. Please wait for other responses. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ksk,
Quote: |
I tried with the data provided by you and working fine for me.
ooh, I have not seen your last post, I am using DFSORT and yours is SYNCSORT. I am not sure about syntax of SYNCSORT |
I doubt that even if you have DFSORT. You are comparing dates and not numeric values. And how do you expect it to work with a format ddmmyy.
As per your card 010180(01-Jan-1980) will be less than 020150(02-Jan-1950). |
|
Back to top |
|
|
Sureet Mookherjee
New User
Joined: 08 May 2009 Posts: 19 Location: India
|
|
|
|
the input is in the format MMDDYY i need the output records which are greater than 01-Jan-1980(which is in the format DDMMCCYY) |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Arun,
Thanks for the feedback. I have not considered all the cases, just i checked with the data he has provided and also checked with the following data to descard the record which has less than 010180. I have considered date format MMDDYY and worked fine for me. I can post the output also if you want to see.
Code: |
CODY BANKS 010175
JAMES BOND 042904
MILLER KING 011580
CHARLES WRIGHT 111600
|
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ksk,
Quote: |
I can post the output also if you want to see. |
It might have worked for the sample you used. See how the code posted by you is "working" for this input. This WILL NOT work if you're really trying to compare dates.
Code: |
CODY BANKS 010175
JAMES BOND 020175
MILLER KING 030175
CHARLES WRIGHT 040175 |
Quote: |
I have not considered all the cases, just i checked with the data he has provided |
IMHO the solution should be against the requirement rather than just a sample of 4-5 records. It should work for any possible input |
|
Back to top |
|
|
Sureet Mookherjee
New User
Joined: 08 May 2009 Posts: 19 Location: India
|
|
|
|
Can anybody give me the solution using sort? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sureet Mookherjee wrote: |
Can anybody give me the solution using sort? |
Sureet Mookherjee,
The below SyncSort job should work for your requirement.
Code: |
//STEP1 EXEC PGM=SORT,PARM='CENTWIN=1950'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DEC 01 1975 120275
DEC 02 1976 120276
DEC 31 1979 123179
JAN 01 1980 010180
JAN 02 1980 010280
DEC 01 1989 120289
APR 29 2004 042904
JAN 15 1980 011580
NOV 16 2000 111600
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(20,6,Y2W,GT,800101)
/* |
SORTOUT
Code: |
JAN 02 1980 010280
DEC 01 1989 120289
APR 29 2004 042904
JAN 15 1980 011580
NOV 16 2000 111600 |
|
|
Back to top |
|
|
Sureet Mookherjee
New User
Joined: 08 May 2009 Posts: 19 Location: India
|
|
|
|
Thanks for the solution |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
You're welcome. |
|
Back to top |
|
|
|