Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sorting data descending with the key as signed numbers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sorting data descending with the key as signed numbers
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Wed Nov 07, 2012 7:36 pm    Post subject: Reply to: Sorting data descending with the key as signed num
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Wed Nov 07, 2012 8:06 pm    Post subject: Reply to: Sorting data descending with the key as signed num
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Data replication from multiple Db2 ta... kishpra DB2 2 Mon Mar 27, 2017 9:58 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us