|
View previous topic :: View next topic
|
| Author |
Message |
janardhana Reddy
New User
Joined: 20 Oct 2004 Posts: 17 Location: Bangalore
|
|
|
|
Hi all
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 ? |
|
| Back to top |
|
 |
superk
Global Moderator

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. |
|
| Back to top |
|
 |
mmwife
Super Moderator

Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Janardhan,
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. |
|
| Back to top |
|
 |
lnvrn
New User
Joined: 24 Feb 2005 Posts: 8 Location: Mumbai
|
|
|
|
Hi,
I tried with this input it is not showing the output in sorted order.
Thanks & Regards |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Janardhan,
Please show an example of your input records and what you want the output records to look like.
How exactly you would sort the records depends on the exact format of your values.
And please do post questions about sort in the SORT Forum (I'm the Moderator of that one). |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1
20
-1
0
-2
5
/*
//SORTOUT DD DSN=... output file
//SYSIN DD *
SORT FIELDS=(1,2,SFF,A)
/*
|
SORTOUT will have the following records:
For complete information on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
Use [URL] BBCode for External Links |
|
| Back to top |
|
 |
muthukumarapandian
New User

Joined: 08 Oct 2004 Posts: 42 Location: chennai, india
|
|
|
|
Hi frank yaeger,
I don't know the meaning for SFF as u specify in the sort fields
//SYSIN DD *
SORT FIELDS=(1,2,SFF,A)
Plz reply me. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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:
Use [URL] BBCode for External Links |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|