This chapter introduces the DB2 RXSQL interface by describing the elements of DB2 RXSQL, and how to access it.
The DB2 REXX SQL for VM/ESA (DB2 RXSQL) allows REXX programs to access the DB2 Server for VM relational database management system.
SQL, the language used to interface to the database manager, can be imbedded in procedural languages such as assembler, C, COBOL, FORTRAN, and PL/I. DB2 RXSQL extends this support to REXX programs and allows SQL statements to be used in DB2 RXSQL requests contained in REXX programs.
DB2 RXSQL contains an expanded interface that resembles the standard SQL language (except for user descriptors), as outlined in the SAA Database Level 2 Reference manual.
Unlike the other host languages mentioned, DB2 RXSQL requests are not preprocessed. Compiling your REXX programs has no effect on the DB2 RXSQL requests contained in them.
DB2 RXSQL supports the use of both Dynamic and Extended Dynamic SQL statements.
DB2 RXSQL performs some initial checking on these statements, transforms them into standard run-time SQL operations, and passes them to the database manager. Results of these SQL operations are returned to your program in REXX variables. This includes both data and resulting status information.
When you are coding DB2 RXSQL operations in a REXX program, you can use REXX variables to do the following:
DB2 RXSQL consists of two modules:
DB2 RXSQL also includes a DB2 RXSQL LOADLIB which gets loaded as a CMS nucleus extension.
With DB2 RXSQL, you receive DB2 RXSQL-supplied programs, sample REXX programs, and online HELP information. You can use these along with the DB2 RXSQL requests that come with DB2 RXSQL to create your own applications.
For further information, refer to Chapter 6, RXSQL-Supplied Programs.
These programs are examples of how to use DB2 RXSQL statements in your own REXX programs.
Refer to Appendix F, Sample Programs with Examples of RXSQL Requests for more information.
DB2 RXSQL supports a variety of commands and statements which are listed in Chapter 10, RXSQL Request Descriptions.
If you are unfamiliar with SQL you can read Chapter 7, Concepts for an introduction to the way that DB2 RXSQL is used within REXX programs.
Use the CMS HELP command to obtain HELP information on these topics:
For further information, see HELP RXSQL MENU.
Before using DB2 RXSQL, ensure that it is installed and that you have access to the DB2 Server for VM database manager.
If DB2 RXSQL and the DB2 Server for VM program are installed on minidisks, access the DB2 Server for VM production minidisk and the DB2 RXSQL production minidisk by using the CP LINK and ACCESS commands.
If DB2 RXSQL and the DB2 Server for VM product are installed on minidisks using the defaults specified in Chapter 2, Installing DB2 RXSQL, then you can access the DB2 Server for VM and DB2 RXSQL production minidisks by typing the following commands:
CP LINK SQLMACH 195 195 RR ACCESS 195 Q CP LINK SQLMACH 198 198 RR ACCESS 198 P
The name of the database machine (SQLMACH) and the minidisk numbers (195 and 198) may be different if DB2 RXSQL or the database manager are not installed using the defaults. Ask your database administrator about your installation's setup.
If the database manager and DB2 RXSQL are installed using SFS directories, type the following ACCESS commands:
ACCESS VMSYS:SQLMACH.SQL.PRODUCTION Q ACCESS VMSYS:SQLMACH.RXSQL.PRODUCTION P
The names of the SFS directories, VMSYS:SQLMACH.SQL.PRODUCTION and VMSYS:SQLMACH.RXSQL.PRODUCTION may be different if DB2 RXSQL is not installed using the defaults.
If you are accessing the DB2 Server for VM application server for the first time, type the following command, substituting the name of your application server to establish a connection to it.
SQLINIT DBNAME(server_name)
The application server is now available for use by DB2 RXSQL or other applications that use the DB2 Server for VM relational database manager.
DB2 RXSQL uses the CMS message repository for storing its error messages. Consequently, you must issue the following CMS command before beginning an DB2 RXSQL session:
SET LANGUAGE (ADD ELO USER