The book "SAS/ACCESS® 9.1.3 Supplement for DB2 under z/OS (SAS/ACCESS for Relational Databases" is mentioned as below to call a stored procedure which has out parameters
connect to db2;
create table sasresults as select * from connection to db2
(call STORED_PROC (1,:INOUT,UT));
By referring the above sample I tried to call the stored procedure SASSP0004 but it throws an error as shown below
148 proc sql;
149 connect to db2(user=Iteration1 password=XXXXXXXXXX
151 create table sasresults as select * from connection to db2
152 (call SASSP0004(YS_OUT,0,2852700031)) ;
ERROR: CLI prepare error: [IBM][CLI Driver][DB2/NT] SQL0312N The host variable "SYS_OUT" is used in a dynamic SQL statement, a
view definition, or a trigger definition. SQLSTATE=42618
SQL statement: call SASSP0004(YS_OUT,0,2852700031).
CREATE PROCEDURE SASSP0004 (
OUT SYS_OUT varchar(5),
IN DELIVERY_ID_ST DECIMAL(10,0),
IN DELIVERY_ID_EN DECIMAL(10,0) )
DYNAMIC RESULT SETS 1
DECLARE C1 CURSOR with return FOR SELECT * FROM db2table where delv_id between DELIVERY_ID_ST and DELIVERY_ID_EN;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
SELECT 'SYS' into SYS_OUT FROM SYSIBM.SYSDUMMY1;
Kindly revert with the fix that should be done to the above PROC SQL code.
Not sure if it applies to your problem specifically, but there is a SAS HOTFIX E9D213 which may address your error. Also, the SAS support website http://support.sas.com/ contains useful supplemental reference material and SAS-hosted DOCUMENTATION. Using the SEARCH facility, I found a topic-related technical document (see link below) which also may be useful.
SAS/ACCESS® 9.1.x Interface to DB2 on the Mainframe
Using the LIBNAME Engine