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
 

 

How to sort numeric values using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Mon Nov 13, 2006 2:07 pm    Post subject: How to sort numeric values using JCL
Reply with quote

plz tell me how to sort numerci values in jcl
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Nov 13, 2006 2:42 pm    Post subject:
Reply with quote

Hi There,

Please tell us what exactly u want to do? U want to sort numeric field then please provide offset & position of that field.

Please show us an example so that we can help u out.
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: Mon Nov 13, 2006 11:16 pm    Post subject:
Reply with quote

Star,

You would use a DFSORT job like this::

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
   SORT FIELDS=(p,m,f,a)
/*


For the field you want to sort on (key), p is the starting position, m is the length, f is the format and a is A for ascending sequence or D for descending sequence.

If you don't know which format (f) to use, show us what the values to be sorted look like.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Tue Nov 14, 2006 10:37 am    Post subject: Re: how to sort numeric values
Reply with quote

well i have an instream data as

Code:

1
4
3
2
5
10
7
9
8
6


no the prob is if i use iceman then i have to write

Code:

  SORT FIELDS=(1,2,CH,A)


but out of this is

Code:

1
10
2
3
4
5
6
7
8
9


which is not correct. I want a better solution for this. Plz help me for this.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Nov 14, 2006 11:24 am    Post subject:
Reply with quote

Hi There,

Try this

SORT FIELDS=(1,2,FS,A)

Hope it will helpful
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: Tue Nov 14, 2006 9:09 pm    Post subject:
Reply with quote

Star,

Since your numbers are left-aligned rather than right-aligned, CH won't work. Neither will FS, contrary to what Ekta says. You need DFSORT's UFF (unsigned free form) format to sort left-aligned numbers.

Code:

   SORT FIELDS=(1,2,UFF,A)


For more information on DFSORT's UFF and SFF formats, see:

http://www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Thu Dec 21, 2006 1:18 pm    Post subject:
Reply with quote

Code:
SORT FIELDS=(1,2,UFF,A)


THIS GIVES ERROR. ANYONE ELSE CAN HELP ME FOR THIS.
Back to top
View user's profile Send private message
prafull

New User


Joined: 08 Dec 2006
Posts: 48

PostPosted: Thu Dec 21, 2006 2:11 pm    Post subject:
Reply with quote

SORT FIELDS=(1,2,UFF,A)
the syntax is correct and works everywhere..

star, there must be some other problem with your data.. icon_confused.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Dec 21, 2006 8:57 pm    Post subject:
Reply with quote

Hello,

Please post the jcl for the sort as well as the error message(s).
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: Thu Dec 21, 2006 9:00 pm    Post subject:
Reply with quote

Quote:
THIS GIVES ERROR. ANYONE ELSE CAN HELP ME FOR THIS.


That control statement works fine with DFSORT providing you have at least one blank before SORT. You need to show the //SYSOUT messages you received. Without that, I'd just be guessing at what your problem is.
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Fri Dec 22, 2006 10:11 am    Post subject:
Reply with quote

This is my jcl

Code:
//MTPLD06H JOB NOTIFY=&SYSUID       
//STEP1 EXEC PGM=ICEMAN                       
//SYSOUT DD SYSOUT=*                           
//SYSPRINT DD SYSOUT=*                         
//SORTIN DD *                                 
1                                             
3                                             
2                                             
5                                             
10                                             
4                                             
6                                             
//SORTOUT DD SYSOUT=*                         
//SORTOUT1 DD SYSOUT=*                         
//SYSIN DD *                                   
  SORT FIELDS=(1,2,UFF,A)                     
/*



This is the error i get with max return code 16

Code:
ICE000I J - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 23:39 ON THU DEC
            SORT FIELDS=(1,2,UFF,A)                                             
                             $                                                 
ICE018A M INVALID OR MISSING FORMAT                                             
ICE052I J END OF DFSORT                                                         
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 Dec 22, 2006 8:49 pm    Post subject:
Reply with quote

The error message indicates that your site does not have DFSORT R14 PTF UQ95213 installed. You need that PTF to use UFF format. That PTF has been available since Dec, 2004 so your site is way behind in applying DFSORT service. Ask your System Programmer to install DFSORT R14 PTF UK90006 (April, 2006). That will get you all of the latest DFSORT functions.

For complete details 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/

For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
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 Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm


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