Have file which is having negative and positive values. Now i need to sort this file. lets assume my file having values like 1,20, -1, 0, -2, 5
I need to sort the negative and positive values. Now i want the order to be -2, -1, 0, 1, 5, 20.
Now plaese tell me how to write the SORT JCL for this ?
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
I'd recommend posting your SORT questions on one of the Mainframe Forums that has the IBM-Supported DFSORT guru as the moderator. You will receive a clear, concise, and absolutley correct answer from someone who is paid to take the time to do so.
Before your ques can be answered you must show us PRECISELY what values the field can contain.
What you presented is a field with a variable length. Do the values contain leading zeros or spaces? If it is truely a variable length field you can't sort the file unless SORT has added some capability recently to handle it. I doubt it though.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Jack wrote:
Quote:
What you presented is a field with a variable length. Do the values contain leading zeros or spaces? If it is truely a variable length field you can't sort the file unless SORT has added some capability recently to handle it. I doubt it though.
As a matter of fact, DFSORT did recently add this capability with z/OS DFSORT V1R5 PTF UQ95214 and DFSORT R14 PTF UQ95213 (Dec, 2004).
For example, the following DFSORT job will sort the input records in the correct order:
The following DFSORT job will sort the records in the correct order:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
SFF (signed free form) is a new DFSORT format available with z/OS DFSORT V1R5 PTF UQ95214 and DFSORT R14 PTF UQ95213 (Dec, 2004).
It extracts the sign and digits (0-9) from a field and converts them to ZD format. The value is treated as negative if it contains a '-' or ')' anywhere in the field, otherwise it is treated as positive.
Examples:
Code:
Input value Extracted value
-------------------- ---------------
358,272,300.10 +35827230010
358,272,300.1 +3582723001
+358,272,300 +358272300
(82,316.90) -8231690
12-31-2004 -12312004
G1*** 52 $ 21 R +15221
G1*** ) 52 $ 21 R -15221
000128637.240 +128637240
400.52- -40052
$400.5 +4005
173/821/9072/@3 +17382190723
X,Y,Z +0
You can use the new SFF format in the SORT, MERGE, INCLUDE, OMIT, INREC, OUTREC and OUTFIL statements, and in DISPLAY, OCCUR, RANGE, SELECT, SPLICE, STATS and UNIQUE operators of DFSORT's ICETOOL.
For complete information on the new SFF format and all of the other new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see: