Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
vsam key case sensitive

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
lineesh_kumar

New User


Joined: 20 Feb 2006
Posts: 6

PostPosted: Fri Jan 21, 2011 8:48 pm    Post subject: vsam key case sensitive
Reply with quote

I have a vsam with key of 100 BYTE CHARACTER. I am trying to read the vsam file, I can see the key already there in the file but is returning the code 23, key not found. I found the reason being the key case sensitive. The vsam key is "Yes", if I pass "yes" as the key for the read, it is not returning any records. But if I pass "Yes" it returns the record. I know the mainframe is not case sensitive and I can convert the cases in COBOL. But it look likes the VSAM key is case sensitive. Is there a way I can avoid this case issue when reading the VSAM file from the COBOL program.

The replies are appreciated.

Lineesh
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Fri Jan 21, 2011 8:59 pm    Post subject:
Reply with quote

The issue is not case senstivity -- it is that VSAM keys are hexadecimal values.

In hex on the mainframe, yes is X'A885A2'
In hex on the mainframe, Yes is X'E885A2'
In hex on the mainframe, YES is X'E8C5E2'

Use the correct hexadecimal value for your read, you'll get the key back. Use the wrong hexadecimal value for your read, the key will not be found. You can either convert all characters to one case (upper or lower) before writing to the VSAM file, or you'll have to handle this issue in your application programming.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 21, 2011 9:13 pm    Post subject: Reply to: vsam key case sensitive
Reply with quote

If the key is case-sensitive, then you have no other choice than to comply.

If the key contained packed-decimal, such as byte equal to X'81', which is a lower-case 'a', then an upper-case translation (to X'C1') would be in error and raise a '23' also.

Your can load your working-storage key with 'Yes' using hex-notation, such as -
Code:

03  WS-VSAM-KEY         PIC  X(03).

MOVE X'E885A2'              TO WS-VSAM-KEY.

No translation required.

Bill
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1775
Location: Bloomington, IL

PostPosted: Fri Jan 21, 2011 10:34 pm    Post subject: Re: vsam key case sensitive
Reply with quote

lineesh_kumar wrote:
I know the mainframe is not case sensitive

Your "knowledge" is faulty; it has been decades (at least) since no mainframe functions had case sensitivity. Too many mainframe programmers still write everything in UPPER CASE out of inertia, a desire to have the results look "mainframy", or, as in your case, a misapprehension of what is doable.
Quote:
and I can convert the cases in COBOL. But it look likes the VSAM key is case sensitive. Is there a way I can avoid this case issue when reading the VSAM file from the COBOL program.

You need to agree on the rules with the creator(s) of the records. "YES", "Yes", "yes", and even "yES" are logical values to check for, but what about "yeS" and "YeS"? Permutations of upper and lower-case characters are simple on "yes", but what if the key is "antidisestablishmentarianism"? What editing is being done on the before the record is written (e.g., are all permutations of "yes" -- or "Rumplestiltzkin" -- converted to all one case)?
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
No new posts RFE: DB2 support for mixed case names. Pedro DB2 0 Tue Jul 04, 2017 1:32 am
No new posts VSAM Space Allocation mrgnndhmk JCL & VSAM 7 Sat Apr 22, 2017 12:42 am
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us