Page 1 of 1

Date Compare - 'DD.MM.YYYY' GE '25.01.2010'

PostPosted: Mon Feb 01, 2010 3:38 pm
by Ewizard
I want to edit an existing SYNCSORT to compare an input date of format 'DD.MM.YYYY', position 95, with a constant date '25.01.2010'. If the input date is greater than the constant date then I want to include the record.

The existing SYNCSORT is as follows:
SORT FIELDS=COPY
OUTFIL FILES=S1,
INCLUDE=((8,2,CH,EQ,C'50',OR,
8,2,CH,EQ,C'60',OR,
8,2,CH,EQ,C'40'),AND,
(1,4,CH,NE,C'P7 ',OR,
1,4,CH,NE,C'U7 '))
OUTFIL FILES=S2,
OMIT=((8,2,CH,EQ,C'50',OR,
8,2,CH,EQ,C'60',OR,
8,2,CH,EQ,C'40'),AND,
(1,4,CH,NE,C'P7 ',OR,
1,4,CH,NE,C'U7 ',OR,
8,1,CH,EQ,C'A'))
END

I have had a look at date formats but only see input formats such as DDMMYY or YYMMDD, etc..


Can you help?

Regards,
Eddie.

Re: Date Compare - 'DD.MM.YYYY' GE '25.01.2010'

PostPosted: Wed Feb 03, 2010 10:13 pm
by Thampy
I am not sure whether Syncsort has any date formats to compare dates other than the offset date support.

You can use character comparison to get the desired output. The SORT Jcl is given below

I am assuming the input file record length is 200

SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(210:101,4,214:98,2,216:95,2))
OUTFIL FILES=1,INCLUDE=(210,8,CH,GE,C'20100125'),BUILD=(1,200)
OUTFIL FILES=2,OMIT=(210,8,CH,GE,C'20100125'),BUILD=(1,200)

Note : I have included only the date check condition in the OUTFIL statement. The other conditions you have to include along with the date check condition.

Re: Date Compare - 'DD.MM.YYYY' GE '25.01.2010'

PostPosted: Thu Feb 04, 2010 9:06 pm
by Ewizard
Thanks Thampy.

Regards,
Eddie :D