Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 701
  • Last Modified:

sorting problem

I have a simple DFSORT issue.
I give input data in sysin (obviously it is of character type)
//SORTIN   DD *          
2350                     
2199                     
450                      
360                      
295                      
2200                     
1925                     
1899                     
9900                     
3195                     
2600                     
/*      

Open in new window

my sort card is:
//SYSIN    DD *                
  SORT FIELDS=(1,4,BI,A)       
/* 

Open in new window

I am getting the same result even if i use the sort card as SORT FIELDS=(1,4,CH,A)    
The output i am getting is:
1899 
1925 
2199 
2200 
2350 
2600 
295  
3195 
360  
450  
9900 

Open in new window

                           
Any idea how to correct this..?
0
jimsweb
Asked:
jimsweb
1 Solution
 
woolmilkporcCommented:
Hi,

that's a nice problem - your issue is due to left-alignment of the numerical values.

There is a special format "UFF" which might help here.

SORT FIELDS=(1,4,UFF,A)

"UFF" means "unsigned free form numeric". It's described ("IBM DFSORT Application Programming Guide") like this:

This format extracts decimal digits (0-9) from right to left anywhere in the field to form a positive number. Any         |  combination of characters is valid, but characters other than 0-9 are ignored.

wmp
0
 
jimswebAuthor Commented:
Thanks a ton! You are really a mainframe maestro..
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now