TRAP151= Data Set Option

Enables removal of columns that cannot be updated from a FOR UPDATE OF clause so that update of columns can proceed as normal.
Valid in: DATA and PROC steps (when accessing DBMS data using SAS/ACCESS software)
Default: NO
Data source: DB2 under z/OS

Syntax

TRAP151=YES | NO

Syntax Description

YES
removes the non-updatable column that is designated in the error-151 and reprepares the statement for processing. This process is repeated until all columns that cannot be updated are removed, and all remaining columns can be updated.
NO
disables TRAP151=. TRAP151= is disabled by default. It is not necessary to specify NO.

Examples

Example 1: SAS Log for TRAP151=YES

In this example, DB2DBUG is turned on so that you can see what occurs when TRAP151=YES:
proc fsedit data=x.v4(trap151=yes);
run;
SELECT * FROM V4 FOR FETCH ONLY
SELECT * FROM V4 FOR FETCH ONLY
SELECT "A","X","Y","B","Z","C" FROM V4 FOR UPDATE OF "A","X","Y","B","Z","C"
DB2 SQL Error, sqlca->sqlcode=-151
WARNING: SQLCODE -151: repreparing SELECT as:
  SELECT "A","X","Y","B","Z","C" FROM V4 FOR UPDATE OF "A","Y","B","Z","C"
DB2 SQL Error, sqlca->sqlcode=-151
WARNING: SQLCODE -151: repreparing SELECT as:
  SELECT "A","X","Y","B","Z","C" FROM V4 FOR UPDATE OF "A","B","Z","C"
DB2 SQL Error, sqlca->sqlcode=-151
WARNING: SQLCODE -151: repreparing SELECT as:
  SELECT "A","X","Y","B","Z","C" FROM V4 FOR UPDATE OF "A","B","C"
COMMIT WORK
NOTE:  The PROCEDURE FSEDIT used 0.13 CPU seconds and 14367K.

Example 2: SAS Log for TRAP151=NO

The next example features the same code with TRAP151 turned off:
proc fsedit data=x.v4(trap151=no);
run;
SELECT * FROM V4 FOR FETCH ONLY
SELECT * FROM V4 FOR FETCH ONLY
SELECT "A","X","Y","B","Z","C" FROM V4 FOR UPDATE OF "A","X","Y","B","Z","C"
DB2 SQL Error, sqlca->sqlcode=-151
ERROR: DB2 prepare error;  DSNT4081 SQLCODE= —151, ERROR;
   THE UPDATE STATEMENT IS INVALID BECAUSE THE CATALOG DESCRIPTION OF COLUMN C
   INDICATES THAT IT CANNOT BE UPDATED.
COMMIT WORK
NOTE:  The SAS System stopped processing this step because of errors.
NOTE:  The PROCEDURE FSEDIT used 0.08 CPU seconds and 14367K.