Some Common Causes of Logical Errors

The error condition that is associated with each feedback code is briefly described in the list of the VSAM feedback codes. The codes in this list represent decimal values.
IBM documentation describes many VSAM feedback codes that are not returned to your SAS program. This is because the SAS VSAM interface looks for many error conditions before it passes requests to VSAM. A VSAM feedback code cannot be returned when SAS detects an error before it invokes VSAM. Instead, SAS prints a message that describes the error on the SAS log and stops the DATA step.
You get VSAM logical errors and, therefore, VSAM feedback codes if the following occurs:
  • SAS cannot detect the error in advance (for example, user lockout).
  • SAS does not know what action to take (for example, record not found).
Check the return codes as previously outlined and design your programs to take appropriate action for the various error conditions.
VSAM Feedback Codes and Error Descriptions
Feedback Code
Error Description
4
An end of data set was encountered (during sequential or skip sequential retrieval), or the search argument is greater than the high key of the data set.
8
You attempted to store a duplicate alternate key for an alternate index with the unique key option, or you attempted to store a record with a duplicate primary key. (For an ESDS accessed through an alternate index or a KSDS.)
12
Records were not in key sequence when they are required to be. You are probably trying to load the file out of key order. VSAM requires a KSDS to be loaded in key order (for a KSDS).
16
Record not found. This means that you attempted one of two things:
  • You tried to retrieve a record with a key that does not exist in the file (for a KSDS).
  • You tried to retrieve a record with a relative record number that corresponds to an empty slot (for an RRDS). Also see feedback code 192.
20
User lockout occurred because someone else is concurrently accessing the file and has exclusive use of the control interval that you need.
This feedback code is also returned if you read a record and then try to add a new record to the same control interval. (You can avoid this situation by specifying an UPDATE=0 before you read the record.)
32
You have requested a record by RBA, and there is no record with the address given by the RBA= variable (for a KSDS or an ESDS).
36
Key ranges were specified for the data set when it was defined, and the record that you want to add has a key that is not within one of those key ranges (for a KSDS).
72
You attempted to access only the data portion of the VSAM cluster.
88
A request was issued for which VSAM was not properly positioned. This error code is almost always the result of lost positioning that is due to a previous logical error.
96
You attempted to change either the primary key or the key of reference while updating a record. This error occurs only if you access a KSDS through an alternate index and attempt to change the primary key while updating a record (for a KSDS).
If you change the primary key while using it to access a KSDS, or if you change the key of reference while accessing the data set through an alternate index, SAS assumes that you intend for the record to be a new record (if the new key is not a duplicate).
108
You tried to write a record that is too small to contain the full key (for a KSDS). Your SAS program probably has not completed the following:
  • copied the input record to the PUT buffer with a PUT _INFILE_ @ statement
  • built the key in the PUT buffer when creating a new record
  • built the key in the correct position in the record
A good way to ensure that the key is in the correct position is to use the variable specified by the KEYPOS= option.
192
You have specified an invalid relative-record number with the RRN= variable. An invalid RRN is one that does not represent a slot within the file. If you specify the RRN of an existing but empty slot, the feedback code is 16 instead of 192 (for an RRDS).