Reading VSAM file

Hi all,

We are reading a VSAM file for the record where PRIM-KEY consists of account-nr P17 + serial of P5.
Layout:
1 PRIM-KEY B12 /* This is the index

This matches the underlying copybook as indicated below:

01 :ACNT:-LOCT-REC.
– 03 :ACNT:-LOCT-MAIN-REC.
-------05 :ACNT:-NUMBER-KEY.
----------10 :ACNT:-NUMBER PIC S9(17) COMP-3.
----------10 :ACNT:-SERIAL PIC S9(5) COMP-3.

The issue we find is that no exact match seems possible:

For us to locate account 209072970 with serial number 0, we actually have to read starting at 209072969 (one less than value we are looking for). I have never come across this (but have not dealt with VSAM much).

Any help would be much appreciated.

When you read the account 209072970 (after starting from one less), write out the value in Hex.

Also, write out the starting value (have you specified it as a constant, or a variable?) in hex.

steve

you have two packed numbers in that binary field. In Natural, redefine the B12 to match your copy book:

01 PRIM-KEY (B12)
01 REDEFINE PRIM-KEY
02 ACCT-NUMBER (P17)
02 SERIAL-NUMBER (P5)

This will allow you do do exact searches on the VSAM file key. You may also have a mismatch of packed sign fields. If you do as Steve suggests (print the hex values of the PRIM-KEY), you can see if the sign is F or C and set the PSIGNF parameter accordingly (default is H’C’).