Sorting a file using JCL Sort



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Sorting a file using JCL Sort

Postby karthick » Mon Oct 22, 2007 9:57 am

Hi All,
I have a file which i have to sort using 3 different criteria, first on number(1-15) as A, second on the Y or N(50-51) as D fianlly on date(51-60) as D. I have written a sort card as below. but its not working. can any one help...

SORT FIELDS=(01,15,CH,A,49,01,CH,D,50,10,CH,D) im using PGM=SORT


File layout:

456565750176768 TNYEU STUHUBAU GESMBH Y07.02.2003
karthick
 
Posts: 6
Joined: Thu Oct 11, 2007 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sorting a file using JCL Sort

 

Re: Sorting a file using JCL Sort

Postby krisprems » Mon Oct 22, 2007 3:33 pm

You say,
second on the Y or N(50-51) as D

But you have coded=>
49,01,CH


fianlly on date(51-60) as D

But, your code is=>
50,10,CH,D


And also is the date MM.DD.YYYY or DD.MM.YYYY?
User avatar
krisprems
 
Posts: 3
Joined: Sat Jul 21, 2007 8:03 am
Has thanked: 0 time
Been thanked: 0 time

Re: Sorting a file using JCL Sort

Postby Frank Yaeger » Mon Oct 22, 2007 8:54 pm

Karthick,

Your description of the fields doesn't match the input record example you show, and it's not clear if the date is mm.dd.yyyy or dd.mm.yyyy. In the future, please give examples of your input records and expected output records and explain the rules for getting from input to output.

but its not working


This doesn't tell us anything. Do you mean it's not sorting the records in the way you want it to, or that you received an error message, or what?

In order to sort on a date correctly, you must do it by year, then month, then day.

If your date is in the form mm.dd.yyyy, then this would be the correct DFSORT statement going by your example input record:

   SORT FIELDS=(1,15,CH,A,49,1,CH,D,
     56,4,CH,D,50,5,CH,D)


If your date is in the form dd.mm.yyyy, then this would be the correct DFSORT statement going by your example input record:

   SORT FIELDS=(1,15,CH,A,49,1,CH,D,   
     56,4,CH,D,53,2,CH,D,50,2,CH,D)   
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post