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 digits first then Characters

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to SORT digits first then Characters
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

Moderator


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

PostPosted: Wed Nov 27, 2013 4:46 pm    Post subject:
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    Post subject: Reply to: How to SORT digits first then Characters
Reply with quote

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

Moderator


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

PostPosted: Wed Nov 27, 2013 5:06 pm    Post subject:
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    Post subject:
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

Moderator


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

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

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Nov 27, 2013 6:02 pm    Post subject: Reply to: How to SORT digits first then Characters
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    Post subject: Reply to: How to SORT digits first then Characters
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: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 27, 2013 6:41 pm    Post subject:
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    Post subject: Reply to: How to SORT digits first then Characters
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

Site Director


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

PostPosted: Wed Nov 27, 2013 7:56 pm    Post subject:
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    Post subject: Re: Reply to: How to SORT digits first then Characters
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

Site Director


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

PostPosted: Wed Nov 27, 2013 8:59 pm    Post subject:
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    Post subject:
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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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