Using the embedded CALL statement where no procedure definition exists
A static CALL statement without a corresponding CREATE PROCEDURE statement is processed with these rules.
- All host variable arguments are treated as INOUT type parameters.
- The CALL type is GENERAL (no indicator argument is passed).
- The program to call is determined based on the procedure name specified on the CALL, and, if necessary, the naming convention.
- The language of the program to call is determined based on information retrieved from the system about the program.
Example: Embedded CALL statement where no procedure definition exists
The following PL/I example shows an embedded CALL statement where no procedure definition exists:
DCL HV2 CHAR(10);
:
EXEC SQL CALL P2 (:HV2);
:
When the CALL statement is issued, SQL attempts to find the program based on standard SQL naming conventions. For the preceding example, assume that the naming option of *SYS (system naming) is used and that a DFTRDBCOL parameter is not specified on the Create SQL PL/I Program (CRTSQLPLI) command. In this case, the library list is searched for a program named P2. Because the call type is GENERAL, no additional argument is passed to the program for indicator variables.
Assuming program P2 is found in the library list, the contents of host variable HV2 are passed in to the program on the CALL and the argument returned from P2 is mapped back to the host variable after P2 has completed execution.
- All integer constants are passed as fullword binary integers.
- All decimal constants are passed as packed decimal values. Precision and scale are determined based on the constant value. For instance, a value of 123.45 is passed as a packed decimal(5,2). Likewise, a value of 001.01 is also passed with a precision of 5 and a scale of 2.
- All floating point constants are passed as double-precision floating point.
- CURRENT DATE
- Passed as a 10-byte character string in ISO format.
- CURRENT TIME
- Passed as an 8-byte character string in ISO format.
- CURRENT TIMESTAMP
- Passed as a 26-byte character string in IBM® SQL format.