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

Sorting of Aplha numeric field.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Mon Aug 28, 2006 9:03 pm
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:

Use [URL] BBCode for External Links
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
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 Developer


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

PostPosted: Tue Aug 29, 2006 8:56 pm
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
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
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: 1208
Location: Bangalore,India

PostPosted: Fri Sep 08, 2006 10:51 am
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
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
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 Developer


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

PostPosted: Fri Sep 08, 2006 9:03 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top