You don't display correctly the error SQL code.
As P in hex = D7, your sql code is -927 meaning
-927 THE LANGUAGE INTERFACE (LI) WAS CALLED WHEN THE CONNECTING
ENVIRONMENT WAS NOT ESTABLISHED. THE PROGRAM SHOULD BE INVOKED
UNDER THE DSN COMMAND
Explanation: In the TSO environment, the user has attempted to execute an application program without first establishing the correct execution
environment by issuing the DSN command. In the IMS, CICS, or call attachment facility (CAF) environment, the user has attempted to execute an
application program that is not using the correct language interface module.
System Action: The statement cannot be executed.
Programmer Response: In the TSO environment, DB2 application programs should be invoked under the RUN subcommand of the DSN
command processor. In the IMS, CICS or CAF environment check that the application was link-edited with or is dynamically allocating the correct
language interface module. The language interface modules required in each environment are as follows: