View previous topic :: View next topic
|
Author |
Message |
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
No, its not working |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Can you please post the output you had got with the code? |
|
Back to top |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
could you please post your code here? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Note that in ASCII numbers come before letters. If you need an ALTernative SEQuence, there are other possibilities. |
|
Back to top |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
@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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
pankaj1002 wrote: |
No, its not working |
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 |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If Pankaj is unwilling to post the requested info, suggest we spend time on other requests . . .
d |
|
Back to top |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
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.
Thank you all.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
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 |
|
|
|