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
 

 

Sorting of Aplha numeric field.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Mon Aug 28, 2006 11:51 am    Post subject: Sorting of Aplha numeric field.
Reply with quote

3829363
3829954
3836931
51005199
8432818
8432819

I have to sort these field but when I'm doing the sort..the result is coming like above..but it should come like below..

3829363
3829954
3836931
8432818
8432819
51005199

Anyone can help me in this regards...
Back to top
View user's profile Send private message

amrita.chatterjee

New User


Joined: 27 Apr 2006
Posts: 48
Location: Bangalore, India

PostPosted: Mon Aug 28, 2006 1:44 pm    Post subject: Re: Sorting of Aplhanumeric field.
Reply with quote

I hope, in my last mail I have mention my problem clearly. I have to sort a column of the input File.
Say input File is

13245
1234
1563

So I have to specify the SYSIN card as

SORT FIELDS=(1,5,CH,A)
& the result should come as below.

1234
1563
13245

But it is coming like below.

1234
13245
1563

because it is padding the 4 digit number with zeros. But I don't want this.
I want to sort the field & and i'm expecting a result as

1234
1563
13245


So can anyone help me in this regards...


icon_sad.gif
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 Aug 28, 2006 9:03 pm    Post subject:
Reply with quote

You can use DFSORT's UFF format to do that:

Code:

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


For more information on UFF, see:

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

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Tue Aug 29, 2006 5:01 pm    Post subject:
Reply with quote

Hi Frank,


For me "UFF" is giving abend. It is giving U268 abend.
I think in our SHOP SYNCSORT release is not holding this format.

Is there any other way to do the above query?
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 Aug 29, 2006 8:56 pm    Post subject:
Reply with quote

UFF works fine with DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 4:19 am    Post subject: Re: Sorting of Aplhanumeric field.
Reply with quote

amrita.chatterjee wrote:
I hope, in my last mail I have mention my problem clearly. I have to sort a column of the input File.
Say input File is

13245
1234
1563

So I have to specify the SYSIN card as

SORT FIELDS=(1,5,CH,A)
& the result should come as below.

1234
1563
13245

But it is coming like below.

1234
13245
1563

because it is padding the 4 digit number with zeros. But I don't want this.
I want to sort the field & and i'm expecting a result as

1234
1563
13245


So can anyone help me in this regards...


:(


hi,

i can suggest you to use numbers of equal size. that is you itself pad zero's to the numbers in the left as that's the normal procedure to do.e.g
if you want to sort the following numbers
1
13
155
12345
then mention it like
00001
00013
00155
12345
if there is any other way if you have come across means update us.

Thanks,
Bala
Back to top
View user's profile Send private message
shivsingla
Warnings : 1

New User


Joined: 14 Jul 2006
Posts: 15
Location: New Delhi

PostPosted: Fri Sep 08, 2006 10:28 am    Post subject: Re: Sorting of Aplha numeric field.
Reply with quote

hi amrita

plz try this below thing

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

IT WILL WORK DEFINITELY

SHIV
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Fri Sep 08, 2006 10:51 am    Post subject:
Reply with quote

Yeap it is wrkg...
Thanks SHiv
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 6:07 pm    Post subject: Re: Sorting of Aplha numeric field.
Reply with quote

shivsingla wrote:
hi amrita

plz try this below thing

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

IT WILL WORK DEFINITELY

SHIV


hi shiv,

can you tell what 'FS' stands for? And what are all the other options we can use for that?

Thanks,
Bala
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri Sep 08, 2006 7:23 pm    Post subject: Re: Sorting of Aplha numeric field.
Reply with quote

FS will NOT work definitely if you have no records with 4 or more characters in your input file. Always test the extremes!

eg try this

132
15
12

with
SORT FIELDS=(1,5,FS,A)

I get;

132
15
12

ie the same order as input
I don't know why maybe Frank can explain.

Use Frank's method he knows best.
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 Sep 08, 2006 9:03 pm    Post subject:
Reply with quote

FS is NOT appropriate for this kind of data. FS extracts the digits from right to left. However, the first non-decimal digit (that is, 0-9) going from right to left is treated as the sign and anything else to the left of the sign is ignored. So for a value in positions 1-5, a blank in position 4 will give you a 0 value.

Thus, with 1,5,FS, here's how various values are interpreted:

Code:

12345     -> 12345
1234      -> 00000
123       -> 00000
12        -> 00000
1         -> 00000


If you sorted these values with (1,5,FS,A), you'd get:

Code:

1234   
123   
12     
1     
12345 


Definitely not what you want.

UFF extracts the digits right to left wherever it finds them and ignores non-digits. So with 1,5,UFF, here's how the various values are interpreted:

Code:

12345     -> 12345
1234      -> 01234
123       -> 00123
12        -> 00012
1         -> 00001


If you sorted these values with (1,5,UFF,A), you'd get:

Code:

1     
12     
123   
1234   
12345 


which is what you want.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Fri Sep 08, 2006 10:39 pm    Post subject:
Reply with quote

Frank.

Thanks for your detailed explanation.

And thanks for all who have provided a suggestion.

Bala
Back to top
View user's profile Send private message
sai_n

New User


Joined: 09 Sep 2006
Posts: 3
Location: chennai

PostPosted: Sat Sep 09, 2006 12:47 am    Post subject:
Reply with quote

can some one tell me what 'FS' and UFF stands for.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am


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