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

How to SORT digits first then Characters


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pankaj1002

New User


Joined: 30 Jul 2012
Posts: 18
Location: India

PostPosted: Wed Nov 27, 2013 4:23 pm
Reply with quote

Hi,

My requirement is if I have c,d,b,1,a,3,2,4 then after sorting I should get 1,2,3,4,a,b,c,d. but since in hexadecimal code digits comes after the alphabets I always get like a,b,c,d,1,2,3,4. Can someone help me out please?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1590
Location: Andromeda Galaxy

PostPosted: Wed Nov 27, 2013 4:46 pm
Reply with quote

Try this

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
C
D
B
1
A
3
2
4
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  INREC IFTHEN=(WHEN=(1,1,CH,LT,C'1'),OVERLAY=(81:C'2'))
  SORT FIELDS=(81,1,CH,A,1,1,CH,A)
Back to top
View user's profile Send private message
pankaj1002

New User


Joined: 30 Jul 2012
Posts: 18
Location: India

PostPosted: Wed Nov 27, 2013 4:59 pm
Reply with quote

No, its not working icon_sad.gif
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1590
Location: Andromeda Galaxy

PostPosted: Wed Nov 27, 2013 5:06 pm
Reply with quote

Can you please post the output you had got with the code?
Back to top
View user's profile Send private message
pankaj1002

New User


Joined: 30 Jul 2012
Posts: 18
Location: India

PostPosted: Wed Nov 27, 2013 5:18 pm
Reply with quote

I have got the same input sequence in the output. Sorting did not happen at all. I got below output:

B
1
3
C
A
2
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1590
Location: Andromeda Galaxy

PostPosted: Wed Nov 27, 2013 5:22 pm
Reply with quote

could you please post your code here?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Wed Nov 27, 2013 6:02 pm
Reply with quote

Note that in ASCII numbers come before letters. If you need an ALTernative SEQuence, there are other possibilities.
Back to top
View user's profile Send private message
pankaj1002

New User


Joined: 30 Jul 2012
Posts: 18
Location: India

PostPosted: Wed Nov 27, 2013 6:23 pm
Reply with quote

@Pandora-Box- i m using the same code you provided..

Code:

//SORT1     EXEC PGM=SORT
//*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
B
1
3
C
A
2
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  INREC IFTHEN=(WHEN=(1,1,CH,LT,C'1'),OVERLAY=(81:C'2'))
  SORT FIELDS=(81,1,CH,A,1,1,CH,A)
/*


@Bill: How can I achieve that where i can sort numbers before letters?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Nov 27, 2013 6:41 pm
Reply with quote

pankaj1002 wrote:
No, its not working icon_sad.gif

pankaj1002 wrote:
I have got the same input sequence in the output. Sorting did not happen at all. I got below output:

B
1
3
C
A
2

Don't give us too much information to work with, will you.

Saying that it doesn't work is useless without showing us at least the SYSOUT segment from the job. How do you think that we can possibly help without any information.

I have tried the code supplied by Pandora, and IT DOES WORK

So, please show the SYSOUT segment from your supposedly not working job, as it may be that you ARE NOT using DFSORT, yet requesting a DFSORT solution. All other sort products should be posted in the JCL section of the forum.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Nov 27, 2013 6:44 pm
Reply with quote

Hi Pankaj,

Try this code -

Code:

//STEP01   EXEC PGM=SORT         
//SYSPRINT DD SYSOUT=*           
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                   
C                                 
D                                 
B                                 
1                                 
A                                 
3                                 
2                                 
4                                 
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                   
  SORT FIELDS=(1,1,AC,A)         


Thanks,
-3nadh
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Nov 27, 2013 7:56 pm
Reply with quote

Hello,

If Pankaj is unwilling to post the requested info, suggest we spend time on other requests . . .

d
Back to top
View user's profile Send private message
pankaj1002

New User


Joined: 30 Jul 2012
Posts: 18
Location: India

PostPosted: Wed Nov 27, 2013 8:04 pm
Reply with quote

bodatrinadh wrote:
Hi Pankaj,

Try this code -

Code:

//STEP01   EXEC PGM=SORT         
//SYSPRINT DD SYSOUT=*           
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                   
C                                 
D                                 
B                                 
1                                 
A                                 
3                                 
2                                 
4                                 
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                   
  SORT FIELDS=(1,1,AC,A)         


Thanks,
-3nadh


Thanks bodatrinadh, this is working perfect for me. icon_biggrin.gif

Thank you all..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Nov 27, 2013 8:59 pm
Reply with quote

Hello,

Well, ok. . .

I would surely want to know what i had done wrong that the original code did not work. Not knowing will very probably be an issue on some other task.

I suspect it is the uninitialized value in pos 81 . . .

And when several senior people ask for info, it is a very good idea to post it . . .
Back to top
View user's profile Send private message
pankaj1002

New User


Joined: 30 Jul 2012
Posts: 18
Location: India

PostPosted: Thu Nov 28, 2013 8:40 pm
Reply with quote

Hi D.scherrer,

Yes, you are right, I checked again my previous code and found some junk characters from 75 byte because of which it was not working earlier..Thanks again..
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 SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 13
No new posts Installing sort utilities on hercules... DFSORT/ICETOOL 4
No new posts How to add 2 digits to COMP-3 file? DFSORT/ICETOOL 11
This topic is locked: you cannot edit posts or make replies. Sort card help to prepare status report DFSORT/ICETOOL 13
No new posts Building a sort key DFSORT/ICETOOL 3
Search our Forums:

Back to Top