View previous topic :: View next topic
Author
Message
Harish Pisharody New User Joined: 24 Nov 2007Posts: 5 Location: Bangalore, India
Hi,
I want to sort data in descending order . The key field for sorting is numeric data which can have negative value as well.
Given below is the step and the sort card that I coded
Code:
//P020D71 EXEC PGM=SORT
//SORTMSG DD SYSOUT=*
//SORTIN DD DSN=INPUT FILE,
// DISP=(OLD,KEEP,KEEP)
//SORTOUT DD DSN=OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=140,BLKSIZE=0,DSORG=PS)
//SYSIN DD *
SORT FIELDS=(85,4,ZD,D)
/*
The output data is coming sorted as expected for the records which has the key field with positive value.
However, for the records which has the key field with negative value, the sorting is not working correctly.
For example, given below is the part of the output data which has negative value in the key field.
Since -25 is greater than -34 , -51 or -56, it should have been placed above , however it is placed below.
Code:
,T1,01/01/2013,-056,2013-01-01,
,T1,12/27/2012,-051,2012-12-27,
,T1,12/10/2012,-034,2012-12-10,
,T1,12/01/2012,-025,2012-12-01,
But the records with positive value are getting sorted correctly
Code:
,T1,01/01/2012,+310,2012-01-01,
,T1,08/19/2012,+079,2012-08-19,
,T1,09/01/2012,+066,2012-09-01,
Please help me understand what is that I'm missing here.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Well, if that is your file, your data is not ZD. It is SFF (look it up the data-types in the manual).
Try your SORT with SFF instead of ZD.
Back to top
Harish Pisharody New User Joined: 24 Nov 2007Posts: 5 Location: Bangalore, India
Bill, do you know if SFF is supported by DFSORT Rel 14.0 .
I'm getting Invalid Format error
Code:
1ICE000I J - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0
0 SORT FIELDS=(85,4,SFF,D)
$
ICE018A M INVALID FORMAT
ICE052I J END OF DFSORT
Back to top
Harish Pisharody New User Joined: 24 Nov 2007Posts: 5 Location: Bangalore, India
Thanks Bill,
It worked correctly with FS data type.
Code:
SORT FIELDS=(85,4,FS,D)
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Can you run this, please, and post the full sysout.
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/*
Edit: I think your DFSORT is an antique. Any chance of getting it upgraded? There'll be lots of benefits, like having a supported product.
Back to top
Please enable JavaScript!