The simplest way to execute an arbitrary SQL statement is to use the command EXECUTE IMMEDIATE. For example:
EXEC SQL BEGIN DECLARE SECTION END-EXEC. 01 STMT PIC X(30) VARYING. EXEC SQL END DECLARE SECTION END-EXEC. MOVE "CREATE TABLE test1 (...);" TO ARR OF STMT. COMPUTE LEN OF STMT = FUNCTION STORED-CHAR-LENGTH (ARR OF STMT). EXEC SQL EXECUTE IMMEDIATE :STMT END-EXEC.
EXECUTE IMMEDIATE can be used for SQL statements that do not return a result set (e.g., DDL, INSERT, UPDATE, DELETE). You cannot execute statements that retrieve data (e.g., SELECT) this way. The next section describes how to do that.