Posted: Thu Sep 02, 2004 1:37 am Post subject: Sort on date by padding with century
Hi all,
I have to sort a file according to a date field in YYMMDD format in ascending order. The date field type is charecter. I am giving input and expected output
*************************************************************
INPUT DATE FIELD
*************************************************************
011203
041113
990303
990404
001001
040202
*************************************************************
EXPECTED OUTPUT
*************************************************************
990303
990404
001001
011203
040202
041113
*************************************************************
*************************************************************
The ordinary sort wont work in this case as if i give sort fiedls = (1,6,ch,a) it will give 001001 before 990303. I cannot convert it first to a format of CCYYMMDD as the next step after this is a cobol pgm which expects YYMMDD format. I have to accomplish this with sort. I cannot use quick job or easytrieve.
Please tell me how to do this using syncsort.
Thanks
bade_miya.
Hi all,
I got the answer from the manual itself. We have to give the following sort step just in case if any one wants to know.
********************************************************************
SORT FIELDS=(11646,06,Y2T,A),
CENTWIN=1950
********************************************************************
As i have given CENTWIN=1950, it will sort the dates according to this century window.
********************************************************************
example from the manual
********************************************************************
For example, consider the century window 1950 through 2049. The 2-digit year
fields would be processed as follows:
Two-digit Field in i/p Processed as Year
--------------------------------------------------------
00--------------------- 2000
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum