MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort only considering numbers in an alphanumeric fields.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sebanpj
Beginner


Joined: 04 Aug 2008
Posts: 9
Topics: 5
Location: BANGALORE

PostPosted: Wed Apr 01, 2009 10:52 am    Post subject: Sort only considering numbers in an alphanumeric fields. Reply with quote

I have to sort a file based on an alphanumeric field. While sorting I should not consider the character values. The sort order should be as if all the characters in the field were zeroes. Please see the samble input and output below.

Sample input :
Code:
4356zz5
nnnnnnn
12cd231
aaaaaaa
4356aa6
12ab345
zzzzzzz
aa23456
zz12345


Sample output:
Code:
nnnnnnn
aaaaaaa
zzzzzzz
zz12345
aa23456
12cd231
12ab345
4356zz5
4356aa6


Please help me. I hope my question is not confusing.
_________________
Thanks and Regards,
Sebastian Joseph
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 01, 2009 12:24 pm    Post subject: Reply with quote

Sebanpj,

The following DFSORT JCL will give you the desired results. I assumed that your Input is FB and LRECL is 80


Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
4356ZZ5                                                     
NNNNNNN                                                     
12CD231                                                     
AAAAAAA                                                     
4356AA6                                                     
12AB345                                                     
ZZZZZZZ                                                     
AA23456                                                     
ZZ12345                                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,7,SEQNUM,8,ZD)),   
  IFTHEN=(WHEN=(1,1,FS,NE,NUM),OVERLAY=(81:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(2,1,FS,NE,NUM),OVERLAY=(82:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(3,1,FS,NE,NUM),OVERLAY=(83:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(4,1,FS,NE,NUM),OVERLAY=(84:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(5,1,FS,NE,NUM),OVERLAY=(85:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(6,1,FS,NE,NUM),OVERLAY=(86:C'0'),HIT=NEXT),
  IFTHEN=(WHEN=(7,1,FS,NE,NUM),OVERLAY=(87:C'0'))           
                                                           
  SORT FIELDS=(81,15,CH,A)                                 
                                                           
  OUTREC BUILD=(1,80)                                       
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sebanpj
Beginner


Joined: 04 Aug 2008
Posts: 9
Topics: 5
Location: BANGALORE

PostPosted: Wed Apr 01, 2009 1:52 pm    Post subject: Reply with quote

Hi Kolusu,

Thank you very much.
My Project is using SYNCSORT. Any idea how this option will be in syncsort?

Can someone please suggest...
_________________
Thanks and Regards,
Sebastian Joseph
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 01, 2009 2:22 pm    Post subject: Reply with quote

Sebanpj,

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.

Thanks
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Wed Apr 01, 2009 3:41 pm    Post subject: Reply with quote

Perhaps the ALTSEQ option would work. It will be cumbersome as you will need to provide every character value with an alternate sort value of x'F0'.
Code:
//SYSIN    DD *                                     
*             A    B    C    D          Z
 ALTSEQ CODE=(C1F0,C2F0,C3F0,C4F0,......E9F0)
 OPTION CHALT                                       
 SORT FIELDS=(1,7,CH,A)                               
Or try kolusu example since SyncSort eventually mimics most DFSort function.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
Sebanpj
Beginner


Joined: 04 Aug 2008
Posts: 9
Topics: 5
Location: BANGALORE

PostPosted: Fri Apr 03, 2009 6:53 pm    Post subject: Reply with quote

Hi Kolusu and Dennis,

I tried Kolusu's code and it is working fine with Syncsort also.

Thank you very much for your support.
_________________
Thanks and Regards,
Sebastian Joseph
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group