Parameter Descriptions

The following is a list of parameter descriptions.

1. Action

This is a one-character code representing one of the eight functions supported. Use one of the data names with pattern "ACTION-" from copy member PTCSQLRT.

Example

ACTION-SELECT OF SQLRT

These are the actions provided:

Action Name Service Provided

ACTION-SELECT

Process a SELECT statement.

ACTION-FETCH

Fetch from a previous SELECT answer set.

ACTION-UPDATE

Process an UPDATE, INSERT, or DELETE statement.

ACTION-COMMIT

Commit a unit of work.

ACTION-ROLLBACK

Roll back the changes since the last COMMIT.

ACTION-DISCONNECT

Disconnect a cursor.

ACTION-DISCONNECT-ALL

Disconnect all cursors.

ACTION-CONNECT

Create a database connection and establish a cursor.

ACTION-ERROR

Process an error condition.

ACTION-CLEAR-STMT

Clear common statement (when program CANCELED).

2. SQLRT

This is the 01-level of data division copy member PTCSQLRT and is used to send and return several sub-parameters and to provide work space.

The individual elements in PTCSQLRT are described in the topic Interface Data.

3. Cursor

This is a four-digit computational number representing a resource connection unit. Copy data division SQLRT contains a common cursor for use when resources do not have to be saved for reuse.

Examples

SQL-CURSOR-COMMON OF SQLRT
SQL-CURSOR OF S-CHECK

4. Statement

The 18-character name of a stored SQL statement must conform to the following pattern:

Item Description

Char 1-8

Program Name

Char 9

Constant "_" (underscore)

Char 10

Constant specifying SQL statement type:

 

S for select

 

D for delete

 

I for insert

 

U for update

Char 11

Constant "_" (underscore)

Char 12-17

Unique Statement Name within program

Example

01  S-CHECK.
  02  STMT-NAMEPIC X(18)   VALUE ‘PSPRPRNT_S_CHECK'.
CALL ‘PTPSQLRT' USING ACTION-SELECT OF SQLRT
  SQLRT
  SQL-CURSOR-COMMON OF SQLRT
  STMT-NAME OF S-CHECK
....

5. Bind-Setup

This is a list of descriptors for the data that is used by the SQL statement in the WHERE, HAVING, SET, and VALUES clauses. These descriptors tell the API the sizes and types of the corresponding bind variables. The descriptors exactly match the memory layout of the bind variables themselves. Setup strings are the same for both bind and select setup lists.

For details, see the topic Setup List.

Example

BIND-SETUP OF S-CHECK

6. Bind-Data

This is a list of data elements defined by BIND-SETUP and is described subsequently for both bind and select data lists.

Example

BIND-DATA OF S-CHECK

7. Select-Setup

This is a list of specifications for the data that is returned by the SQL statement - SELECT.

For details on both bind and select setup lists, see the topic Setup List.

Example

SELECT-SETUP OF S-CHECK

8. Select-Data

This is a list of data elements defined by SELECT-SETUP. Setup lists for both bind and select data are described in the Setup List topic. Select-Data is the buffer area into which data is returned by the Fetch action. Be sure to initialize this area before each Fetch, because character fields are not blank-filled on all platforms. If you do not clear the buffer, a short character value might only partially replace a longer value from a previous fetch.

Example

SELECT-DATA OF S-CHECK