Skip to main content

Problem:

Taking a program which contains DB2 SQL from the mainframe to Unix gives the following precompiler error when using the SET statement to assign a value to a host variable.

Error:

COBDB0100S SQL0104N  An unexpected token ":WW-USERID    = USER" was found following "SET ".  Expected tokens may include:  "<space>".  SQLSTATE=42601

Example SQL:

EXEC SQL

    SET :WW-USERID = USER

END-EXEC

Resolution:

DB2 UDB doesn't support DB2 SET the way it does on the mainframe - you should be using the VALUES INTO statement which is equivalent.

So, the above SQL statements can be changed to:

EXEC SQL

    VALUES(USER) INTO :WW-USERID

END-EXEC

Old KB# 4521

#Enterprise
#ServerExpress
#MainframeExpressandMFE
#EnterpriseDeveloper
#COBOL
#MFDS