IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

is it possible to sort -ve values using SORT with JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
janardhana Reddy

New User


Joined: 20 Oct 2004
Posts: 17
Location: Bangalore

PostPosted: Wed Oct 27, 2004 5:57 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sat Oct 30, 2004 2:10 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Oct 30, 2004 7:12 am
Reply with quote

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
View user's profile Send private message
lnvrn

New User


Joined: 24 Feb 2005
Posts: 8
Location: Mumbai

PostPosted: Fri Feb 25, 2005 3:43 pm
Reply with quote

Hi,

I tried with this input it is not showing the output in sorted order.


Thanks & Regards
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 25, 2005 10:26 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 25, 2005 10:27 pm
Reply with quote

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:

Code:

-2
-1
0
1
5
20


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
View user's profile Send private message
muthukumarapandian

New User


Joined: 08 Oct 2004
Posts: 42
Location: chennai, india

PostPosted: Sat Feb 26, 2005 7:02 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Feb 26, 2005 10:27 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top