Examples of CALL statements

These examples show how the arguments of the CALL statement are passed to the procedure for several languages. They also show how to receive the arguments into local variables in the procedure.

The first example shows the calling ILE C program that uses the CREATE PROCEDURE definitions to call the P1 and P2 procedures. Procedure P1 is written in C and has 10 parameters. Procedure P2 is written in PL/I and also has 10 parameters.

Assume two procedures are defined as follows:

EXEC SQL CREATE PROCEDURE P1 (INOUT PARM1 CHAR(10),
                               INOUT PARM2 INTEGER,
                               INOUT PARM3 SMALLINT,
                               INOUT PARM4 FLOAT(22),
                               INOUT PARM5 FLOAT(53),
                               INOUT PARM6 DECIMAL(10,5),
                               INOUT PARM7 VARCHAR(10),
                               INOUT PARM8 DATE,
                               INOUT PARM9 TIME,
                               INOUT PARM10 TIMESTAMP)
           EXTERNAL NAME  TEST12.CALLPROC2
           LANGUAGE C GENERAL WITH NULLS

EXEC SQL CREATE PROCEDURE P2 (INOUT PARM1 CHAR(10),
                               INOUT PARM2 INTEGER,
                               INOUT PARM3 SMALLINT,
                               INOUT PARM4 FLOAT(22),
                               INOUT PARM5 FLOAT(53),
                               INOUT PARM6 DECIMAL(10,5),
                               INOUT PARM7 VARCHAR(10),
                               INOUT PARM8 DATE,
                               INOUT PARM9 TIME,
                               INOUT PARM10 TIMESTAMP)
           EXTERNAL NAME  TEST12.CALLPROC
           LANGUAGE PLI GENERAL WITH NULLS