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
 

 

IMS wildcard?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
View previous topic :: :: View next topic  
Author Message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Fri Aug 12, 2011 6:46 pm    Post subject: IMS wildcard?
Reply with quote

Can you do a wild card search in IMS? similar to WHERE SEARCHTERM LIKE %123% in DB2?
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Aug 12, 2011 7:23 pm    Post subject:
Reply with quote

You mean while browsing IMS DB using IMS File-Aid or...?
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Fri Aug 12, 2011 9:05 pm    Post subject:
Reply with quote

while querying an IMS database from a COBOL program using a qualified SSA
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Sat Aug 13, 2011 12:06 am    Post subject:
Reply with quote

You are possibly talking about a generic search - providing a partial key to position before the first segment matching that partial key and then doing a GN to retrieve the actual segment and continuing until you get the segment that you want. Yes/No?
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Sat Aug 13, 2011 1:23 am    Post subject:
Reply with quote

It's more tricky than SQL. It also depends on the structure of the database, or if it has an index. Also if the keys are unique or non-unique.

You can do a leading match, (LIKE 123%) but not a middle match (LIKE %123%). But only with an index or a HIDAM. If you try it with an HDAM, you will probably not get what you want.

One thing to remember is that an SSA starts over with each Boolean OR. So
A>0 and B=1 or B=2 won't work right. you need to repeat some things
A>0 and B=1 or A>0 and B=2.

Tell us if you're talking about key fields or search fields.
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Tue Aug 16, 2011 7:03 pm    Post subject:
Reply with quote

There are 2 fields in the database I want to perform a wildcard search with. One is Indexed and one is not.
I am new to IMS so you may have to spell it out for me. When you say you can do LIKE, do you mean that instead of EQ, GE, LE, etc in the SSA, if is possible to say like? So, is the below a valid SSA?


Code:

01  OIPSSSA1.                                               
    05  OISPD001-SSA            PIC X(8) VALUE 'DBNAMEXX'. 
    05  OI1-SEG-QUAL-1          PIC X(1) VALUE '('.         
    05  OI1-SEG-NAME-1          PIC X(8) VALUE 'KEYNOXXX '. 
    05  OI1-OP-CODE-1           PIC X(2) VALUE 'LIKE'.       
    05  OI1-KEY-VALUE-1         PIC 9(11) VALUE ZEROES.     
    05  OI1-END-QUAL-1          PIC X(1)  VALUE ')'.       


then I can move 123% to OI1-KEY-VALUE-1?
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Tue Aug 16, 2011 8:52 pm    Post subject:
Reply with quote

Nope, you'll need to use the usual SSA operators. Can you give me the segment name, field names and their definitions?

It will look more like this:


Code:
DBNAMEXX*---(KEYNOXXXGE00000000000)


with two fields:
Code:

DBNAMEXX*---(KEYNOXXXGE00000000123*OTHERKEYEQVALUE2)
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Tue Aug 16, 2011 11:23 pm    Post subject:
Reply with quote

what is OTHERKEYEQVALUE2? I don't have a second key value...
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Wed Aug 17, 2011 12:56 am    Post subject:
Reply with quote

This was because you said
Quote:
There are 2 fields in the database I want to perform a wildcard search with
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Wed Aug 17, 2011 1:12 am    Post subject:
Reply with quote

oh sorry! I think I am having trouble understanding how GE (which is Greater than or equal to) works as a LIKE statement.

A LIKE statement looks for anything matching a pattern you give it. Greater Than, to me, implies the comparison against a number. These are two completely different things.

Let's say that I am wanting to query an IMS database for a Customer Number that is alpha-numeric and I only have 3 customers. They are
A12B456
B34T567
R76N000
now if I can say LIKE A12% I should get back A12B456
but if I am saying GE A12.... what am I going to get?
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Wed Aug 17, 2011 2:07 am    Post subject:
Reply with quote

Ah...
You would get all of them, because they are all GE your query.

You would have to say

Code:

DBNAMEXX*---(KEYNOXXXGEA12....*KEYNOXXXLEA12????)

where .... is low values and ???? is high values. This works really well if the KEYNOXXX is the single index field. It still works if the database is HIDAM and this is the primary key. If the database is HDAM, it won't really work if you're going against the database directly (not through an index).
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 -> IMS DB/DC All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm
No new posts Using Wildcard for PDS names with PDS... PokerGuru CA Products 1 Fri May 22, 2015 2:30 pm
No new posts Avoid trailing wildcard in Personal D... kobus kuch TSO/ISPF 4 Thu Sep 08, 2011 3:27 pm
No new posts Concatenating/sweeping datasets based... dcshnier JCL & VSAM 13 Tue Sep 21, 2010 12:25 am
This topic is locked: you cannot edit posts or make replies. Wildcard Search in REXX Pandora-Box CLIST & REXX 21 Thu Jul 30, 2009 2:32 pm


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