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: 7315

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: 7315

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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


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