A Rexx interface to SQL databases
10 October 2006
Rexx/SQL consists of Rexx external functions that allows a Rexx program to
communicate with a SQL database.
Actions requested of the database are made by calling these external functions.
Information returned to the Rexx program as a result of these actions is done
principally through the Rexx variable pool.
The Rexx external functions are:
(1)Function may not be supported in all implementations.
- SQLCONNECT - connect to the SQL database
- SQLDISCONNECT - break the connection to the SQL database made by SQLCONNECT
- SQLDEFAULT(1) - switch the default connection to another open connection
- SQLCOMMAND - issue a SQL statement to the connected database
- SQLPREPARE - allocate a work area for a SQL statement and prepare it for processing
- SQLDISPOSE - deallocate a work area for a statement
- SQLOPEN - open a cursor for a prepared SELECT statement
- SQLCLOSE - close an opened cursor
- SQLFETCH - fetch the next row from the open cursor
- SQLGETDATA - extracts part of a column from a fetched row
- SQLEXECUTE - execute a prepared statement
- SQLCOMMIT - commit the current transaction
- SQLROLLBACK - rollback the current transaction
- SQLDESCRIBE(1) - describe expressions from a SELECT statement
- SQLVARIABLE(2) - set or retrieve default run-time values
- SQLGETINFO(2) - retrieve Rexx/SQL information for a connection
- SQLDATASOURCES(1) - obtain a list of the data sources available
- SQLTABLES(1) - obtain a list of tables from the current data source
- SQLCOLUMNS(1) - obtain a list of columns in tables from the current data source
(2)Values that can be set can vary between implementations.
Status values set by the Rexx external functions are:
At the start of each external function call, the SQLCA. stem values are reset if the
previous external function call caused an error or warning. This is done to make Rexx/SQL
faster by not resetting these values if they don't need to be. The SQLCA. stem should be
considered read-only and the values not changed or DROPped by the Rexx/SQL program.
- SQLCA.SQLCODE - result code of last SQL operation
- SQLCA.SQLERRM - text of any error message associated with the above result code
- SQLCA.SQLSTATE - a detailed status string (N/A on some ports)
- SQLCA.SQLTEXT - text of the last SQL statement
- SQLCA.ROWCOUNT - number of rows affected by the last SQL operation
- SQLCA.FUNCTION - name of the Rexx external function last called
- SQLCA.INTCODE - Rexx/SQL interface error number
- SQLCA.INTERRM - text of last Rexx/SQL interface error
Mark Hessling 1997-2006
Return to Table of Contents
Last updated 10 October 2006