SQL/MP Programming Manual for COBOL85

HP NonStop SQL/MP Programming Manual for COBOL85429326-004
1-1
1 Introduction
NonStop SQL/MP is the HP relational database management system (RDBMS) that
uses SQL to define and manipulate data in an SQL/MP database. You can run SQL
statements interactively by using the SQL/MP conversational interface (SQLCI) or
programmatically by embedding SQL statements and directives in a host-language
program written in COBOL, C, Pascal, or TAL.
This manual describes the programmatic interface to SQL/MP for COBOL programs.
Advantages of Using Embedded
SQL Statements
Embedding SQL statements and directives in a COBOL program to access an
SQL/MP database has these advantages:
A high-level, efficient database language—You can code a request to access the
database by using SQL statements. The SQL optimizer then generates an efficient
plan to perform your request.
Insulation against database changes—If a database administrator modifies an
SQL/MP database (for example, adds a column to a table), the change does not
affect the logic of your program.
COBOL statements for processing data—You can access a database by using
SQL statements and then use COBOL statements to process and manipulate the
data.
System support for data consistency—If you require audited tables and views, the
system maintains data consistency with the locking feature and the HP NonStop
Transaction Management Facility (TMF) subsystem.
Development of a COBOL Program
You can embed static or dynamic SQL statements in a COBOL source file. You embed
a static SQL statement as an actual SQL statement and run the SQL compiler to
explicitly compile the statement before you run the program. To embed a dynamic SQL
statement, code a placeholder variable for the statement, and then construct, SQL
compile, and execute the statement at run time.
Host Variables
A host variable provides communication between COBOL statements and SQL
statements. A host variable is a COBOL data item with a data type that corresponds to
an SQL data type. You use host variables in SQL statements to receive data from a
database or to insert data into a database.