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.
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
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.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
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 -
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
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)?