Page 1 of 1

jcl sort the ps on the date

PostPosted: Thu Aug 06, 2009 2:13 am
by vathota
hi

i have got a ps file which has the date field which is unloaded directly from db2 tables. i need to sort this file on the date which is in the format yyyy-mm-dd. i am trying to do sort on this field. here is example what i am trying to do ...
SORT FIELDS = (147,10,CH,A). but it is not sorting properly. so can you help me how the date is handled in jcl sort ?

date starts in column 147 ranging to 156.

Re: jcl sort the ps on the date

PostPosted: Thu Aug 06, 2009 2:21 am
by Frank Yaeger
If your dates are all character values of the form yyyy-mm-dd and that field starts in position 147, that would be the correct SORT statement.

If it is not sorting properly, then either:

1) You are not specifying the correct starting position for the field. One common mistake here is that the input file has RECFM=VB, and you are not accounting for the RDW in positions 1-4. If that's the case, the starting position would be 151, not 147.
2) You do not really have proper character values of the form yyyy-mm-dd.

If you need more help, use these DFSORT control statements to display the values from the first 8 records (in hex) and post here:

   OPTION COPY,STOPAFT=8
   INREC BUILD=(147,10,HEX)

Re: jcl sort the ps on the date

PostPosted: Thu Aug 06, 2009 2:41 am
by vathota
thank you. i am gonna try with the character mode.

Re: jcl sort the ps on the date

PostPosted: Thu Aug 06, 2009 5:31 am
by Frank Yaeger
i am gonna try with the character mode.


I have no idea what you mean by that. Good luck.