VSAM Wildcard search.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

VSAM Wildcard search.

Postby karuppusamy » Fri Apr 30, 2010 11:14 pm

Hi , Could any one please let me know how to perform the wilcard search in a cobol program over a VSAM file.
karuppusamy
 
Posts: 4
Joined: Fri Apr 30, 2010 11:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM Wildcard search.

Postby William Thompson » Fri Apr 30, 2010 11:19 pm

A wildcard search of what? Data? Filenames?
More info is needed.
William Thompson
 
Posts: 81
Joined: Sat Jun 09, 2007 4:24 am
Location: Tucson AZ
Has thanked: 0 time
Been thanked: 1 time

Re: VSAM Wildcard search.

Postby dick scherrer » Fri Apr 30, 2010 11:44 pm

Hello and welcome to the forum,

An approach that works well for most questions is to show what you "have" and what you want from what you have. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: VSAM Wildcard search.

Postby karuppusamy » Sat May 01, 2010 7:50 am

hello,

Using a cobol program i need to do a wild char search on the VSAM file on the key...Please find below more example below.

VSAM File (first ten characters are key).

abcd#12345 123456
efgh#67890 124353
efgh#09876 1243535
ijkl#23456 fadsjfasd
ijkl#87654 afewiori

When i search for efgh then the second and third record needs to be returned.

Could any one help in achieving this please.

Thanks in advance.
karuppusamy
 
Posts: 4
Joined: Fri Apr 30, 2010 11:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM Wildcard search.

Postby dick scherrer » Sat May 01, 2010 8:18 am

Hello,

abcd#12345 123456
efgh#67890 124353
efgh#09876 1243535
ijkl#23456 fadsjfasd
ijkl#63456 fefghfasd
ijkl#87654 afewiori

If the input was changed to this, should record 5 be a "hit" also?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: VSAM Wildcard search.

Postby karuppusamy » Sat May 01, 2010 12:05 pm

Hello,

No, as the efgh is not the part of the key i don't want the record 5 to hit... Only record 2 and 3 needs to be hit and choosen.

awaiting for a help pls.

-Thiru
karuppusamy
 
Posts: 4
Joined: Fri Apr 30, 2010 11:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM Wildcard search.

Postby dick scherrer » Sat May 01, 2010 2:46 pm

Hello,

One more time. . .

No, as the efgh is not the part of the key
What about this (#4)?

abcd#12345 123456
efgh#67890 124353
efgh#09876 1243535
ijkefgh456 fadsjfasd
ijkl#63456 fefghfasd
ijkl#87654 afewiori

The efgh is part of the #4 key. . .

awaiting for a help pls.
If you pester, you may have a much longer wait. . .

Over time, the ability to post most (if not all) of the information needed on the initial post will be gained and make getting answers quicker. Keep in mind that no one here knows the requirement until you clearly describe it.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: VSAM Wildcard search.

Postby Robert Sample » Sat May 01, 2010 6:37 pm

What is the key starting position? What is the key length? You keep NOT providing critical information -- yet you want us to read your mind and resolve your issue with telepathy?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: VSAM Wildcard search.

Postby karuppusamy » Sat May 01, 2010 11:42 pm

My apologies for not share the enough details...

Using a cobol program i need to search on the VSAM file over the key...Please find below more example below.

VSAM File and its contents (first ten characters are key), starting position is 1 and ending position is 10.

abcd#12345 123456
efgh#67890 124353
efgh#09876 1243535
ijkefgh456 fadsjfasd
ijkl#23456 fadefghsjfasd
ijkl#87654 afewiori

When i search for efgh then the only second and third record needs to be returned. No other records should be returned.

Please advise whether it is possible to achieve it.

-Karu.
karuppusamy
 
Posts: 4
Joined: Fri Apr 30, 2010 11:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM Wildcard search.

Postby dick scherrer » Sun May 02, 2010 12:16 am

Hello,

Yes, you can do what you want via the key (rather than needing to pass the entire file).

Suggest you define a 10-byte WS field that contains efgh followed by low-values.

Start the VSAM file at that value (the 10-byte ws field) and read next until the retrieved key no longer begins with efgh.

This may help:
http://publib.boulder.ibm.com/infocente ... pvsm25.htm
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post