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:
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Hello relur197,
The below SYNCSORT does what you asked for. I assumed data starting at postion 1 and the maximum data length as 6(including decimal point). You might want to change it as per your attributes.
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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:
123.45
1.23
1.50
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:
12345
00123
00150
and sort them correctly.
But among the values are some with only one decimal place, like:
1.5
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.