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

How to sort numeric values using JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Mon Nov 13, 2006 2:42 pm
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 Developer


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

PostPosted: Mon Nov 13, 2006 11:16 pm
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:

Use [URL] BBCode for External Links
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
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: 1208
Location: Bangalore,India

PostPosted: Tue Nov 14, 2006 11:24 am
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 Developer


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

PostPosted: Tue Nov 14, 2006 9:09 pm
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:

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
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
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

Moderator Emeritus


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

PostPosted: Thu Dec 21, 2006 8:57 pm
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 Developer


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

PostPosted: Thu Dec 21, 2006 9:00 pm
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
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 Developer


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

PostPosted: Fri Dec 22, 2006 8:49 pm
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:

Use [URL] BBCode for External Links

For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
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
Search our Forums:

Back to Top