Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Wild card searching using TBSARG

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
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    Post subject: Wild card searching using TBSARG
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: 1738
Location: Bloomington, IL

PostPosted: Thu Sep 23, 2010 7:54 pm    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 7:55 pm    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 8:01 pm    Post subject:
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    Post subject:
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 -
http://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: 645
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 8:25 pm    Post subject:
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    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Thu Sep 23, 2010 8:36 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri Sep 24, 2010 7:51 pm    Post subject: Reply to: Wild card searching using TBSARG
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: 645
Location: Pennsylvania

PostPosted: Fri Sep 24, 2010 8:14 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Sep 27, 2010 8:59 am    Post subject: Reply to: Wild card searching using TBSARG
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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts Performing addition using JCL sort card Shaheen Shaik DFSORT/ICETOOL 14 Fri May 06, 2016 12:25 pm
No new posts Retrieve current year or month using ... vnktrrd DFSORT/ICETOOL 15 Tue Mar 15, 2016 4:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us