In my current issue I can't find the right syncsort commands to sort this list from highest to lowest. I am currently sorting on the 81st column and sometimes there decimals can get as big as 5 characters long. My current output from the below jcl is this:
I need the decimals sorted from highest to lowest but along with taking everything else that is on the line with it. including these member names.
There is also more infomation on the line. The infomation starts at column 1, and the decimals dont start until column 81 and they go for a max of 6 columns.
1.) 125 is the input lrecl.
2.) the length of the first field is variable because it is a dsn. But it will never exceed 40 characters. the second field starts at pos 51. and the second field will never exceed 8 characters.
3.) I just need the field starting as pos 81
4.) I want the all fields in output.
I don't usually respond to Syncsort questions, but as the inventor of the UFF format (for DFSORT), I can't stand to see it misused so badly. Nobody posting here seems to understand how it really works.
If the input values were all of the form d...d.dd, for example:
then you wouldn't need to change the values with INREC and OUTREC - you could just use UFF in the SORT statement directly. UFF would interpret these values as:
and sort them correctly.
But among the values are some with only one decimal place, like:
UFF would interpret that value as 00015, not 00150 so it wouldn't be placed in the correct order.
To sort values with different numbers of decimal places correctly, you must "normalize" them first. For example, 1.5 must be changed to 1.50 to match the values with 2 decimal places like 1.23.
Here's a DFSORT job that will sort these mixed 1 and 2 decimal place values correctly. It uses PARSE to separate the digits before the decimal point from the 1 or 2 digits after the decimal point and normalizes 1 digit after the decimal point to 2 digits after the decimal point. After that's done, it uses UFF to sort the values.