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 

Exclude special characters in sort

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


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Wed Jun 27, 2007 3:49 pm    Post subject: Exclude special characters in sort Reply with quote

Hi All,

I have a requirement in which i have to filter certain records from the input file. There is a name field which has non alphabetic characters in the names(like numbers). We have to filter out all the records which has invalid characters in it. But the catch is that we should not consider the characters ' (quotation) and - (hyphen). so anything with A-Z,a-z,',- are valid. I searched the forum and found this link somewhat matching my requirement.

http://www.mvsforums.com/helpboards/viewtopic.php?t=7294&highlight=alphabetic+sort

But again the challenge was how to represent the quotation in the omit or include statement.

Can any one help me out?

Thanks & Regards
bade_miya
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jun 27, 2007 4:05 pm    Post subject: Reply with quote

An apostrophe in a character string would be represented by two apostrophes.

Examples:

C'''' for '.
C'A''B' for A'B.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Wed Jun 27, 2007 4:34 pm    Post subject: Reply with quote

Hi Frank,

Thanks a lot for the reply. The requirement have changed slightly now. Now i have to extract all the records with quotation(') and hyphen (-).

I am using this sysin card for the same

Code:

SORT FIELDS=(185,27,CH,A)                               
OMIT COND=(2,1,SS,EQ,C'-''')


Eventhough my test input has some of these values, i am not able to retrieve the records. Can you please help me out?

Thanks
bade_miya
Back to top
View user's profile Send private message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Wed Jun 27, 2007 4:35 pm    Post subject: Reply with quote

sorry for posting the wrong code, it was

Code:

  SORT FIELDS=(185,27,CH,A)                               
  INCLUDE COND=(2,1,SS,EQ,C'-''')
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jun 27, 2007 6:42 pm    Post subject: Reply with quote

If I have these input records:

1-
2'
3+
4A
5"

and use this DFSORT INCLUDE statement:

Code:

  INCLUDE COND=(2,1,SS,EQ,C'-''')   


I get these output records:

1-
2'

as expected.

Is your input file VB rather than FB? If so, you need to add 4 to your input positions to account for the RDW (e.g. 6,1 instead of 2,1).

Or do you want to look for a quote (") rather than an apostrophe (')? What is the hex character you want to look for - quote = X'7F' whereas apostrophe = X'7D'.

If that's not it, then show an example of your input records, the output records you received and the //SYSOUT messages for the run.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Jun 28, 2007 2:35 am    Post subject: Reply with quote

Hi Frank,

Thanks for the reply. But can you try this input and tell me what the output will be?

Code:


1-CD   
2'     
BCD    -
BCD     
BCD    '



For me it is displaying only the first two records the thrid and fifth records are not comming in the output.

The sysin i used is

Code:

SORT FIELDS=(1,20,CH,A)       
INCLUDE COND=(2,1,SS,EQ,C'''-')


I believe whenever spaces are comming in between, this filtration is failing.

The field in my file on which i am doing an operation is a name field. So if there is a name like

Code:

Mr Bade-Miya


It will not come in the output as there is a space in between Mr and Bade.

Please help.

Thanks & Regards
bade_miya
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Thu Jun 28, 2007 3:09 am    Post subject: Reply with quote

bade_miya
Code:
SORT FIELDS=(1,20,CH,A)       
INCLUDE COND=(2,1,SS,EQ,C'''-')

Here the include condition is checking only in the 2nd position, so it include only the 1st and 2nd records.
You need to understand the Sort cards!
For the example that you have shown, this should work
Code:
//SORTIN   DD *                                                         
1-CD                                                                   
2'                                                                     
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
BCD    -                                                               
BCD                                                                     
BCD    '                                                               
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
           SORT FIELDS=(1,20,CH,A)                                     
           INCLUDE COND=(2,10,SS,EQ,C'''',OR,2,10,SS,EQ,C'-')           
/*                                                                     

Now, the SORTOUT contains,
Code:
BCD    -
BCD    '
1-CD     
2'       

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Jun 28, 2007 3:36 am    Post subject: Reply with quote

Hi krisprems,

Thanks a lot for your help. Indeed that was a very stupid mistake i did. Embarassed

Again thanks krisprems and Frank for your help.

Regards
bade_miya
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jun 28, 2007 9:37 am    Post subject: Reply with quote

bade_miya,

Krisprems is right. You didn't say that wanted to look for ' or - in the entire record and you showed 2,1 so I assumed you just wanted to look for ' or - in position 2. Please try to be clearer about your requirements in the future.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Thu Jun 28, 2007 1:47 pm    Post subject: Reply with quote

bade_miya,
When ever I get the special characters for include or omit ,I generally use to convert them in to their HEX FORMAT and use them in the SORT card.This way you can over come the trouble for using the special characters.


Thank you
Bprasanna
Back to top
View user's profile Send private message
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