Posted: Wed Jun 27, 2007 3:49 pm Post subject: Exclude special characters in sort
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.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Jun 27, 2007 4:05 pm Post subject:
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
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Jun 27, 2007 6:42 pm Post subject:
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
Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
Posted: Thu Jun 28, 2007 3:09 am Post subject:
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
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Jun 28, 2007 9:37 am Post subject:
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:
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.
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