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

vsam key case sensitive


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Jan 21, 2011 8:59 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 21, 2011 9:13 pm
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: 1788
Location: Bloomington, IL

PostPosted: Fri Jan 21, 2011 10:34 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts CVDA value for RRDS VSAM dataset. CICS 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top