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 

Syncsort : Problem with multiple substring search.

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


Joined: 20 Dec 2006
Posts: 18
Topics: 7
Location: Chennai

PostPosted: Wed Sep 19, 2007 6:37 am    Post subject: Syncsort : Problem with multiple substring search. Reply with quote

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?

Any and all help greatly appreciated.

Thanks!
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Wed Sep 19, 2007 6:56 am    Post subject: Reply with quote

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.

Does that help?
Back to top
View user's profile Send private message
Prabakar_S
Beginner


Joined: 20 Dec 2006
Posts: 18
Topics: 7
Location: Chennai

PostPosted: Wed Sep 19, 2007 9:13 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Wed Sep 19, 2007 9:24 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Wed Sep 19, 2007 9:31 am    Post subject: Reply with quote

Code:

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
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Sep 19, 2007 10:44 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Prabakar_S
Beginner


Joined: 20 Dec 2006
Posts: 18
Topics: 7
Location: Chennai

PostPosted: Wed Sep 19, 2007 2:18 pm    Post subject: Reply with quote

CICS Guy, Alissa & Frank -
Thanks for all your helpful replies...
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