Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: is it possible to sort -ve values using SORT with JCL
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

Moderator Team Head


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

PostPosted: Sat Oct 30, 2004 2:10 am    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Feb 25, 2005 10:26 pm    Post subject:
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 Moderator


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

PostPosted: Fri Feb 25, 2005 10:27 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
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    Post subject:
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 Moderator


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

PostPosted: Sat Feb 26, 2005 10:27 pm    Post subject: DFSORT's new SFF format
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:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us