IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Wildcard Search in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu Jul 30, 2009 2:32 pm
Reply with quote

Hi

How to make a wildcard search in REXX?
If I want to do a wild card search in a string like the following, how do to do it REXX?
Code:
'AB****B*'


I'm sure of only First, Second and 7th Character.
I want to figure all the variables like
Code:
'AB1234B5'
'AB4567B3'
'ABSDTTB2'
'AB34VBB7'


the above may be a part of the string like
Code:
'The data is sensitive, AB1234B5 the code'

I wanna find whether anything like 'AB****B*' is present.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jul 30, 2009 2:43 pm
Reply with quote

AFAIK there is no built in functions for a wildcard - so it looks as if you need to code and test your own logic here.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jul 30, 2009 8:29 pm
Reply with quote

If you are trying to acheive it in rexx code

Try some thing like

Code:


SUBSTR(STEM VARIABLE,1,2) = AB  and
SUBSTR(STEM VARIABLE,7,1) = B

 


Just gave a thought having assumtions.

Experts guide me
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 30, 2009 9:29 pm
Reply with quote

Code:

STRING.0 = 4
STRING.1 = 'ABCDEFGHIJKLMB'
STRIN0.2 = 'AB345B789'
STRING.3 = '13456789'
STRING.4 = '1234567890AB3456B789'

KEY_POS_1_2 = 'AB'
KEY_POS_7   =  'B'

    TRACE ?R

DO I = 1 TO STRING.0
   X = POS(KEY_POS_1_2,STRING.I)
   IF X > 0 THEN
      DO
        Y = POS(KEY_POS_7,STRING.I,X+2)
        IF Y > 0 THEN
           DO
             IF Y - X = 6 THEN
                DO
                   SAY 'HIT IN ' STRING.I
                END
           END
      END
END
EXIT


not elegant, but beggers can't be choosers;
they must create their own 'elegant' code.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jul 30, 2009 10:13 pm
Reply with quote

Much better [icon_smile.gif] Thanks dick

but beggers can't be choosers;

wht did you mean by that mind eloborating?

Thanks
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Jul 30, 2009 11:20 pm
Reply with quote

It's a slang term meaning roughly that when you receive something for free, you don't have much of a right to complain about what you get. icon_smile.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Fri Jul 31, 2009 1:34 am
Reply with quote

Take a look at file 656 in CBTTAPE.

O.
Back to top
View user's profile Send private message
cmsmoon

New User


Joined: 17 Jun 2010
Posts: 75
Location: Chennai

PostPosted: Fri May 24, 2013 4:22 pm
Reply with quote

you can use the commands to search string


F ALL P'C==PO'

= -> wildcard charater
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri May 24, 2013 4:36 pm
Reply with quote

The discussion ended nearly four years ago.

Having said that, do you feel that you actually read the question?
Back to top
View user's profile Send private message
cmsmoon

New User


Joined: 17 Jun 2010
Posts: 75
Location: Chennai

PostPosted: Fri May 24, 2013 4:39 pm
Reply with quote

All discussion not ended Acutally.Let have a new Idea for wildcard search!!!
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri May 24, 2013 4:51 pm
Reply with quote

Bill,

That is why Friday is Psychic icon_cool.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri May 24, 2013 4:57 pm
Reply with quote

cmsmoon wrote:
All discussion not ended Acutally.Let have a new Idea for wildcard search!!!

A good pre-condition would be having an idea that works.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 24, 2013 7:08 pm
Reply with quote

Hello,

Quote:
you can use the commands to search string
F ALL P'C==PO'
= -> wildcard charater
Where did you find documentation that says the "=" can be used as a wildcard?

Please do not post an untested/unworking "solution".

Also, when a topic has been dormant for so long, it is best to start a new topic and include the link to the old one if you feel it is necessary/useful.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri May 24, 2013 7:56 pm
Reply with quote

dick scherrer wrote:
Hello,

Quote:
you can use the commands to search string
F ALL P'C==PO'
= -> wildcard charater
Where did you find documentation that says the "=" can be used as a wildcard?

cmsmoon is confusing (to put it politely) Rexx with ISPF Edit; the equals sign is a generic wildcard in picture strings.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed May 29, 2013 2:11 am
Reply with quote

Quote:
confusing (to put it politely) Rexx with ISPF Edit

That is a great idea, Akatsukami: put the text in a file and then edit it with an initial macro that issues the FIND command. VPUT the return code of the FIND so that it can be found later by the caller.

But it is not very practical for a large amount of data to search through.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Tue Aug 09, 2016 9:43 pm
Reply with quote

/* REXX - verify wildcard without going into loop */

WildCard = 'ABC**1**Z'

String = 'We want to find something like ABC001xxZ but not ABC002xxY'

HiMask = Translate( WildCard, 'FF'x, '*' )
LowMask = Translate( WildCard, '00'x, '*' )

Do i = 1 to Words(String)
Single = Word( String, i )
HiSingle = BitAnd( Single, HiMask )
LowSingle = BitOr( Single, LowMask )
If HiSingle == LowSingle Then
Say "Word" Single "found - success!"
End i

return 0
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Aug 09, 2016 10:52 pm
Reply with quote

sergeyken, did you notice that you are responding to a topic with the last post 3 years ago and originally started 7 years ago?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Wed Aug 10, 2016 12:19 am
Reply with quote

Robert Sample wrote:
sergeyken, did you notice that you are responding to a topic with the last post 3 years ago and originally started 7 years ago?

Nevertheless the issue is as important as before.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Aug 10, 2016 12:51 am
Reply with quote

sergeyken wrote:
Robert Sample wrote:
sergeyken, did you notice that you are responding to a topic with the last post 3 years ago and originally started 7 years ago?

Nevertheless the issue is as important as before.

It's a practice Not to answer a question Years after it was asked because:

1. The OP will not be interested in listening after Years of asking the question.

2. More importantly, the technology would/may have changed in those Years. So, the question itself would/may not be valid.

*Think about how you used to travel with Paper maps 10 Years ago. And now you have GPS. The question asked for a paper map would not be valid today And that is why It is Not a good practice to reply to Years old threads.

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Aug 10, 2016 1:25 am
Reply with quote

Quote:
Nevertheless the issue is as important as before.
Along with what RahuldG31 said, You can always start a new post with the tested solution and link this old thread to it instead of waking up the dead thread which would be useful for others. May be this needs to get a lock now.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Aug 10, 2016 2:13 am
Reply with quote

Every time an old thread is wakened we go through this.

It is like ibmmainframes 'groundhog day'.

The 'prince charming' who wakes the sleeping beauty really has no idea they have done anything wrong.

Why is a new thread linking to an old one any better than a new entry in the old thread?

Is there anyway to have the site lock a thread after six months (or a year) of in-activity?

This would take care of all concerns.

Just my opinion on the matter.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Aug 10, 2016 11:49 am
Reply with quote

Topic locked to avoid any further resurrections
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
Search our Forums:

Back to Top