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

Wild card searching using TBSARG


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Thu Sep 23, 2010 6:58 pm
Reply with quote

I have an ISPF table like this:

TABLE1

Code:
COL1  COL2
+++++ ---------------------------
33aaa a cat
44bbb another cat
44ccc another cat which is great
55aaa cat
66ccc cat is white


I'm trying to read COL2 for those rows having a string "cat" in any position.

This is what I have tried -

Code:
COL2 = ""                                       

"TBOPEN TABLE1 NOWRITE SHARE"                     
"TBVCLEAR TABLE1"                                 

 COL2 = "*" || "cat" || "*"                         

 "TBSARG TABLE1 NEXT NAMECOND(COL2,EQ)"     
 
"TBDISPL TABLE1 PANEL(PANEL1)"         
"DISPLAY PANEL(PANEL1)"


My panel MODEL section is like this:

Code:
)MODEL ROWS(SCAN)             
    @COL2

But no rows returned. All I can see is *cat* in the panel.
-------------

I have tried with
Code:
 COL2 = "cat" || "*"   


Then i'm getting this in the panel - which is correct -

Code:
cat
cat is white



Why *cat* wild-card not working while cat* is working? It'll be great if someone can help. Thanks.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Thu Sep 23, 2010 7:54 pm
Reply with quote

TBSARG supports the asterisk-as-wildcard only as a suffix; prefixed or infixed asterisks are treated as literals.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 7:55 pm
Reply with quote

Is there a space before your || and a space afterwards?

Then you are looking for * space space cat.

No data matches that, correct?
Quote:

COL2 = "*" || "cat" || "*"
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 8:01 pm
Reply with quote

Akatsukami is correct.

I should have read the manual before I posted.

maybe arindam111 should have done so as well?
Back to top
View user's profile Send private message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Thu Sep 23, 2010 8:20 pm
Reply with quote

Is there any other way to achieve this in ISPF table services? Only one way I can think of - TBSCAN the entire table - parse it through rexx - put it to a stem and pass it to panel. This will be ugly way.


@daveporcelan:
I found it on the manual -
publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.f54sg00/ispzsg60519.htm

But nothing is mentioned regarding prefix or infix.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 8:25 pm
Reply with quote

Maybe it is not so clear?

Quote:

A search argument of the form AAA* means that only the characters up to the asterisk (*) are compared. This is called a generic search argument. A generic search argument is specified by placing an asterisk in the last nonblank position of the argument. Asterisks embedded in the argument are treated as data. For example, to perform a generic search for a row value of DATA*12, the generic search argument is:

DATA*12*The first asterisk is part of the search argument. The second asterisk designates the argument to be a generic search argument
Back to top
View user's profile Send private message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Thu Sep 23, 2010 8:30 pm
Reply with quote

Ohh! I missed that. Thanks.

But any other way you can think of?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 8:36 pm
Reply with quote

I think you are on the right track with your solution.

Rather than using a stem, create a temporary ispf table, when you scan and parse, do a tbadd when you have a match.

Then change your tbdispl for your 'temp' table.

No so ugly, but effective. It depends on the size of your main table I guess.
Back to top
View user's profile Send private message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Thu Sep 23, 2010 8:46 pm
Reply with quote

Okay! I'll try it out. In my requirement, table size would be max 1000. So after pattern matching it will be less than < 1000. I think, this wont be a performance issue in Z/OS system.

Thanks!
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Fri Sep 24, 2010 7:51 pm
Reply with quote

Quote:
Is there a space before your || and a space afterwards?

Then you are looking for * space space cat.


Dave, I do not believe your statement is correct. It will concatenate as it was intended.

My suggestion is similar to Arindam111's. Add an additional column to the table. Use TBSCAN to search one row at a time and if 'cat' is found, set that variable to 1 and do a TBMOD for that row. Then use TBSARG to search that column.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Sep 24, 2010 8:14 pm
Reply with quote

Pedro,

I know I was incorrect, that is why I retracted with the next post:
Quote:

Akatsukami is correct.
I should have read the manual before I posted.


I like your technique for sticking with one table.

If however the search argument changes from cat to dog, the new variable needs to be reset back to zero or all rows prior to a new scan being done.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Mon Sep 27, 2010 8:59 am
Reply with quote

Dave, I apologize for not following the entire thread.

Quote:
the new variable needs to be reset back to zero

Rather than 1 or 0, how about figuring out a unique token and then only display the rows with the matching token. In that way, you do not have to start the search from the top, nor update rows unnecessarily for rows that do not match.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Searching for a member but don't know... TSO/ISPF 6
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
No new posts Need suggestion on a sort card DFSORT/ICETOOL 10
No new posts Want to mask Middle 8 Digits of Debit... COBOL Programming 3
Search our Forums:

Back to Top