MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Sebanpj Beginner Joined: 04 Aug 2008 Posts: 9 Topics: 5 Location: BANGALORE
Posted: Wed Apr 01, 2009 10:52 am Post subject: Sort only considering numbers in an alphanumeric fields.
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Apr 01, 2009 12:24 pm Post subject:
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
Sebanpj Beginner Joined: 04 Aug 2008 Posts: 9 Topics: 5 Location: BANGALORE
Posted: Wed Apr 01, 2009 1:52 pm Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Apr 01, 2009 2:22 pm Post subject:
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
Bill Dennis Advanced Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
Posted: Wed Apr 01, 2009 3:41 pm Post subject:
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
Sebanpj Beginner Joined: 04 Aug 2008 Posts: 9 Topics: 5 Location: BANGALORE
Posted: Fri Apr 03, 2009 6:53 pm Post subject:
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
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