If the search is for whole-words only - i.e. to exclude phrases like
'Special Order Only' then you can set up a dict item like
1: V
2: CONVERT(" ",@VM,OP.SPEC)
3:
4: TechSpecWords
5: 20L
6: M
And then do a statement like
SELECT IM WITH OP.SPEC = "MIL""Spec""SPEC""-14"
There's a hardwired limit on the number of words you can include in the
search. MATCHES won't help unless the format of the part.numbers is
consistent and you are searching for ranges rather than many discrete
values, in which case it could be used in conjunction with some form of
bounds checking.
If the searches are predetermined you could set up files with the words
to match on and have the dictionary item above translate through to the
file and return a 1 if the word is found, 0 otherwise:
2: CONVERT(" ",@VM,OP.SPEC);TRANS("LOOKUP.FILE",@,0,"X");IF @="" THEN 0
ELSE 1
Then it would be a case of
SELECT IM WITH OP.SPEC = "1"
and there'd be no limit on the number of words you could match on -
wouldn't be very fast though!
Edward
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Brutzman, Bill
Sent: 13 March 2009 14:40
To: [email protected]
Subject: [U2] - UniBasic String Search
I need to examine fields for perhaps one thousand part.numbers looking
for tech specs that contain character strings like
"MIL"
"Spec"
"SPEC"
"-14" etc
While I can do this with commands like... execute 'SELECT IM WITH
OP.SPEC LIKE "...-14..." ', this technique is awkward since I have a few
dozen strings to look for...
I have the IBM tech manual describing the MATCH operator and the
MATCHFIELD function. Is there a handy UniBasic method to handle this or
should I write a little program to do this myself?
Fixes would be appreciated.
--Bill
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------------------------------------------------------------------------------------------
Please remember to recycle wherever possible.
Reduce, reuse, recycle, think do you need to print this e-mail?
-------------------------------------------------------------------------------------------
This e-mail and any attachment(s), is confidential and may be legally
privileged. It is intended solely for the addressee. If you are not the
addressee, dissemination, copying or use of this e-mail or any of its content
is prohibited and may be unlawful. If you are not the intended recipient please
inform the sender immediately and destroy the e-mail, any attachment(s) and any
copies. All liability for viruses is excluded to the fullest extent permitted
by law. It is your responsibility to scan or otherwise check this email and any
attachment(s). Unless otherwise stated (i) views expressed in this message are
those of the individual sender (ii) no contract may be construed by this
e-mail. Emails may be monitored and you are taken to consent to this
monitoring.
Civica Services Limited, Company No. 02374268; Civica UK Limited, Company No.
01628868
Both companies are registered in England and Wales and each has its registered
office at 2 Burston Road, Putney, London, SW15 6AR.
-------------------------------------------------------------------------------------------
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/