Page 1 of 1

VSAM Wildcard search.

PostPosted: Fri Apr 30, 2010 11:14 pm
by karuppusamy
Hi , Could any one please let me know how to perform the wilcard search in a cobol program over a VSAM file.

Re: VSAM Wildcard search.

PostPosted: Fri Apr 30, 2010 11:19 pm
by William Thompson
A wildcard search of what? Data? Filenames?
More info is needed.

Re: VSAM Wildcard search.

PostPosted: Fri Apr 30, 2010 11:44 pm
by dick scherrer
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. . .

Re: VSAM Wildcard search.

PostPosted: Sat May 01, 2010 7:50 am
by karuppusamy
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.

Re: VSAM Wildcard search.

PostPosted: Sat May 01, 2010 8:18 am
by dick scherrer
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?

Re: VSAM Wildcard search.

PostPosted: Sat May 01, 2010 12:05 pm
by karuppusamy
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

Re: VSAM Wildcard search.

PostPosted: Sat May 01, 2010 2:46 pm
by dick scherrer
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.

Re: VSAM Wildcard search.

PostPosted: Sat May 01, 2010 6:37 pm
by Robert Sample
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?

Re: VSAM Wildcard search.

PostPosted: Sat May 01, 2010 11:42 pm
by karuppusamy
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.

Re: VSAM Wildcard search.

PostPosted: Sun May 02, 2010 12:16 am
by dick scherrer
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