IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sorting data descending with the key as signed numbers


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Harish Pisharody

New User


Joined: 24 Nov 2007
Posts: 5
Location: Bangalore, India

PostPosted: Wed Nov 07, 2012 7:31 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 07, 2012 7:36 pm
Reply with quote

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
View user's profile Send private message
Harish Pisharody

New User


Joined: 24 Nov 2007
Posts: 5
Location: Bangalore, India

PostPosted: Wed Nov 07, 2012 7:43 pm
Reply with quote

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
View user's profile Send private message
Harish Pisharody

New User


Joined: 24 Nov 2007
Posts: 5
Location: Bangalore, India

PostPosted: Wed Nov 07, 2012 8:06 pm
Reply with quote

Thanks Bill,

It worked correctly with FS data type.

Code:
SORT FIELDS=(85,4,FS,D)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 07, 2012 8:06 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top