Joined: 20 Dec 2006 Posts: 18 Topics: 7 Location: Chennai
Posted: Wed Sep 19, 2007 6:37 am Post subject: Syncsort : Problem with multiple substring search.
Hi,
Please consider the following sample i/p (LRECL=80, RECFM=FB):
Code:
MATCH STRING SECOND STRING
MTACH STRING SECOND STRING
MATCH STRING THIRD STRING
NOT MATCHED SECOND STRING
I would like to fetch the records which contain the following phrases:
1) Either 'MATCH STRING' or 'MTACH STRING' - the data is assumed to be mis-spelt
2) and, 'SECOND STRING'
The required output
Code:
MATCH STRING SECOND STRING
MTACH STRING SECOND STRING
The following code returns and empty output:
Code:
SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,EQ,C'MATCH STRING,MTACH STRING',AND,
1,80,SS,EQ,C'SECOND STRING')
But I get the desired result when the include cond is broken like this:
Code:
SORT FIELDS=COPY
INCLUDE COND=((1,80,SS,EQ,C'MATCH STRING',OR,
1,80,SS,EQ,C'MTACH STRING'),AND,
1,80,SS,EQ,C'SECOND STRING')
Can someone let me know why the first code did not meet this requirement?
The difference between
Match occurrence of a constant within a record field
and
Match occurrence of a record field within a constant
INCLUDE COND=(11,60,EQ,C'ANYTOWN',
OR,121,3,EQ,C'A01,A05,A06,A09'),FORMAT=SS
The literal 'ANYTOWN' is found in the 60-byte field starting at position 11 in the record.
The contents of the 3-byte field starting at position 121 matches one of the four substrings ('A01', 'A05', 'A06', or 'A09') in the constant.
Joined: 20 Dec 2006 Posts: 18 Topics: 7 Location: Chennai
Posted: Wed Sep 19, 2007 9:13 am Post subject:
Thanks, CICS Guy..
But what I wud like to know is... why my first cntlcard failed doing what my second cntlcard does... Logically, both should do the same thing... Am I missing any fact about how a SS works?
Reread my post...
Your first attempt was trying to use the literal list for "Match occurrence of a record field within a constant" without specifying the specific field start position and length.
Your second attempt was correctly using multiple litterals for "Match occurrence of a constant within a record field" where all you need to do is specify the starting position and length of the area to be searched for a match.
INCLUDE COND=(1,80,SS,EQ,(C'MATCH STRING',C'MTACH STRING'),...)
Support for simplifying INCLUDE/OMIT statements with EQ/OR and NE/AND when the same field is being compared to multiple constants was included in SyncSort for z/OS 1.3, which is currently in Early Support.
However, please note that I have tweaked the original statement to include additional quotes and parenthesis. _________________ Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Sep 19, 2007 10:44 am Post subject:
Quote:
I would like to fetch the records which contain the following phrases:
1) Either 'MATCH STRING' or 'MTACH STRING' - the data is assumed to be mis-spelt
1,80,SS,EQ,C'MATCH STRING,MTACH STRING'
Can someone let me know why the first code did not meet this requirement?
Prabakar_S,
Because that SS condition looks for the characters MATCH STRING,MTACH STRING. It does NOT look for MATCH STRING or MTACH STRING. There are two forms of the SS condition, e.g.
1) 1,3,SS,EQ,C'ABC,DEF,GHI'
In this form (character string length greater than field length), SS checks the field for each group of three characters. So first it checks the field for 'ABC', then 'BC,' and so on. The comma is not really a delimiter - it's just a way to separate the needed groups of 3 characters.
2) 1,80,SS,EQ,C'ABC,DEF,GHI'
In this form (field length greater than character string length), SS checks for the complete string everywhere in the record. So first it checks 1-11 for 'ABC,DEF,GHI', then it checks 2-12 and so on. The comma is just a character - it's not a delimiter or group separator. This is the form you're using and explains why it didn't do what you thought it would. Your second condition with the ORs does what you want. _________________ 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
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