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

IMS wildcard?


IBM Mainframe Forums -> IMS DB/DC
Post new topic   Reply to topic
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
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

Superior Member


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

PostPosted: Fri Aug 12, 2011 7:23 pm
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
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: 2455
Location: Hampshire, UK

PostPosted: Sat Aug 13, 2011 12:06 am
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> IMS DB/DC

 


Similar Topics
Topic Forum Replies
No new posts Need help to concatenate files with w... All Other Mainframe Topics 3
No new posts Wildcard logic in COBOL COBOL Programming 13
No new posts Using Wildcard for PDS names with PDS... CA Products 1
No new posts Avoid trailing wildcard in Personal D... TSO/ISPF 4
No new posts Concatenating/sweeping datasets based... JCL & VSAM 13
Search our Forums:

Back to Top