OS 2200 RDMS User Guide
OS 2200 RDMS User Guide
OS 2200
You should be very careful to ensure that the use of this information and/or software material complies with the laws,
rules, and regulations of the jurisdictions with respect to which it is used.
The information contained herein is subject to change without notice. Revisions may be issued to advise of such
changes and/or additions.
Notice to U.S. Government End Users: This is commercial computer software or hardware documentation developed at
private expense. Use, reproduction, or disclosure by the Government is subject to the terms of Unisys standard
commercial license for the products, and where applicable, the restricted/limited rights provisions of the contract data
rights clauses.
Unisys and ClearPath are registered trademarks of Unisys Corporation in the United States and other countries.
All other brands and products referenced in this document are acknowledged to be the trademarks or registered
trademarks of their respective holders.
Contents
Section 1. About This Guide
Section 2. Introduction
Section 4. Threads
Section 7. Views
iv 7831 0778–003
Contents
Glossary ............................................................................................. 1
Index ............................................................................................. 1
7831 0778–003 v
Contents
vi 7831 0778–003
Tables
Purpose
RDMS is one of the Universal Data System (UDS) suite of software products. UDS
products work together to manage and control the flow of data on a system. RDMS is a
part of the standard product (the UDS kernel).
RDMS is based on the relational data model. The relational data model provides an
uncomplicated view of data to all users by representing data in two-dimensional tables of
rows and columns. These tables are called relational tables. A relational database is a
collection of relational tables. RDMS is the data manager for relational databases.
RDMS users use Structured Query Language (SQL), the industry-standard relational
database management language, and some RDMS extensions to SQL to interact with
RDMS databases.
Interactive Processing Facility (IPF) users can use the IPF SQL Interface to manage
RDMS databases using SQL.
This guide serves two purposes. First, it is a procedural guide to common RDMS
end-user tasks performed in SQL. These tasks include retrieving, updating, inserting, and
deleting rows from RDMS tables; thread control; and concurrency control. This guide is
not intended as a text for learning SQL. It is meant to serve the occasional user as well
as the SQL user unfamiliar with RDMS.
The guide’s second purpose is to document the IPF SQL Interface. The IPF SQL
Interface enables IPF users to use RDMS databases.
Scope
The end-user tasks covered in this guide include managing threads; querying and
updating tables; and using views, variables, and locks.
This guide explains the necessary concepts and terminology for each task. It also
provides examples of how to perform each task.
Audience
The primary audience for this guide is all RDMS end users, which includes
• Any RDMS end user who needs assistance with SQL or other end-user tasks
• IPF SQL Interface users
• Programmers developing or maintaining applications written in third-generation
programming languages such as UCS COBOL, UCS FORTRAN, UCS C, UCS Pascal,
ASCII COBOL or ASCII FORTRAN
[Link]
Note: If you are not logged into the Product Support site, you will be asked to do so.
1.2. Prerequisites
This guide assumes that users have a working knowledge of the Exec. It also assumes
that users can work effectively with the interface of their choice. This means, for
example, that they know how to write programs in the third-generation programming
language they are using, or, if they are IPF SQL Interface users, that they know how to
use IPF.
As for relational database competence, this guide assumes that most users have had
some training and have at least a basic understanding of relational concepts and
terminology. However, the guide contains a brief refresher of elementary concepts for
the benefit of new, out-of-practice, or infrequent users.
• UDS Control
UDS Control handles all actual input/output operations on the database. It also
provides recovery and locking services for you.
• Unisys Repository Manager (UREP)
UREP handles repository tasks, such as storing table and view definitions.
UDS Control and UREP work together in many ways to support database activities.
RDMS is a relational database manager based on SQL that provides relational database
users with many services:
• Retrieving data
You use retrieval statements to specify which rows and columns you want to
retrieve for examination or further processing. In a real estate database application
for example, you might want to see a list of all the customers who said the
maximum price they would pay for a home was $100,000 or more.
• Updating data
You use update statements to change the values in one or more columns of one or
more rows. For example, a family could change their minds and decide they prefer to
buy in New London instead of Woodbury. You must then update the preferred
location column for their row to indicate their correct preference.
• Inserting data
As you attract more customers and list more houses, you need to add rows to those
tables to keep them current.
• Deleting data
As customers buy houses, you need to delete the customers and the purchased
houses from tables.
These are the main tasks users perform regularly. Other tasks, like creating and dropping
tables, controlling access to tables, and managing recovery, are the responsibility of the
database administrator. For more information on these and other administrative tasks,
see the RDMS Administration Guide.
SQL, an acronym that stands for Structured Query Language, is a relational data
management language. The American National Standards Institute uses SQL as the
official standard for relational database languages. SQL is pronounced “ess-cue-ell” or
“sequel.”
SQL divorces the application program or end user from the physical and location
attributes of the data. Data manipulation commands are expressed in logical terms. A
SQL query declares an action to be applied to the data of interest. It makes no difference
where the data is located or how it is arranged. The data of interest is identified only in
logical terms, which includes
• Identifying the table or tables involved in the action (retrieval or update). Optionally,
the names of the tables can be qualified by a schema name. A query can involve one
or more tables, and the tables specified generally can involve multiple schemas.
• Identifying the rows to be selected from the tables. Rows are selected through
specifications that identify the rows of interest. The specifications include column
names whose associated value in the row can be compared or included in an
expression that is compared to other like expressions. These statements of “truth”
or “falseness” identify whether or not the row is to be included as the “set of
interest.” Optionally, columns can be qualified by a table and schema.
• Identifying the columns on which the action (retrieval or update) is specified. The
specifications include column names whose associated value is to be presented or
included in an expression of a column or columns for presentation from the rows in
the tables selected. For update actions, column names are associated with
corresponding values for assignment to the columns of the selected row set. In all
cases, the column names can be qualified by a table and schema name.
You use SQL to control a database and its data. SQL statements enable you to perform
all the basic tasks and most of the administrative tasks required for working with
relational databases.
RDMS supports entry-level SQL 92 and several extension to it. Some of these
extensions take advantage of the unique capabilities of RDMS, the Integrated Recovery
Utility (IRU), or the Exec. The thread control operations are examples of this kind of
extension to the standard. Refer to Section 4, “Threads,” for more information. Some
extensions of this kind are presented in this guide. RDMS also extends the capability of
some standard SQL statements and supports embedded SQL (ESQL), a method by
which you can incorporate SQL statement into third-generation programming languages.
For details on RDMS extensions to standard SQL and more information about ESQL, see
the RDMS SQL Programming Reference Manual.
Relational tables are just like the tables you see every day in reports or timetables. Each
row in the table contains information about one item. Each column in a row reveals
something about the item the row describes. Each column has a set of permissible
values called its domain.
Tables look like and are similar to conventional sequential files. Like a file, each table has
a name. The rows in a table are like the records in a file and are, in fact, sometimes
referred to as “records.” The columns in a row are like the data fields in a record. Like
data fields, columns have names and data types associated with them.
RDMS stores the structural definition of each table in the repository. From the table
definition, RDMS can determine how many columns a given table has, the names of the
columns, and the data types.
Table 3-1 and Table 3-2 are examples of relational tables a real estate company might
use. These tables and their data are used in examples throughout this guide.
Table HOUSES contains a house identifier (HNO), the location of the house (LOCATION),
the asking price (PRICE), and a brief description of each house on the market
(DESCRIPTION).
• Each table has a specific number of columns. You specify how many columns the
table is to have when you create it using the CREATE TABLE statement. You can
change the number of columns later by using the ALTER TABLE statement.
• Each relational table contains just one type of row (that is, each row has the same
format). This means that every row in a given table has the same +columns in the
same order.
• The intersection of a column and a row is called a data item. An example of a data
item in the HOUSES table is the intersection of the column Price with the row
describing house number H102. The specific value of a given data item is called a
data value. For example the data value of Price for house H102 is 40000.
• Each row in a table contains information about one item. For example, each row in
the HOUSES table contains information about one particular house.
• If a primary key is defined, part of each row must be unique. This means that for
each row, the value of one column (or a group of columns considered together) must
be unique. This column or set of columns that have a unique value for every row is
called the primary key. The group of columns that have a unique value when
considered together can include all columns in the table. No more than one row can
have a given primary key value.
• Each column in a table has a distinct name. Rows do not have names.
A view, also called a virtual table, is another way to look at the data that is physically
stored in tables in the database. A view has no physical data associated with it; instead,
a view is a filter through which you “view” the data in one or more tables. The definition
of a view is stored in the repository, just like the definition of a table. But the computer
mass storage system that holds the data for a view contains no permanent files.
Views and tables are so similar in most ways that you can use the terms “table” and
“view” interchangeably in this guide unless otherwise noted.
• BEGIN THREAD
• COMMIT
• ROLLBACK
• END THREAD
Any changes you make to the database are not made permanent until you execute a
COMMIT or END THREAD statement. Until that time, UDS Control keeps both the
updated and original copies of the data. If an error or system stop occurs before the end
of the step, UDS Control “rolls backs” the database to the state that existed at the start
of the step. This operation is called “recovery.” Recovery assures you of a consistent
database.
UDS Control and RDMS also lock updated data until the end of the step to prevent other
users from accessing uncommitted data.
While a thread is open, you can display the information in the database and make
changes to it. A thread remains open until you enter an END THREAD statement or log
off the system.
Only one application group can be open at a time. The application group that is currently
open must therefore be closed with the END THREAD statement before a new database
can be opened.
The BEGIN THREAD statement registers a thread with UDS and sets up the thread
working storage and environment.
• If you do plan to update the database, specify the type of recovery you want. Put the
recovery option in parentheses immediately following the UPDATE keyword. You or
the database administrator should choose one of these recovery options:
− DEFERRED
Use DEFERRED if you plan to make few updates (fewer than the
MAX-AOR-LIMIT configuration parameter, which is 10 by default) between
thread control operations, or if you plan to roll back changes. If you specify
UPDATE but you do not specify a recovery option, RDMS uses DEFERRED.
− QUICKLOOKS
Use QUICKLOOKS if you plan to make many changes to the database between
thread control operations (more than about 100). If you plan to make between 10
and 100 updates per step, it does not make much difference whether you
choose DEFERRED or QUICKLOOKS.
− COMMANDLOOKS
Use COMMANDLOOKS, the most expensive type of recovery, to provide
recovery to the beginning of a statement if the statement encounters errors. It is
recommended for the IPF SQL Interface and other interactive sessions.
(Interactive users are more likely to use erroneous statements than debugged
programs.)
• How RDMS should handle error messages
The UDSMESSAGE option instructs RDMS to print error messages immediately
instead of waiting for you to retrieve them. IPF SQL Interface users cannot use this
option because the IPF SQL Interface already has a mechanism for retrieving error
messages.
Examples
The following example registers thread T1 with RDMS in application group UDSSRC.
This thread cannot update the database.
The next example registers thread PUBS in application group UDSSRC. This thread can
update the database; any updates use the DEFERRED recovery option.
Use the COMMIT statement only if a thread is open. When you close a database with
the END THREAD statement, the system automatically commits the changes for you.
Committing a thread releases all locks except those set by LOCK statements.
Example
The following example writes all updates for the current step (since the last thread
control operation) to the database:
COMMIT
• You are making several updates to the database, get an unexpected error, and want
to commit the changes only if you can apply them all. If any one of the updates is
unsuccessful, you can use the ROLLBACK statement to discard all updates made by
the step.
• You are making temporary updates to generate a “what if” report. In this case, you
can discard all changes to the database with a ROLLBACK statement when you have
all the information you need.
Rolling back a thread releases all locks except those set by LOCK statements.
Example
The following example ends the current recovery step and discards any updates to the
database made since the last thread control operation:
ROLLBACK
Example
The following example ends the current thread:
END THREAD
A query specification can be used alone or as a clause in some other SQL statements.
Used alone, it is the SELECT statement. Other SQL statements that use query
specifications as clauses include
• DECLARE CURSOR
In SQL, you can describe the conditions for a group of rows you want to retrieve and
process one at a time. This description is called a cursor.
• CREATE VIEW
Refer to Section 7, “Threads.”
• UNLOAD
The UNLOAD statement is not covered in this guide. For information on the
UNLOAD statement, see the RDMS SQL Programming Reference Manual.
The query specification allows you to retrieve information from a database. You can
retrieve zero or more rows from a table. Only those rows with data values that satisfy
the selection criteria you specify are retrieved. Use several clauses with the query
specification to specify this criteria:
You can also use these optional clauses to further refine a query:
• WHERE clause
The WHERE clause lets you specify conditions for the rows you want to see. If a
row meets the condition, the columns you specified are retrieved. Otherwise, the
row is not retrieved.
• GROUP BY clause
The GROUP BY clause lets you obtain summarized information. For example, you
can summarize a sales report and use the GROUP BY clause to find the total
month’s sales for each salesperson.
• HAVING clause
The HAVING clause lets you specify conditions each group specified in the GROUP
BY clause must meet. For example, you can use the HAVING clause to eliminate all
salespersons who have not met their bonus quotas for a sales contest.
Examples
The following example selects all columns from table CUSTOMERS:
SELECT *
FROM customers
You can also select all columns from two or more tables as in the following query
specification, which specifies all columns from tables CUSTOMERS and HOUSES:
SELECT *
FROM customers, houses
To select all columns from one particular table when the FROM clause specifies several
tables, place the table name followed by a period in front of the asterisk. The following
example illustrates how to select all columns from table CUSTOMERS but only column
HNO from table HOUSES when joining the two tables:
If you do not want all the columns from a table, you can specify the desired columns
with a list of column names.
You do not have to specify the table containing the column name in a select list. RDMS
matches the column with one of the table names specified in the FROM clause. It scans
the list of tables in the FROM clause (from left to right) until it matches a column with
the table that contains that column. RDMS then qualifies the column name implicitly
with the matching table name.
The results of the following two query specifications are the same:
SELECT A, D, B, C
FROM r1, r2
WHERE B = r2.B
SELECT r1.A, r2.D, r1.B, r1.C
FROM r1, r2
WHERE r1.B = r2.B
An entry in the select list can also be an arithmetic expression. For example, if you do
not want to retrieve the price of a house, but want to know the agent’s 6 percent
commission, enter
You get house numbers and sales commissions; you do not get the price of houses.
You can also include numeric constants or string literals in the select list:
In this case, each row retrieved has two data values: one character string with the value
THE HOUSE NUMBER IS and a second character string that contains a house
identification number.
You can also use the DISTINCT keyword to specify no duplicate rows. DISTINCT
requires RDMS to sort and compare rows to eliminate duplicates, except in special
cases such as the projection of all columns in a primary key or unique index. This means
that selecting data with DISTINCT takes longer than selecting data without it.
If you use the GROUP BY clause, all column names used in the SELECT list must also be
in the GROUP BY column specification list.
You cannot include both column names and functions (AVG, COUNT, MAX, MIN, and
SUM) in the select list unless a GROUP BY clause exists. In that case, you can mix
columns in the GROUP BY column specification list with functions that affect columns
not included in the column specification list.
The table list can include views, but a view containing DISTINCT, GROUP BY, or built-in
functions cannot be joined to any other table or view. If you list such a view in the FROM
clause, the FROM clause can contain no other tables or views.
If you have more than one table name in the FROM clause, RDMS performs a join of the
tables. If you join tables and one of the tables is empty, nothing is selected (see 5.2).
You might want to use the same table more than once in a query specification. You can
do this with a correlation name. A correlation name is an alias for a table.
If you use a table or view specification followed by a correlation name, any column name
referenced in the select list can be qualified with that correlation name. This means that
column names qualified in this manner are assumed to be in the table associated with
the correlation name.
Examples
To list identically priced pairs of houses, you can specify X and Y as variable names for
the rows in the single table HOUSES, as in the following example:
The WHERE clause in this example uses a Boolean expression. The second part of the
Boolean expression, namely NOT ([Link] = [Link]), ensures that no house is paired
with itself. (Boolean expressions decide true or false kinds of conditions. For example,
the expression A = B is either true or false. A complete discussion of how RDMS uses
Boolean expressions is beyond the scope of this guide. See the RDMS SQL
Programming Reference Manual.)
Any table identified in a FROM clause is subject to a scoping rule that governs the range
within the overall query in which the table’s columns can be referenced. The scope of a
table includes the query specification whose FROM clause identifies the table as well as
all subqueries nested within the query specification, no matter how deep.
The reference to column C2 of table T1 in the following example is legal since it falls
within the scope of T1, which consists of the entire query:
SELECT * FROM t1
WHERE t1.c1 < (SELECT min(t2.d1)
FROM t2
WHERE t1.c2 = t2.d2)
The reference to column D3 of table T2 in the next example is not legal, however,
because it is referenced outside the scope of T2, which consists solely of the subquery:
SELECT * FROM t1
WHERE t1.c1 < (SELECT min(t2.d1)
FROM t2
WHERE t1.c2 = t2.d2)
AND t2.d3 IS NOT NULL
Examples
Since CNO is the primary key of table CUSTOMERS and each row in a table has a unique
primary key, the following example selects no more than one row of the table:
To continue, you may want to select all houses with an asking price of over $100,000.
The WHERE clause that restricts the houses to this price range is
You can further restrict the selected rows by using an AND operand in a Boolean
expression. For example, you can select only the houses that cost over $100,000 and are
located in Woodbury:
You can also restrict the selected rows by using nested SELECT statements or
subqueries. You can use the following WHERE clause, for example, to select all houses
that every customer can afford:
If you leave out the WHERE clause in a query specification, RDMS selects all rows from
the specified table or tables.
Example
To get a list of towns (locations) where houses are listed and the average price of
houses in each location, you can use the following query specification:
LOCATION AVG(PRICE)
Woodbury 85000
Westchester 90000
Parkway Heights 85000
Turtle Creek 110000
RDMS forms the groups first and then applies the HAVING clause. One grouped table
row is formed for each group that satisfies the HAVING clause. The Boolean-expression
in the HAVING clause can refer to any column in the GROUP BY column specification
list. You can use any column not in that list as a parameter to a built-in function only.
If you have a HAVING clause but no GROUP BY clause, all rows in the FROM and
WHERE clauses comprise a single group, and the resulting grouped table consists of
zero or one row.
Example
To find the locations where the average price of a house exceeds $100,000, use the
following query specification:
The cross-product table is a conceptual table (that is, it does not physically exist in the
database). This table contains all the columns from all three tables: A, B, C, D, E, F, G, H,
I, and J.
The number of rows in the cross-product table is the product of the number of rows in
Tables T1, T2, and T3. For example, if T1 contains 10 rows, T2 contains 5 rows, and T3
contains 20 rows, the cross-product table contains 10X5X20 = 1000 rows.
Therefore, if you include an empty table (that is, with no rows in it), the resulting
cross-product table is also empty.
Second, RDMS applies the conditions in the WHERE clause to every row in the
cross-product table. If a row satisfies the conditions in the WHERE clause, it goes into a
reduced cross-product table. This table contains the same number of columns as the
original cross-product table. That is, if the Boolean expression is true for a given row, that
row goes into the reduced cross-product table. The number of rows in the reduced
product table is probably reduced as a result of conditions in the WHERE clause.
Third, RDMS now applies the query specification clause to the reduced cross-product
table. The only columns selected for the SELECT clause are those that meet any
conditions in the SELECT clause.
Example
The following example illustrates a query specification clause to join tables CUSTOMERS
and HOUSES.
Table 5-2 illustrates the joined tables CUSTOMERS and HOUSES in a cross-product
table.
Table 5-3 illustrates the reduced cross-product table after the WHERE clause has been
applied.
Table 5-4 illustrates the final cross-product table after the SELECT clause has been
applied.
In some cases when you do not select a column or columns from each table in the
FROM clause, RDMS is able to optimize retrieval by not returning all duplicate rows.
• DECLARE CURSOR
Use the DECLARE CURSOR statement to define the rows you want to retrieve.
• OPEN
Use the OPEN statement to instruct RDMS to prepare the rows you defined in the
DECLARE CURSOR statement.
• CLOSE
Use the CLOSE statement to instruct RDMS to release the rows it retrieved when it
opened the cursor.
You can also use a DROP CURSOR statement with RDMS, but it is not part of standard
SQL.
Working with cursors often involves the use of variables to pass values from an
application to RDMS and back. Variable usage depends on the interface used. For more
information about variables, see the documentation for the interface you are using. See
the RDMS SQL Programming Reference Manual also.
Examples
The following example defines a set of rows by joining selected columns from tables
CUSTOMERS and HOUSES. It restricts the cursor to rows where the asking price of the
house does not exceed the maximum price the customer is willing to pay.
The next example illustrates how to use an arithmetic expression with a column to give
you a calculated result instead of just the data in the table. It returns the sales agent’s
commission (6%) instead of the house price. It also sorts the retrieved rows by the
amount of the commission and the location of the house. (Since the commission is not
an actual column value but an expression, you use an unsigned integer to designate its
position in the list of items selected.)
The more work you give a cursor to do, the longer it takes to do it. Since the cursor
MYCUT has to perform both arithmetic calculations and sort the retrieved rows, it takes
longer to execute than an unsorted retrieval without calculations.
The next example illustrates how to use the UNION set operator with columns in two
tables. It returns all cities in ascending order that have either a customer or a house. The
UNION operator requires two query specifications.
If you are working through an application program, you also use the OPEN statement to
associate new values with the cursor declaration.
Example
The following example opens the cursor MATCHPRICE that was declared in the example
in 4.3.1:
OPEN matchprice
When you close a cursor, you release most of the system resources used by the cursor.
It is a good idea to close cursors you no longer need. Since opening cursors can require
considerable processing time, however, do not close cursors prematurely.
To close a cursor, use the CLOSE statement with the cursor name.
Example
The following example closes cursor MATCHPRICE, which was opened in the example
in 4.3.2:
CLOSE matchprice
Note: If you do not use the WHERE clause, RDMS deletes every row from the table.
Use a WHERE clause if you do not want to delete all the rows.
Examples
The following example deletes all rows from table HOUSES:
DELETE houses
DELETE customers
You can also delete rows that meet certain conditions. In the next two examples, you
are eliminating from the database all customers who are unable to spend more than
$40,000 for a house:
DELETE customers
WHERE maxprice <= 40000
DELETE customers
WHERE maxprice - 40000 <= 0
The next example deletes only those rows where the value of the PRICE column is
greater than $100,000:
DELETE houses
WHERE price > 100000
DELETE houses
WHERE hno = 'H102'
To use the INSERT statement, you name the table into which you want to insert a row.
You must also specify the values you are inserting in the new row (the VALUES clause).
If you do not place the values into the columns in the same order as the columns were
defined, you must list the column names in front of the VALUES clause.
Instead of specifying a VALUES clause, you can use a query specification to select
values from other tables to form rows to be inserted.
Use commas to separate the data items in the values list. The order of the data items
must match the order of the columns. All columns must have a data item, and each data
item must be compatible with the column data type.
Examples
Here are some examples of INSERT statements:
The next two examples assume another table, HOUSES2, exists with three columns
defined as HNUM, LOC, and PRICE. An insertion from table HOUSES2 into table
HOUSES results in default values for DESCRIPTION:
The last example inserts default values for PRICE and DESCRIPTION:
INSERT INTO houses (hno, location) SELECT hnum, loc FROM houses2
Standard SQL has two versions of the UPDATE statement. Both are easy to use; they
differ in how you specify which row or rows to change. In one form, you use a WHERE
clause (see 5.1.3) to restrict the changes to the desired row or rows. In the other form,
you substitute WHERE CURRENT OF cursor name (use the name of the cursor) for the
WHERE clause. This restricts the update to the current row (that is, to the row you have
just retrieved using the cursor).
Note: If you do not put a WHERE clause on the UPDATE statement, the change
applies to all rows.
In both versions of the UPDATE statement, you first name the table in which you want
to change values. Next, you list the changes you want to make. Each change is a column
name followed by an equal sign ( =) and the new value that column is to take.
For the special case in which you wish to update a value and then immediately retrieve it
(for example, if a bank adds $10 to an account balance and then reports the new
balance), use the RETRIEVE INTO clause. The RETRIEVE INTO clause on the UPDATE
statement is available only in the embedded SQL (ESQL) interface to RDMS from
COBOL.
Examples
The following example changes the asking price for house number H101 in table
HOUSES to $150,000:
UPDATE houses
SET(price = 150000)
WHERE hno = 'H101'
With one UPDATE statement, the next example changes the asking price for two
houses:
UPDATE houses
SET(price = 150000)
WHERE hno = 'H101' OR hno = 'H102'
• A view name
• Column names
If you do not list column names, the default column names for the view are the
same as the column names resulting from the select list. Column names must be
unique within the view. If you do list column names, you must use as many as are
required to satisfy the select list.
• A query specification to retrieve data from the underlying tables and views to
populate the view you are creating
• An optional WITH CHECK OPTION clause
RDMS ensures that UPDATE and INSERT operations against the view satisfy the
WHERE clause of the definition of the view.
• An optional ACCESS CONTROL clause for security
The user who creates a view is the owner of that view. When a view is created within
the context of the CREATE SCHEMA statement, the owner is the authorization-id of the
CREATE SCHEMA statement. The owner is the only person who can grant and revoke
privileges for that view.
The owner of a view inherits access privileges from the base table or tables on which
the view depends. For example, if only one base table exists and the view owner has
SELECT and INSERT access privileges to that table, the owner has those privileges to
the view as well. The one exception to this rule is that if the view cannot be updated, the
only privilege that can be granted is SELECT.
You cannot specify the ORDER BY clause with the CREATE VIEW statement.
Example
The following example defines a view using table HOUSES:
Views can be made up of views themselves or any combination of views and tables.
Every level of table or view join, select list, and WHERE clause is another level of
filtration to produce the data picture you want. This enables you to nest query
specifications to retrieve precisely the information you want.
If the CREATE VIEW statement is made within the context of a CREATE SCHEMA
statement, the view name is implicitly associated with the name of the schema.
If the view is not in the CREATE SCHEMA statement and you use a USE DEFAULT
QUALIFIER statement, the default qualifier you specify qualifies the view.
Barring any of these conditions, the schema name is determined by the system default
qualifier. That is, it is either RDMS or the current user-id, depending on the setting of the
RDMS-DEFAULT-QUALIFIER configuration attribute (a UREP dynamic system
reconfiguration parameter).
Views are defined on logical, not physical, tables and views. Therefore, any attempt to
specify a version with the name of the view being defined or any views or tables
referenced within its definition are rejected.
Views are associated with a particular data set at run time by either explicitly specifying a
version for the view or by using the default version whenever the view is referenced in a
manipulative statement. Upon resolution of the view, the underlying tables use the
version currently associated with the view.
• Names must be valid names and unique within the view column list.
• The number of columns specified must be equal to the number of columns
appearing in the select list of the SELECT clause.
• The order of the columns in the view column list must parallel columns derived from
the select list of the SELECT clause.
• Columns can be derived from a built-in function, an arithmetic expression, or a
constant.
• The view column list is mandatory when the select list contains an arithmetic
expression, a function, a constant, or duplicate column names.
Examples
The following example associates columns HNO1 and LOC1 with HNO and LOC from
table [Link], and HNO2 and LOC2 with HNO and LOC from table [Link].
Since the tables in the FROM clause have identical column names, a view column list
must be included; otherwise, RDMS returns an error.
In the next example, no view column list is given, and all columns are specified in the
SELECT statement. The columns for V2 have the same names as the columns in
[Link].
CREATE VIEW v2
AS SELECT * FROM [Link]
• All columns specified in the SELECT clause, Boolean expression, and GROUP BY or
HAVING clause must belong to one of the tables or views in the FROM clause.
• Tables and views referenced must already exist.
• The user of the view being defined must at least have select privileges on all the
tables referenced in the statement.
• The UNION[ALL] set operator is not allowed.
Also, you cannot put an aggregate operation in the query specification if you specify a
view in the FROM clause that has an aggregate operation in its query specification.
Aggregate operations are
• DISTINCT keyword
• GROUP BY clause
• HAVING clause
• Built-in functions
− SUM
− AVG
− MAX
− MIN
− COUNT
• The view must be derived from a single underlying base table. The FROM clause of
the view must list no more than one table or view.
• The select list cannot contain arithmetic expressions, constants, or functions; it can
contain only column names or an asterisk.
• The view cannot contain a DISTINCT specification in the SELECT clause. $ The view
cannot contain a GROUP BY clause.
• The view’s list of column names can rename any one column in the base table no
more than once.
• Any view listed in the view’s FROM clause must adhere to all of these rules.
• The view cannot contain a subquery or the UNION[ALL] set operator.
• The view must meet all the aforementioned conditions for the UPDATE statement.
• The view must select all the columns in the underlying base table. In other words,
there must be an exact, one-to-one correspondence between the columns in the
view and the columns in the underlying base table.
Note: If certain aspects of a view’s underlying table are altered, that view and any
other views dependent on that table are dropped. Keep this in mind particularly when
using the ALTER TABLE statement.
Examples
Suppose that table ORDERS contains the column MONTH that is defined to contain a
2-digit decimal value in the range 1 through 12. Column MONTH is declared as a 2-digit
decimal number with no digits after the decimal point. You can enforce this constraint by
building the following view:
By using view VERIFIED_ORDERS instead of table ORDERS, all values of the column
MONTH are in the range 1 to 12.
Suppose table ORDERS contained another column, PRICE, that is defined to contain a
7-digit decimal value with 2 digits after the decimal point. Creating the following view
illustrates how CHECK OPTION works:
Note: When you drop a view, RDMS automatically drops any other views that refer to
the dropped view in their query specifications.
Example
The following example drops definitions for views V1 and V2, which exist under qualifier
S1, and view VX under qualifier S2:
• Ensure that no one else changes a row while you are making changes
• Keep other users from accessing a table while you make major changes to its
contents or structure
You can use the LOCK statement to place a lock on a table while you are using it. There
are several kinds of locks, some more restrictive than others. Locks are released either
by the UNLOCK statement or by an END THREAD, ROLLBACK, or COMMIT statement;
in any case, all locks you place on a table are released when the session ends. Locks are,
therefore, a temporary restriction on data.
Locks are primarily an administrative concern and are covered in detail in the RDMS
Administration Guide and RDMS SQL Programming Reference Manual. This section
explains how to use the LOCK and UNLOCK statements so you can execute them with
the clauses and options specified by the database administrator specifically for you
based on the kind of work you do.
Use these statements only as directed by the database administrator. Careless use can
keep other users from successfully completing their work.
Ensuring data integrity means that you and other users never get conflicting data from
the same table at the same time. Use the LOCK statement to control the maintenance
and reliability of data by RDMS. For a more detailed discussion of when you need
locking, how you anticipate locking conflicts, and how you resolve conflicts, see the
RDMS Administration Guide.
In addition to ensuring data integrity, locking tables allow you to access data more
efficiently.
The LOCK statement specifies a lock for one or more tables during a step. This lock
remains in effect until you execute an UNLOCK statement for that table and a COMMIT,
ROLLBACK, or END THREAD statement.
During a thread, you cannot use two LOCK statements for the same table without an
intervening UNLOCK statement.
RDMS places implicit locks on tables or rows for you during data retrieval or table
update. Implicit locks are a transparent but necessary protection feature to ensure data
integrity.
Use the LOCK statement to place explicit locks on tables. You cannot place locks on
individual rows; only RDMS can do row-locking. You cannot lock views. If you need
locking protection while working with a view, you must use LOCK statements for each
underlying base table.
Use the values specified by the database administrator on the LOCK statement.
Examples
The following example locks table HOUSES for exclusive update. If a locking conflict
occurs, the LOCK statement is not executed and control is returned to you.
LOCK houses
IN EXCLUSIVE UPDATE MODE
ON CONFLICT RETURN
The next example locks table HOUSES for shared retrieval. If a locking conflict occurs,
the run waits for it to clear.
LOCK houses
IN SHARED RETRIEVAL MODE
ON CONFLICT QUEUE
To use the UNLOCK statement, specify the name of the table or tables you are
unlocking. If you unlock more than one table with a single UNLOCK statement, separate
the table names with commas.
Example
The following example unlocks table HOUSES:
UNLOCK houses
If you unlock more than one table with a single UNLOCK statement and the statement
returns an RDMS error (error status in the 6000 range), some of the tables may already
have been unlocked successfully before RDMS detected the error.
An unlock request can also become queued after some of the tables are unlocked. To
avoid this potentially confusing situation, use a separate UNLOCK statement for each
table.
• Interpreter interface
This interface is used with most third-generation programming languages, including
ASCII COBOL, ASCII FORTRAN, UCS C, UCS COBOL, UCS FORTRAN, and UCS
Pascal.
This interface enables you to place SQL statements marked by special syntax in the
source code of a program. This syntax, which varies from compiler to compiler,
instructs the compiler not to parse the SQL statements. Instead, the compiler inserts
instructions to hand control over to RDMS when the SQL statements are
encountered at run time. The program is compiled and linked or collected as usual.
RDMS is then called at run time to interpret and execute the SQL statements.
This interface offers great power and flexibility. However, since syntactical analysis
must occur every time a SQL statement is encountered, the resulting overhead can
slow execution.
Note: Since the SQL statements are interpreted as they are encountered during
execution, the order in which they appear in the program source code may have no
relation to the order in which they are interpreted. For example, you may be able to
use a cursor at line 5,000 that you do not declare until line 10,000, as long as the
program executes the cursor declaration before first using the cursor.
• Embedded SQL interface
The embedded SQL (ESQL) interface is available through UCS COBOL and UCS C.
You can use ESQL in either a static or dynamic mode. Static ESQL enables you to
include SQL statements that are fully compiled by RDMS at compile time. As a
result, execution of SQL statements may be significantly faster than when using the
interpreter interface to do the same tasks. This is particularly noticeable in tight
loops.
Dynamic ESQL resembles the interpreter interface. It provides you with a way to
include or programmatically create statements that are not compiled until run time.
Static and dynamic ESQL statements and interpreter interface calls may exist in the
same object module. This enables you to retain the flexibility of the interpreter
interface where necessary, but exploit the speed of static ESQL where possible.
Note: Static ESQL is compiled in the order in which it appears in a program’s
source code. This is different from the interpreter interface. For example, if you
declare a cursor at line 5,000 of the source listing, the system returns a fatal error at
compile time if you have any reference to that cursor on any line before line 5,000.
You may have to rearrange source listings to compile without errors.
As with the interpreter interface, dynamic ESQL is parsed and verified at run time.
This means that statements like USE DEFAULT QUALIFIER may follow the first use
of the default qualifier in question in the source listing as long as the USE DEFAULT
QUALIFIER statement is executed before the default qualifier is first used.
• IPF SQL Interface
The IPF SQL Interface couples the interpreter interface to IPF. When you use the IPF
SQL Interface, you retain all the features of IPF and you gain the ability to
interactively work with an RDMS database. IPF offers online help, procedures, easy
access to the Exec, and a powerful editor.
The IPF SQL Interface provides an ideal environment for prototyping and debugging
applications that handle relational databases. It is also a superb environment for the
casual or infrequent database user. Refer to Section 10, “IPF SQL Interface,” for
more information.
• Module language interface
The module language interface, available for UCS FORTRAN and UCS Ada, allows
SQL statements to be used in a module separate from the host program and to be
invoked through procedure calls in the host program.
• Oracle Transparent Gateway
The Oracle Transparent Gateway allows Oracle applications to access RDMS. For
more information, see the Oracle Transparent Gateway for RDMS Installation,
Administration, and Operations Guide.
For information about other interfaces to RDMS (such as Query Language Processor
[QLP], TransIT Open/OLTP, UniAccess Transaction Client/Server, and UniAccess ODBC
Server), see the RDMS Administration Guide.
The IPF SQL Interface is easy to learn and use, so it makes a good platform for
occasional RDMS users. Being able to place SQL statements in files and procedures also
makes it an excellent platform for interactive applications or for prototyping applications
being developed in third-generation languages. You can develop and debug the SQL
statements quickly and easily without the cost and time needed for repetitive compiling,
linking, and executing a test program.
• Alternate between SQL statements and IPF commands when working interactively
at a terminal
• Use SQL statements with IPF commands in IPF procedures
• Store SQL statements in a file with IPF commands and execute them all at once
with the IPF command IN
Some differences exist between the SQL statements and IPF commands:
• With most IPF commands, you use keyword parameters to direct IPF how to use the
command. You cannot use keywords with SQL statements. Instead, you use
clauses, some of which are optional. You must provide the clauses in a fixed order.
• The pattern-matching operators provided by the IPF SQL Interface conform to those
used by standard SQL. That is, an underscore ( _) character matches any single
character, and the percent sign ( %) matches any string of zero or more characters.
IPF 1100 EDIT 1100, however, uses the question mark ( ?) and the asterisk ( *) to
provide the same functions in editing sessions. If you have both the IPF SQL
Interface and IPF 1100 EDIT 1100 installed, be sure to use the correct operators for
the processor you are using.
• You cannot use abbreviations for SQL statements and keywords as you can with IPF
commands, with the exception that you can abbreviate
− ASCENDING as ASC
− CHARACTER as CHAR
− DESCENDING as DESC
− DECIMAL as DEC
• All SQL statements must be preceded by the letters SQL to inform IPF that it is a
SQL statement. IPF then passes the statement to RDMS for execution.
You must observe the following rules when you use SQL statements with the IPF SQL
Interface:
• Format
Precede each SQL statement with the letters SQL, as in the following example:
SQL SELECT * FROM HOUSES
• Do not enter multiple statements following a single SQL prefix. You must repeat the
letters SQL before entering each statement.
• Continuing a SQL statement
You can continue a SQL statement to the next line by using the IPF continuation
character. The default continuation character is the ampersand ( & ), unless you
change it to something else. You can change the continuation character by using the
system variable $CONTCHAR. You cannot continue a line in the middle of a name,
number, or character string. For more information, see the IPF Command Language
User’s Guide.
• Terminating a SQL statement
You can terminate a SQL statement by using a semicolon (;). If you do not end a
statement with a semicolon, the IPF SQL interface terminates the statement.
However, do not terminate a CREATE TRIGGER, FUNCTION, or PROCEDURE
statement with a semicolon.
• SQL Comments
You may not include an SQL comment within an SQL statement submitted from IPF
SQL.
Format
@IPF
Example
í@IPF
System Response
IPF 1100 7R1A 12/08/97 [Link]
í~C~í
The first line of the response displays the level of IPF you are using, today’s date, and
the current time. The second line is the IPF prompt for input.
Format
$DATAMANAGER:=data-manager
where data-manager is the name of the data manager you plan to use.
Example
The following example specifies RDMS as the data manager:
í~C~í$DATAMANAGER:=RDMS
You must specify a data manager before you can get help on SQL statements.
Format
$SQLESCAPE:="escape-character"
where escape-character is the escape character you plan to use, enclosed in quotation
marks.
Example
The following example specifies ! as the escape character:
í~C~í$SQLESCAPE:="!"
A thread remains open until you enter an END THREAD statement or log off from IPF. If
you log off from IPF without an END THREAD statement, the system implicitly issues a
COMMIT statement followed by an END THREAD statement.
You can have only one application group open at a time. You must therefore close the
application group that is currently open with the END THREAD statement before you can
open a new application group. You must also log off from IPF and log back on before you
can open a different application group.
The BEGIN THREAD statement registers a thread with UDS and sets up the thread
working storage and environment. The BEGIN THREAD statement also specifies
Note: The IPF SQL Interface does not require a UDS message option since it always
displays available UDS messages.
For the BEGIN THREAD statement syntax, see the RDMS SQL Programming Reference
Manual.
Examples
The following example registers thread T1 with RDMS in application group UDSSRC.
Thread T1 cannot update the database.
The next example registers thread PUBS in application group UDSSRC. Thread PUBS
can update the database; any updates use the COMMANDLOOKS recovery option.
Without the COMMANDLOOKS recovery option, most errors cause a rollback to the
beginning of the current step. The current step includes everything you have done since
the last time you executed a BEGIN THREAD, ROLLBACK, or COMMIT statement, or
since the system automatically rolled back the thread because of an error.
If you have a large number of updates to the database, you should use QUICKLOOKS.
If you have a small number of updates, the DEFERRED recovery option is very efficient.
The NONE recovery option means that no recovery is performed in the thread. Use it
only when you are updating tables located in storage areas defined as nonrecoverable.
Use of the NONE recovery option is not recommended.
Note: Since all RDMS internal files (RDT$FILE, FDT$FILE, AUTH$FILE, and
VIEWDEP$FILE) are recoverable, you cannot create, alter, or drop tables or views, or
grant or revoke privileges from a thread using the NONE recovery option.
Format
The most general help screen is available by entering the following any time after
specifying RDMS as the data manager:
SQL ?
System Response
The IPF SQL Interface does not pass SQL statements to RDMS for execution until a
BEGIN THREAD statement has executed. Until a SQL BEGIN THREAD statement is
entered, therefore, the only SQL statements for which help is available are SQL BEGIN
THREAD and SQL FILE (a file of stored commands can contain a SQL BEGIN THREAD
statement).
After you have executed a SQL BEGIN THREAD statement, you can get help on any SQL
statement by entering the statement as illustrated in the preceding screen followed by a
question mark ( ? ).
Example
The following example is requesting help on the CREATE TABLE statement:
System Response
í**SQL203200 You use the SQL CREATE TABLE command to add a new relational
í table to your database. The format of the SQL CREATE TABLE command is:
í
í { CREATE TABLE table-specification
í ( column definition
í [ , { column-definition |
í table-constraint-specification |
í storage-area-specification |
í index-specification } ] ... )
í Note that (1) you must specify at least one column definition immediately
í after the table-specification, and (2) if you include index-specification
í in a SQL CREATE TABLE command, it must be the last element of the
í command.
í Except for these restrictions, you may specify the elements of the SQL
í CREATE TABLE command in any order.
í
í
í
í
í
í
On the screen, CREATE and all words in uppercase letters are keywords; table-name and
all words in lowercase letters are variables (you supply a value). You select one of the
words enclosed in braces ( { } ); words enclosed in brackets ( [ ] )are optional. Ellipses
(. . .) mean repeat if desired.
You can get additional help by entering a single question mark. You can continue to enter
single question marks until you get this message:
Describe
Inventory
Library
Pack
Position Run
XQT
The following IPF commands may automatically commit changes to the database if a
thread is open, depending on the operation or procedure:
“Call”
Condition Copy
Execute
For more information about IPF commands, see the IPF Command Language User’s
Guide.
Use the COMMIT statement only if a thread is open. When you close a database with
the END THREAD statement, the system automatically commits the changes for you.
Committing a thread releases all implicit locks and all explicit locks for which an UNLOCK
statement has successfully executed.
Example
The following example writes all updates for the current step since the last thread
control operation, or COMMIT or ROLLBACK statement, to the database:
SQL COMMIT
• You make several updates to the database and want to commit the changes only if
you can apply them all. If any one of the updates is unsuccessful and causes an
error, you can use the ROLLBACK statement to discard all updates made by the
step.
• You make temporary updates to generate a “what if” report. In this case, you can
discard all changes to the database with a ROLLBACK statement when you have all
the information you need.
Rolling back a thread releases all implicit locks and all explicit locks for which an
UNLOCK statement has successfully executed.
Example
The following example ends the current recovery step and discards any updates to the
database made since the last BEGIN THREAD, COMMIT, or ROLLBACK statement:
SQL ROLLBACK
Examples
The following example ends the current thread:
The next example, with its TERMINATE recovery step counter option, ends both the
current thread and the current recovery step counter:
LOGOFF
Example
í~C~íLOGOFF
System Response
íEND IPF
í
The last, unaccompanied SOE character (í) indicates you are no longer in IPF.
Note: If you log off without entering the END THREAD statement, all pending updates
are automatically committed to the database. If you do not wish to make the updates
permanent, you must roll them back with a SQL ROLLBACK statement before you log
off from the IPF SQL Interface.
You can use the FILE command to enter a series of SQL statements that exceeds the
number of characters you can enter directly on the terminal.
Format
SQL FILE filename
Examples
SQL FILE abc*infile.
SQL FILE abc*[Link]
SQL FILE abc*[Link]/ver1
SQL FILE inelt
If you enter the element name without a directory, the IPF working directory is searched
for the element.
• The file you name on the FILE command can be in a directory or in a data file. If you
name a directory, you must specify an element.
• The file must contain one or more SQL statements. Each statement must begin with
SQL. Each line of a statement, except the last line, must end with a continuation
character. The continuation character must match the value of the IPF system
variable $CONTCHAR. The default is the ampersand ( & ).
• You cannot use the FILE command as one of the statements in the file.
• If a thread is not open when you use a FILE command, the first statement in the file
must be BEGIN THREAD.
• If an incorrect read/write key is entered, the Exec aborts. For more information, see
the ER Programming Reference Manual.
• If the contents of the file specified on the FILE command is blank or empty, the SOE
character (í) is returned. No error message is returned. Blank lines do not stop
processing.
The following example illustrates the contents of a file (INELT) in the IPF home directory
that contains SQL statements:
í~C~íold inelt
í~C~íprint all
íSQL SELECT * FROM &
í CUSTOMERS WHERE &
í Desiredloc='Woodbury'
íSQL INSERT INTO HOUSES &
í (Hno,Price,Location,Description) &
í VALUES ('H102',80000,'Plymouth','Bi-level')
í~C~í
When you enter a FILE command, the IPF SQL Interface accesses the specified file, and
then reads, displays (see below), and executes each SQL statement. The IPF SQL
Interface executes all SQL statements in the file, even if it detects an error in the
execution of a statement.
You can determine whether or not you want the FILE command to display the SQL
statements by setting the $SQLFILEDISPLAY system variable to a value or TRUE or
FALSE:
• When $SQLFILEDISPLAY is set to TRUE, the FILE command displays all SQL
statements in the file.
• When $SQLFILEDISPLAY is set to FALSE, the FILE command displays no SQL
statements at all. It does, however, read and execute the statements, and it displays
any error messages resulting from their execution.
You can handle large output from the IPF SQL Interface two ways: You can direct the
output to a file or you can use full-screen mode.
Example
The following example illustrates the use of the OUT command to save query results in a
file:
í~C~íCREATE FILE=outfile.
í~C~íOUT FILE=outfile.
This informs IPF that the destination file for the OUT command is OUTFILE.
This SELECT statement instructs the IPF SQL Interface to display the contents of the
CUSTOMERS table.
í~C~íOUT FILE=TERMINAL
This informs IPF that the destination file for the OUT command is once again the
terminal.
í~C~íOLD FILE=outfile.
The OLD command copies the contents of the file OUTFILE into the IPF workspace.
You can now examine the data on the screen, or you can copy the file to a printer to
obtain a hard copy.
Note: If you are in IPF full-screen mode and you set $SQLSCREEN := TRUE, IPF
ignores the OUT command. For more information about full-screen displays of SQL
queries, see 10.4.2.
• Results can scroll off the screen faster than you can read.
• Results might be too wide to fit on a single line of the screen, making them hard to
understand.
• Sometimes you may need to abort the output from a query because the amount of
information it produces is just too large. For example, if you have a large database,
you can have thousands of rows of data coming from a query.
In these cases, you can direct the output to a file, as described in 9.4.1. But if all you
need is to slow the query results and make the output easier to read, you may find the
SQL full-screen mode helpful.
SQL full-screen mode is not the same as IPF screen mode. IPF screen mode does keep
output from scrolling off the screen so fast that you cannot read it, and it lets you abort
long output listings. But if the output from a query produces rows too wide to fit on one
line on the screen, IPF screen mode does nothing to make them more readable.
SQL full-screen mode, an enhancement to the IPF screen mode, provides for SQL query
output that is too wide and too lengthy for line mode or IPF screen mode.
Format
To use SQL full-screen mode, first enter IPF screen mode by entering
MODE SCREEN
For more information on using IPF in full-screen mode, see the IPF Command Language
User’s Guide.
Note: You can use the IPF OUT command to redirect output to a file in IPF screen
mode if $SQLSCREEN is FALSE. If $SQLSCREEN is TRUE, IPF ignores the OUT
command.
After entering MODE SCREEN, you are in IPF screen mode. Now enter the following on
the command line to use SQL full-screen mode:
$SQLSCREEN:=TRUE
The screen looks the same as before; however, SQL queries now receive special
handling as discussed in the rest of this subsection.
Notes:
1. The default value of $SQLSCREEN is FALSE. To use the SQL full-screen mode
feature, you must set $SQLSCREEN to TRUE.
2. For SQL queries to receive special handling, both $SQLSCREEN must be TRUE and
you must execute a MODE SCREEN command.
3. When you have both MODE SCREEN set and $SQLSCREEN is TRUE, only SQL
queries are affected. All other IPF operations function as they normally do in IPF
screen mode.
4. When $SQLSCREEN is set to TRUE, the maximum character size of a retrieved row
is 2800. When $SQLSCREEN is set to FALSE, the maximum character size of a
retrieved row is 12000.
In SQL full-screen mode, you see one screen at a time. You control when the next
screen is presented. And if the output is too wide for one line, you can shift the output to
the left and back to the right as needed. Use the fields at the bottom of the screen to
specify whether you want the next screen of output or a shift to the right or left. You can
specify the number of characters to shift using the right or left fields, or you can let the
IPF SQL Interface shift a screen width automatically. You can also put the number of
lines to scroll forward in the go field. You cannot scroll backwards.
When you have seen all the output, or if you want to discard unwanted output, transmit
from the done field.
Example
In this example, which includes eight screens, the SQL statement was intentionally
designed to produce too much output for line mode to handle conveniently.
STOREN at VINTNU
UM---- -------name-------- ------address------- -----city------e- -zip- M----
1 trumpetvine wines trumpetvine court berkeley ca 94704 1
1 trumpetvine wines trumpetvine court berkeley ca 94704 2
1 trumpetvine wines trumpetvine court berkeley ca 94704 3
1 trumpetvine wines trumpetvine court berkeley ca 94704 4
1 trumpetvine wines trumpetvine court berkeley ca 94704 5
1 trumpetvine wines trumpetvine court berkeley ca 94704 6
1 trumpetvine wines trumpetvine court berkeley ca 94704 7
1 trumpetvine wines trumpetvine court berkeley ca 94704 8
1 trumpetvine wines trumpetvine court berkeley ca 94704 9
2 freds market 1940 university ave. berkeley ca 94704 1
2 freds market 1940 university ave. berkeley ca 94704 2
2 freds market 1940 university ave. berkeley ca 94704 3
2 freds market 1940 university ave. berkeley ca 94704 4
2 freds market 1940 university ave. berkeley ca 94704 5
2 freds market 1940 university ave. berkeley ca 94704 6
2 freds market 1940 university ave. berkeley ca 94704 7
2 freds market 1940 university ave. berkeley ca 94704 8
2 freds market 1940 university ave. berkeley ca 94704 9
3 college ave. liquor 1300 college ave. oakland ca 94577 1
3 college ave. liquor 1300 college ave. oakland ca 94577 2
go ____ left ____ right ____ done __
To shift the screen a screen width to the right, transmit from the right field:
----------NAME----------- --------LOCATION--------
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
almaden vineyard san jose ca
beringer vineyards st. helena ca
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
beaulieu vineyard rutherford ca
grgich hills cellar rutherford ca
inglenook vineyards san francisco ca
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
almaden vineyard san jose ca
beringer vineyards st. helena ca
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
beaulieu vineyard rutherford ca
grgich hills cellar rutherford ca
inglenook vineyards san francisco ca
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
go ____ left ____ right ____ done __
Transmit from the left field to get back to column 1, and then transmit from the go field
to get the next screen:
STOREN at VINTNU
UM---- -------name-------- ------address------- -----city------ e- -zip- M---
3 college ave. liquor 1300 college ave. oakland ca 94577 3
3 college ave. liquor 1300 college ave. oakland ca 94577 4
3 college ave. liquor 1300 college ave. oakland ca 94577 5
3 college ave. liquor 1300 college ave. oakland ca 94577 6
3 college ave. liquor 1300 college ave. oakland ca 94577 7
3 college ave. liquor 1300 college ave. oakland ca 94577 8
3 college ave. liquor 1300 college ave. oakland ca 94577 9
4 the wine shoppe 105 university walk berkeley ca 94704 1
4 the wine shoppe 105 university walk berkeley ca 94704 2
4 the wine shoppe 105 university walk berkeley ca 94704 3
4 the wine shoppe 105 university walk berkeley ca 94704 4
4 the wine shoppe 105 university walk berkeley ca 94704 5
4 the wine shoppe 105 university walk berkeley ca 94704 6
4 the wine shoppe 105 university walk berkeley ca 94704 7
4 the wine shoppe 105 university walk berkeley ca 94704 8
4 the wine shoppe 105 university walk berkeley ca 94704 9
5 epstein wine vine 1000 liquor lane richmond ca 94777 1
5 epstein wine vine 1000 liquor lane richmond ca 94777 2
5 epstein wine vine 1000 liquor lane richmond ca 94777 3
5 epstein wine vine 1000 liquor lane richmond ca 94777 4
go ____ left ____ right ____ done __
To shift the screen a screen width to the right, transmit from the right field:
----------NAME----------- --------LOCATION--------
almaden vineyard san jose ca
beringer vineyards st. helena ca
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
beaulieu vineyard rutherford ca
grgich hills cellar rutherford ca
inglenook vineyards san francisco ca
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
almaden vineyard san jose ca
beringer vineyards st. helena ca
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
beaulieu vineyard rutherford ca
grgich hills cellar rutherford ca
inglenook vineyards san francisco ca
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
almaden vineyard san jose ca
beringer vineyards st. helena ca
go ____ left ____ right ____ done __
Transmit from the left field to get back to column 1, and then transmit from the go field
to get the next screen:
STOREN at VINTNU
UM---- -------name-------- ------address------- -----city------ e- -zip- M---
5 epstein wine vine 1000 liquor lane richmond ca 94777 5
5 epstein wine vine 1000 liquor lane richmond ca 94777 6
5 epstein wine vine 1000 liquor lane richmond ca 94777 7
5 epstein wine vine 1000 liquor lane richmond ca 94777 8
5 epstein wine vine 1000 liquor lane richmond ca 94777 9
6 northside wines 130 euclid ave. berkeley ca 94711 1
6 northside wines 130 euclid ave. berkeley ca 94711 2
6 northside wines 130 euclid ave. berkeley ca 94711 3
6 northside wines 130 euclid ave. berkeley ca 94711 4
6 northside wines 130 euclid ave. berkeley ca 94711 5
6 northside wines 130 euclid ave. berkeley ca 94711 6
6 northside wines 130 euclid ave. berkeley ca 94711 7
6 northside wines 130 euclid ave. berkeley ca 94711 8
6 northside wines 130 euclid ave. berkeley ca 94711 9
7 j.v. liquor 1614 university ave. berkeley ca 94706 1
7 j.v. liquor 1614 university ave. berkeley ca 94706 2
7 j.v. liquor 1614 university ave. berkeley ca 94706 3
7 j.v. liquor 1614 university ave. berkeley ca 94706 4
7 j.v. liquor 1614 university ave. berkeley ca 94706 5
7 j.v. liquor 1614 university ave. berkeley ca 94706 6
go ____ left ____ right ____ done __
To shift the screen a screen width to the right, transmit from the right field:
----------NAME----------- --------LOCATION--------
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
beaulieu vineyard rutherford ca
grgich hills cellar rutherford ca
inglenook vineyards san francisco ca
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
almaden vineyard san jose ca
beringer vineyards st. helena ca
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
beaulieu vineyard rutherford ca
grgich hills cellar rutherford ca
inglenook vineyards san francisco ca
joseph phelps vineyards st. helena ca
long vineyards st. helena ca
almaden vineyard san jose ca
beringer vineyards st. helena ca
geyser peak vineyards geyserville ca
fetzer vineyards redwood city ca
go ____ left ____ right ____ done __
Transmit from the left field to get back to column 1, and then transmit from the go field
to get the next screen:
STOREN at VINTNU
UM---- -------name-------- ------address------- -----city------ e- -zip- M---
7 j.v. liquor 1614 university [Link] ca 94706 7
7 j.v. liquor 1614 university [Link] ca 94706 8
7 j.v. liquor 1614 university [Link] ca 94706 9
63 records selected
Note the 23 entered in the right field on the preceding screen. Entering 23 and
transmitting from that position causes the IPF SQL Interface to shift the next screen only
23 columns to the right instead of the default screen width and results in the following
screen:
st
at VINTNU
--- ------address------- -----city------ e- -zip- M----- ----------NAME--------
1614 university ave. berkeley ca 94706 7 beaulieu vineyard
1614 university ave. berkeley ca 94706 8 grgich hills cellar
1614 university ave. berkeley ca 94706 9 inglenook vineyards
Now transmit from the done field to return to the IPF command line.
You can place SQL statements in IPF files and procedures to test the SQL statements
you plan to have in an application without having to repeatedly compile and execute the
application.
You can use SQL cursor operations to manipulate the data retrieved by a query one row
at a time. For example, if a real estate sales agent retired, you might want to retrieve all
the houses that agent had listed and assign them to other agents.
Using cursors, you can easily specify all the houses the retired agent listed with a single
query. Then you can update each one of them, assigning each to the agent best qualified
to sell the house.
The IPF SQL Interface supports most SQL cursor operations, including $ DECLARE
CURSOR
• DROP CURSOR
• CLOSE
• FETCH
The IPF SQL Interface does not support the following SQL cursor operations:
• OPEN
• LOCATE
• The IPF SQL Interface does not support the use of placeholder variables on the
DECLARE CURSOR statement
• You cannot specify an ORDER BY or WITH DESCRIPTION clause on the DECLARE
CURSOR statement
• The IPF SQL Interface supports only sequential access cursors; random or direct
access cursors are not supported
• The syntax for the FETCH statement is slightly different for the IPF SQL Interface
than for other RDMS interfaces
• The IPF SQL Interface supports a maximum of five cursors to be declared at any one
time
Example
The following example selects all houses with an asking price less than or equal to the
buyer’s maximum price:
Once a cursor has been dropped, you must declare it again before you can use it.
Example
The following example drops cursor MATCHPRICE, which was created in the last
example:
All thread control operations close all open cursors, so closing is unnecessary just before
or just after a thread control operation.
Example
The following example closes cursor MATCHPRICE:
Format
SQL FETCH [option] cursor-name INTO a1 [b1] [, a2 [b2]]. . .
where SQL, FETCH, and INTO are keywords and must be entered.
option
is optional and must be one of the following:
cursor-name
is the name of the cursor from which the row is being fetched.
a1
is an IPF variable into which RDMS places the value of a column. You need a
separate variable for each column specified in the query specification of the cursor
declaration. Separate variables with commas.
b1
(optional) is an IPF indicator variable. You need an indicator variable for each column
specified in the query specification of the cursor declaration that can contain a null
value (see 11.2.2).
Example
The following example is retrieving a row of four columns from cursor C1:
The IPF SQL Interface uses the following rules for variable substitution:
• Begin the IPF variable name with a special character followed by 1 to 32 letters,
numbers, and underscores:
− The special character is % for IPF user variables and $ for IPF system variables.
− The first character following the special character must be a letter.
− You cannot have two underscore characters in a row.
• Use an escape character, which is the value of the IPF variable $SQLESCAPE whose
default value is the backslash ( \ ), to remove any special meaning from a special
character.
• Use a tilde ( ~ ) to mark the end of a variable name when the character that
immediately follows could be part of the variable name.
set %v1:="variable1"
set %v2:="variable2"
set %v3:="variable3"
The following table illustrates the results of various combinations before and after
substitution:
Concatenation is achieved by juxtaposing the two variable names. Unlike other IPF
components, no concatenation operator is available.
• $SQLERROR contains the last error number reported to you by the IPF SQL
Interface.
This error number is the number that appears in the prefix of an IPF SQL Interface
error message.
• $SQLCODE contains the SQL standard error code number:
− 0 means that the SQL command executed normally.
− +100 means that either no data or no further data exists. This status is returned
whenever the interpreter interface returns ‘6001’ or if a DELETE, INSERT, or
UPDATE statement does not affect a row.
− n, where n is a negative number, is the error code that the interpreter interface
would have returned ($SQLRETURNCODE).
• $SQLRETURNCODE contains the status code returned from RDMS.
• $SQLAUXILIARY contains the auxiliary status information returned by RDMS.
Table 11-1 explains how to interpret the value in $SQLAUXILIARY.
Note: The IPF system variable $SQLSCREEN controls how IPF SQL Interface query
results are displayed. It is used in conjunction with IPF screen mode. $SQLSCREEN can
be set to either TRUE or FALSE, with FALSE as the default. In IPF line mode,
$SQLSCREEN is ignored. In IPF screen mode, $SQLSCREEN controls the query result
display. For more information on $SQLSCREEN, see 10.4.2.
Examples
The following example illustrates a SQL FETCH statement using indicator variables (IPF
indicator variables are prefaced with IND):
• Creates a table
• Populates the table
• Fetches rows from the table using indicator variables
í~C~í$data:=rdms
**** Create a table with 2 character columns, the first column does not
**** allow NULLS and the second column does.
í~C~ísql create table example in s1.c1 columns are col1 char(10) NOT NULL, &
í~C~ícol2 char(15) primary key k1 is col1
The CREATE TABLE statement completed successfully.
**** Declare a cursor against this table, so that we may fetch against it.
í~C~ísql declare c1 cursor select col1, col2 from example
The DECLARE CURSOR statement has completed successfully.
**** Fetch from the declared cursor. In the first row in this table, COL2
**** has a NULL, so an indicator variable must be used. The indicator
**** variable returns a negative value. (Since COL1 does not allow nulls,
**** an indicator variable is optional.)
í~C~ísql fetch c1 into %col1 %ind1, %col2 %ind2
The FETCH statement has completed successfully.
í~C~ídisplay %col1
abc
í~C~ídisplay %ind1
00
í~C~ídisplay %col2
í~C~ídisplay %ind2
-1
**** Fetch the next record. This record does not have any nulls, therefore
**** indicator variables are optional.
í~C~ísql fetch c1 into %col1 %ind1, %col2 %ind2
>The FETCH statement has completed successfully.
í~C~ídisplay %col1
def
í~C~ídisplay %ind1
00
í~C~ídisplay %col2
pqrstuvwxyz
í~C~ídisplay %ind2
00
IPF procedures use IPF variables to check, set, or change the values used by the
procedure. The variables are checked in flow of control instances, and a decision is made
based on the values of the variables.
To get error messages returned from RDMS when using IPF procedures, you must set
the IPF system variable $PROCDEBUG:=ON.
Example
This procedure
• Creates two tables (the files were cataloged and the UREP work done before this
IPF SQL Interface session)
• Populates the first table
• Uses the FETCH statement to retrieve data from the first table
This data is used to populate the second table using the INSERT statement.
**** Turn on all completion and error messages so they are printed
í~C~í100 $procdebug:=on
**** Fetch the first row using IPF variables and indicator variables
í~C~í1600 sql fetch c1 into %col1 %ind1, %col2 %ind2
**** If COL2 is null, write out the word NULL to insert a null value into
**** table DUPLICATE. Otherwise, use the retrieved variables to insert the
**** value into table DUPLICATE.
í~C~í2200 if %ind2 < 0
í~C~í2300 sql insert into duplicate values( %col1, NULL)
í~C~í2400 else
í~C~í2500 sql insert into duplicate values( %col1, %col2)
í~C~í2600 endif
**** Undo everything done in the thread and end the thread.
í~C~í3300 sql rollback
í~C~í3400 sql end thread
**** Make the file an IPF file type so it can run as a procedure
í~C~ítype ipf
DUPLICATE
COL1- col2
0 records were selected.
The DECLARE CURSOR statement has completed successfully.
The FETCH statement has completed successfully.
1
00
-1
1 records were inserted.
The FETCH statement has completed successfully.
2
00
2
00
1 records were inserted.
The FETCH statement has completed successfully.
3
00
3
00
1 records were inserted.
**SQL200860 An end of cursor condition has been detected by RDMS.
TABLE1
COL1- col2
1
2 2
3 3
3 records were selected.
DUPLICATE
COL1- col2
1
2 2
3 3
3 records were selected.
í~C~í
“Qualifier” in an RDMS table specification is not the same as a qualifier in the Exec file
system. In this context, it is synonymous with a UREP “schema.” For more information
about schemas, see the UREP Administration Guide.
When you create a table, you state in which storage area the table is to be stored. You
can have many versions of a table. This means that you can have a single table definition
with several different sets of data that fit that definition. For example, a real estate
agency might have one table definition for houses, but have a set of data for Minnesota,
Wisconsin, Illinois, and so on. Each such set of data is called a version of the table.
Each version of a table requires a storage area version. In turn, each storage area version
requires its own Exec file. You create Exec files with the ECL command @CAT. You use
UREP to associate Exec files with storage area versions. For more information about
storage areas and versions, see the UREP Administration Guide.
The storage area version name is the same as the table version name. The only time the
storage area version name is not the same as the table version name is when the table
version name is PRODUCTION. The table version name PRODUCTION is associated
with the blank storage area name.
Example
Assuming that the qualifier for a table is RDMS and the table name is HOUSES, you
enter the following to refer to the table:
[Link]
Example
Assuming that the table name is HOUSES and the version is PRODUCTION, you enter
the following to refer to the table:
houses: production
Version names require some care in their use with the DECLARE CURSOR, OPEN (not
supported by IPF SQL), GRANT, and REVOKE statements. For more information on
these statements and version names, see the RDMS SQL Programming Reference
Manual.
The USE DEFAULT statement establishes a new default qualifier or a new default
version name. The USE DEFAULT statement works like the ECL statement @QUAL. The
default qualifier and version name remain in effect for the life of a thread, or until you
establish new default names.
For data definition operations (CREATE TABLE, CREATE VIEW, GRANT) within a
CREATE SCHEMA statement, RDMS uses the schema name specified in the CREATE
SCHEMA statement as the qualifier.
Example
The following example uses the qualifier DRUID:
Once you enter this statement, you can still use any other qualifier as required for a
given table name. But if you omit the qualifier for any table, RDMS uses the qualifier you
specified in the USE DEFAULT QUALIFIER statement.
The USE DEFAULT QUALIFIER statement remains in effect until the end of the session
or until a new USE DEFAULT QUALIFIER statement is used.
Example
The following example uses the version name JACQUES:
Once you enter this statement, you can still use any other version name required for a
given table name. But if you omit the version for any table, RDMS uses the version
name you specified in the USE DEFAULT VERSION statement.
The USE DEFAULT VERSION statement remains in effect until the end of the session or
until a new USE DEFAULT VERSION statement is used.
A
abnormal program termination (APT)
An abrupt end to a program that can be caused by an @@X keyin or another operator
keyin.
access control
An RDMS security mechanism for preventing unauthorized users from accessing a table
or altering its definition. See also data access control; definition access control.
ACOB
The ASCII COBOL compiler call.
ad hoc search
Synonym for nonindexed search.
Ada
A sophisticated high-level programming language.
ADT
See application definition table.
aggregate function
One of the RDMS built-in functions (AVG, MAX, MIN, SUM, or COUNT) that results in
one value from multiple values in a column. See also function.
allocation page
An RDMS page that contains information about available data pages and thereby
allocates unused data and index pages in a B-tree.
anomaly
An undesirable consequence, such as loss of data or inconsistent updates, which is
eliminated when a database is normalized.
APT
See abnormal program termination.
arithmetic expression
An expression that results in a numeric value, which can include arithmetic operators
(+,-, *, and / ) and numeric literals, column references, or variables.
arithmetic operation
Any of the basic operations of arithmetic such as addition, subtraction, multiplication, and
division.
ASCII COBOL
The Unisys implementation of the COBOL programming language for basic mode.
ASCII FORTRAN
The Unisys implementation of the FORTRAN programming language for basic mode.
assignable
The characteristic of a value or data type that permits the value, or the values of the data
type, to be assigned to data objects of a specified data type.
B
B-tree
The balanced data structure used by RDMS to store data. B-trees consist of a root page,
index pages, and data pages. Each RDMS table is stored as one or more B-trees. RDMS
creates a B-tree for the primary key of a table and each secondary index.
base dump
Synonym for database dump.
base relation
Synonym for relational table.
base table
Synonym for relational table.
bind
(1) To resolve a reference to a cursor. (2) To link an application program to the proper
application group.
Boolean expression
An expression that results in a value of TRUE, FALSE or UNKNOWN.
Boolean operator
The word AND, OR, or NOT, which can be included in an SQL statement to connect or
qualify the conditions specified.
bound
Resolved or linked. See also bind.
built-in function
A predefined function that returns a value.
C
cache/disk recovery
The IRU process that recovers database updates present in cache memory after a power
outage or cache/disk subsystem failure.
cache/disk subsystem
A storage control unit of cache memory and its associated disk units.
CCS
See character set.
CD flag bit
A flag bit used by RDMS when a deleted record contains an item value compressed in
one or more undeleted records on the same page.
character repertoire
The term used by the SQL standard to refer to a character set.
character set
A group of alphabetical, numeric, and special characters used to construct the words and
other elementary units of a spoken or written language. The difference between a
character set and a coded character set (CCS) is that in a character set, each character is
an abstract concept, whereas, in a CCS, each character is associated with a specific
binary value. ISO 8859-1 is a CCS. In Unisys user documentation, the term “character
set” is used for both character set and coded character set.
character string
A sequence or group of contiguous characters connected by code or keywords.
check constraint
See constraint.
child table
A relational table defined by a foreign key. The contents of one or more columns in the
child table are restricted to the primary key values or unique index values in the parent
table.
clause
An ordered sequence of words and characters (including names and special characters)
that form part or all of a command or statement.
collation
Essentially, the sorting of characters. More specifically, the collating sequence is a set of
rules established by the cultural convention set and locale that determines how character
strings are compared in a particular character set.
column
A set of values, all of the same data type, in a set ordinal position in a relational table.
column constraint
See constraint.
column name
The name of a column in a relational table, which can also be used as an operand in an
arithmetic or Boolean expression.
column specification
A list of specific columns from a relational table. Users can select, retrieve, insert, delete,
or update data from columns in a column specification.
command
A set of syntactically correct words and clauses that instruct the system to perform a
task. A command can be divided into clauses that can be divided into phrases and
subclauses. In keeping with SQL standards in RDMS, specific SQL “commands” are
referred to as “SQL statements.”
command rollback
The recovery process that reverses the effect of a command without rolling back the
entire step.
comparable
The characteristic of two data objects that permits the value of one object to be
compared with the value of the other object.
comparison operator
Any of the various operators that compare two items of data (operands) including < (less
than), > (greater than), <= (less than or equal to), >= (greater than or equal to), = (equal
to), and f (not equal to), LIKE, NOT LIKE, IS NULL, IS NOT NULL, IN and NOT IN.
Synonymous with relational operator.
compile
To make source code executable by verifying that it is syntactically correct and
translating it into object code.
composite key
A primary key or secondary index that includes more than one column.
conceptual table
Synonym for cursor.
concurrency
The extent to which multiple users can access the same database at the same time
without conflict.
constant
A value that remains unchanged during the execution of a program. Contrast with
variable.
constraint
A restriction placed on columns or rows in a relational table, the validity of which RDMS
is responsible for maintaining. A unique or primary key constraint ensures that no rows
have the same values in a specified column or columns. A check constraint establishes a
condition that every data item or row must satisfy. A referential or foreign key constraint
restricts the values of columns in one table to the primary key values in another table. A
NOT NULL constraint ensures that a value exists for the associated column in each row
of the table.
correlated query
An outer query referenced by one or more subqueries using outer references. Contrast
with uncorrelated query.
correlation name
An alias for an RDMS table within a query specification, the most common use of which
is to join a table with itself. Formerly called “tuple variable,” which is an obsolete term.
currency
The position of a pointer in a cursor.
cursor
A named set of data extracted from one or more RDMS tables with a pointer to the
current row. Synonymous with conceptual table.
D
D-bank
A bank that contains data belonging to a program or a UDS common bank.
data bank
See D-bank.
data integrity
Data accuracy and consistency.
data item
The intersection of a column and a row in a table. The part of a row that contains one
category or entity of data such as a last name, a person’s age, or a social security
number. Items that fall into the same category in a table are listed in the same column.
See also data value.
data model
A means of organizing and representing information. See also relational data model.
data page
A portion of a table that a contains a number of data records, arranged to facilitate I/O
operations to and from the storage area and to serve as the basis for recovery of the
storage area. See also page.
data type
A description of the characteristics of the data values allowed such as numeric, date,
time, and timestamp.
data value
The specific value of a data item.
database dump
A copy of the database files as they exist at a given point during processing.
Synonymous with base dump.
DDF
See Data Definition Facility.
deadlock
A condition in which a run cannot proceed because of an unresolvable conflict by another
thread in the same application group for a system resource or facility.
decryption
The process of unscrambling encrypted data. Contrast with encryption.
definition-level lock
A lock on the FDT or RDT.
degree
The number of columns in a relational table, view, query, or subquery.
DELETE privilege
A privilege that owners of RDMS tables grant to other users to enable them to delete
rows. See also data access control.
descriptive text
The text that describes a data file (similar to comment lines in a program).
diacritical mark
A mark such as a circumflex ( ^ ) or tilde ( ~ ) added to a character to indicate a phonetic
value different from the base character. See also ISO 646:1983.
dieresis
Also spelled diaeresis. Two dots over the second of two adjacent vowels in a word to
indicate two separate sounds. In German, the two dots (Umlaut) occur over a single
vowel and indicate a change in the vowel sound caused by partial assimilation to a vowel
or semivowel in the following syllable. See also diacritical mark.
DMS
See Data Management System.
DSD
See data storage definition.
DSR
See dynamic system reconfiguration.
dump
See database dump.
dynamic ESQL
See embedded SQL.
E
embedded SQL (ESQL)
SQL statements placed in a UCS COBOL program with the special markers or delimiters,
EXEC SQL and END-EXEC. ESQL statements are compiled instead of interpreted and
take two forms: static and dynamic. Static ESQL is processed more extensively at
compile time than dynamic ESQL and thus executes faster. Dynamic ESQL receives
more extensive run-time processing than static ESQL but provides greater flexibility.
encryption
The process of scrambling user-defined data in RDMS database files to protect the
information in the files from users who are able but not authorized to access the files or
otherwise obtain some form of the data in the files. Contrast with decryption.
entity
An object in the repository that defines a piece of information to UREP, such as qualified
entity names, entity types, schemas, and tables.
equi-join
A join operation in which the comparison operator is an equal sign.
ESQL
See embedded SQL.
EUR
See encryption user routine.
exclusive lock
A lock that prevents other threads from accessing a file or page until the lock is released.
Exec
See Executive.
Executive
The Unisys core software that controls the system’s operating environment, usually
referred to as the “Exec.”
EXISTS function
See function.
explicit lock
A user-specified lock to protect data in the RDMS database.
expression
A valid combination of constants, variables, operators, and functions that perform a
computation.
F
FCP
See file control page.
FDT
See file description table.
FETCH privilege
Synonym for SELECT privilege.
flush
To remove a page from memory so that subsequent references to that page must read it
from mass storage.
foreign key
A column or columns that establish a relationship between the primary key of one table
(parent table) and a column or columns in a second table (child table). One table can be
both the parent and child table. Foreign keys limit the acceptable values for a column in
one table to the primary key or unique index values in another table.
FTN
The ASCII FORTRAN compiler call.
function
(1) In general terms, a task, operation, special purpose, or action. (2) An operation that
optionally uses one or more input parameters but always returns a single output value.
RDMS uses two types of built-in functions. An aggregate function retrieves a specific
attribute about groups of rows, such as the minimum value of a column. A system
function retrieves a dynamic value, such as the current time or user. The Boolean
existential function, [NOT] EXISTS, checks for the existence of a row and returns one of
the “truth values” (TRUE or FALSE). See also stored function.
H
High-Volume Transaction Processing (HVTIP)
A high-performance transaction processing environment.
hit record
A record that satisfies the condition of the WHERE clause in a query.
HVTIP
See High-Volume Transaction Processing.
I
I-bank
A bank that contains instructions in the form of program code.
I18N
See internationalization.
ICR
See intercept and connect routine.
implicit lock
A lock automatically created by RDMS to protect data in the database.
inconsistency
A discrepancy in a database that occurs when the same data has different values.
Inconsistencies are removed once the database is normalized.
index
See secondary index.
index page
A page with records that provide a logical access path to data pages. See also root page.
index record
A group of facts or fields used to store information about a relational table. Index records
contain a primary key value and a page number pointing to a data or index page. Index
pages contain index records.
INSERT privilege
A privilege that owners of RDMS tables grant to other users to enable them to add rows.
See also data access control.
instruction bank
See I-bank.
interactive driver
A program that enables the use of SQL statements without the need to write a program
or use IPF.
intercept function
The portion of the ICR that directs program control from users to the appropriate control
component.
internationalization (I18N)
The inclusion of the capability in a computer program of making itself adaptable to the
requirements of different native languages, local customs, and coded character sets,
thus allowing for localization.
interpreted command
A command or statement that is analyzed and executed at run time.
interpreter interface
An interface between RDMS and UCS COBOL, UCS FORTRAN, UCS C, ASCII COBOL,
ASCII FORTRAN, IPF SQL, or MRI in which each SQL statement is passed to RDMS and
interpreted each time it is encountered during program execution.
IPF
See Interactive Processing Facility.
IPK
See implicit primary key.
ISO
Abbreviation for International Standards Organization, which sets standards for computer
processing.
ISO 646:1983
A 7-bit coded character set for information interchange. The reference version of the
character set in the standard includes the US ASCII alphanumeric characters and many of
the special characters. The standard provides for 12 character positions that can be
adapted for regional needs. Several nationalized versions of the standard are used by
other countries to represent characters with diacritical marks found in most European
languages.
ISO 8859-1:1987
An 8-bit single-byte coded graphic character set. This standard character set comprises
191 graphic characters that cover the requirements of most West European languages.
Synonymous with Latin Alphabet No. 1 and LATIN1.
IRU
See Integrated Recovery Utility.
J
join
A relational operation that combines rows from two or more tables. See also equi-join;
hybrid hash join; merge join; nested loop join; semi-join.
K
kanji data
Japanese characters represented in a 16-bit code.
key
See composite key; foreign key; primary key.
key compression
The RDMS process of condensing or squeezing together data and index records when a
record contains leading key values that are the same as the leading key values of the
logically preceding record.
key item
A special item or set of items within a row that uniquely identifies the row. Key items for
each row within a table must be unique.
keyword
A word that must occur in an SQL statement to make it syntactically correct. See also
reserved word.
L
LATIN1
Synonym for Latin Alphabet No. 1. See ISO 8859-1:1987.
LETS-J
A Unisys proprietary coded character set that defines a 2-byte encoding for kanji
characters.
literal
An alphanumeric character string that provides the value for the data item it represents.
Synonym for constant.
LINC
The Unisys software product that defines a general methodology to handle business
applications. LINC provides solutions based on the nature of the problem and does not
demand an understanding of the specifics of a data model.
load factor
The highest percentage of space used for loading each index and data page in an RDMS
file or each data page in a DMS area.
loading
The process of moving large amounts of data into a database. See also RDMS Utility
processor.
locale
The environment (or, more precisely, a set of rules) under which the user is operating,
which determines the character set, language, and collating sequence used as well as
the conventions for displaying date, time, and currency.
localization
Establishing the capability on a system of enabling users to work in their native language
using a familiar character set and conventions. See also internationalization.
lock
A security mechanism for controlling access to data in tables and files, as well as to
definitions in the repository. Locking ensures data integrity and controls concurrent
access to data and resources.
locking conflict
A condition that occurs when more than one user tries to access or lock a table or page
at the same time.
locking mode
The scope of a lock on a table. Users can define the mode—exclusive, protected, or
shared—explicitly (for example, with a LOCK statement in RDMS) or the LDM can define
the mode implicitly.
locking usage
The attribute—retrieval or update—that specifies the type of lock designated explicitly by
a user or implicitly by the LDM.
logical I/O
A request for data from an LDM to UDS Control. Contrast with physical I/O.
logical operation
A mathematical action performed on the Boolean operands AND, OR, and NOT.
long recovery
The IRU process that restores an inconsistent database to a consistent state by
recovering database updates, messages, and queue items for all steps that were
committed before the failure occurred. Long recovery also restores updates for steps in
the ready state at the recovery end point to a UDS retention file (when necessary). Users
can elect to recover just the database, just the messages, just the queue items, or any
combination of these.
M
MAPPER Relational Interface (MRI)
The Unisys software product that establishes an online interface between the MAPPER
system and an RDMS database.
MCB
See Message Control Bank.
medium recovery
The IRU process that uses data from the audit trail and UDS retention files to recover
deferred update program steps that did not complete update actions when a host or
component failed and to roll back updates for the quick-look program steps that were
active when the host or component failed. Synonymous with deferred update recovery.
merge join
One of the methods used by RDMS to perform a join operation. RDMS uses the merge
join to equally join the two outermost tables when the outer table has more than an
RDMS internally defined number of hit records and the inner table uses an index search
on the join columns.
meta-database
A database that contains information about other databases.
MHFS
See Multi-Host File Sharing.
MHTIP
See Multi-Host Transaction Processing
MRI
See MAPPER Relational Interface.
N
negative zero
A condition in earlier releases of RDMS in which a negative sign is automatically placed
in front of a zero. RDMS automatically converts the negative sign to positive.
nonindexed search
A sequential search through the data pages of a B-tree to find the specified data. Usually
a slow method of accessing data, nonindexed searches are used when the primary key
or secondary index columns to locate desired data are not specified. Synonymous with
ad hoc search; brute force search.
nonrecoverable step
A step within a thread or run unit that cannot be recovered if a system error occurs.
normalization
The process of dividing large tables that refer to many objects into smaller tables that
refer to one object. See also first normal form; second normal form; third normal form.
null value
An undefined value.
numeric constant
The representation of a unique numeric value that cannot be changed.
O
operand
A piece of data upon which an arithmetic or Boolean operation is performed (for
example, ADD X or AND X, where X is the operand).
operation
(1) In general terms, the action or process of performing the action specified by a
command or program, including but not limited to, arithmetic operations. (2) In arithmetic
expressions, a combination of at least one operator and one operand (for example, ADD
X, where ADD is the operator and X is the operand).
operator
(1) The action portion of an arithmetic or logical operation (for example, ADD X, where
ADD is the operator). (2) The person who performs basic system operations such as
mounting tapes and responding to console messages by manipulating computer
controls, usually from a system console.
ordering key
A binary sortable key created from a character string using a culturally sensitive set of
transformation rules.
outer query
An RDMS SELECT statement with one or more SELECT statements embedded within it.
See also subquery.
outer reference
A reference in an RDMS subquery to a column that belongs to a table defined or
specified in an outer query or subquery.
owned schema
A schema created by the CREATE SCHEMA statement, in which the creator of the
schema is implicitly the owner of all tables and views created within the schema.
owner
For owned schemas and their underlying tables and views, the creator of the schema;
for tables in unowned schemas, the user specified in the OWNER IS clause of the
CREATE TABLE or ALTER TABLE statement; for views in unowned schemas, the creator
of the view. Owners of tables and views determine who can and cannot access the data.
P
page
A physical memory block that constitutes a subdivision of and measurement for areas.
Page size can vary from area to area. Each page contains header information, zero or
more records, and a page slot table. A DMS page may also contain CALC chain headers.
I/O (that is, the exchange of data between a storage device and main storage) occurs at
the page level. See also data page; index page.
page header
The part of the file control page that contains general information about the file.
page-level locking
The process that locks out a page of a file or record so that other programs or
applications cannot access the data on the page until the lock is released. Page-level
locking is faster than record-level locking.
page number
A unique identifying integer assigned to each data page or index page in a B-tree.
parent table
The table referenced by the child table in a foreign key. The parent table’s primary key
values determine the acceptable values for a column or columns in the child table.
physical file
Synonym for mass storage file.
physical I/O
The actual transfer of data from a file to main storage. Contrast with logical I/O.
placeholder variable
A place to hold values in an interpreted SQL statement. Each placeholder variable is
associated with a host program variable.
population
The number of records in a B-tree.
positive zero
A condition in RDMS in which a positive sign is automatically attached to a zero. If a
negative sign is attached to a zero, RDMS automatically converts it to a positive sign.
predicate
A simple Boolean expression that contains at least one value expression (for example, a
column, a literal, an arithmetic expression, or a built-in function) that evaluates to one of
the truth values, TRUE, FALSE, or UNKNOWN. A predicate in its most common form
consists of two value expressions separated by a comparison operator. Predicates can
be connected by Boolean operators to create more complex Boolean expressions.
primary key
A column or group of columns that uniquely identifies each row in a table. A primary key
that includes more than one column is a composite key.
privilege
A security mechanism that enables owners of tables to grant other users access to the
contents of a table. Privileges include retrieving, updating, inserting, deleting, and
referencing data. See also data access control.
projection
An operation that selects some or all columns from an existing table.
protected lock
A lock that prevents other threads from changing a file or page until the lock is released.
Q
QLP
See Query Language Processor.
qualifier
The first segment of a table or view specification, which is prefixed to a table name to
reduce ambiguity. A name used to prefix another name to ensure uniqueness.
query
A request for information from a database that does not update the database.
Specifically, an SQL statement that requests information.
query specification
A specification of the information to be selected: the columns and the table or tables in
which the columns reside, as well as any conditions to be imposed on the rows that
contain the specified columns and any calculations or other manipulations of the
information used to identify it.
quick-look recovery
The process that copies a data page before it is updated so that the copy can be used
later for recovery.
R
random access cursor
An RDMS cursor that enables the use of the LOCATE statement to position the pointer
in a cursor.
RDI
A MAPPER system run used to access an RDMS database. RDI stands for “Relational
Database Interface.”
RDM
See relational data manager.
RDMCA
See relational data management communications area.
RDMSIZE
See RDMS sizing utility.
RDMS table
See relational table.
RDMUTL
See RDMS Utility processor.
RDT
See relation description table.
RDT$FILE
A file that contains all RDMS table descriptions. See also relation description table.
record
Synonym for row.
record-level locking
The process that locks out a record so that other programs or applications cannot access
the data in the record until the lock is released. See also page-level locking.
recovery
Any process that restores a database or other files to a consistent state following a user
error or a hardware or software failure. See also long recovery; medium recovery; short
recovery.
redundancy
An incidence of repeated data in the database. Redundancies are removed once a
database is normalized.
reference resolution
The process by which computer software scans a symbolic name and translates it into
an actual address in storage.
referential constraint
See constraint.
relation
See relational table; relational view.
relation code
A code that uniquely identifies a B-tree within a storage area, assigned by UREP for each
B-tree of a table whenever an RDMS table is defined.
relational command
A command used to manipulate a relational database. See also Structured Query
Language.
relational database
A database organized into one or more relational tables.
relational operator
Synonym for comparison operator.
relational table
A two-dimensional arrangement of data. The columns of the table are also known as
items, fields, or attributes. The rows of the table are also known as records or tuples.
Tables are actual collections of data physically stored in the computer. Synonymous with
base relation; base table; table.
relational view
A conceptual table that represents a restriction, projection, or join of one or more tables.
Synonymous with view.
REPORT command
A UREP command that enables users to retrieve and print listings of repository
information associated with an individual entity (for example, a storage area or
relationship).
repository
The database that contains UREP information, such as symbolic table and storage area
definitions for an RDMS database. See also Unisys Repository Manager.
repository command
A UREP command that performs operations on the repository and sends instructions to
other UDS components.
reserved word
A word reserved by Unisys or a Unisys product for special use. For RDMS specifically, a
keyword that cannot be used as an identifier or name.
restriction
An operation that constructs a conceptual table (cursor) by selecting all or some rows
from existing tables.
retrieval lock
A user- or system-specified lock on a file or page intended to allow only the retrieval of
data from the file or page and coinstantaneously restrict other threads from accessing
the affected data.
retrieve
To extract selected data from a database.
RFA
See Relational File Analyzer.
rollback
The recovery process that reverses (that is, rolls back) all uncommitted updates and
restores the database to the state that existed at the beginning of the recoverable step.
RLP
See Record Lock Processor.
root page
The index page at the top of a B-tree.
row
A set of relational information treated as a unit. In a table, each row of information is a
record. In a cursor, each occurrence of the specified data is a record. A record includes
one or more columns. Synonymous with tuple.
row-level lock
A lock on an individual row or an entire page within a table.
RSA
See Relational Syntax Analyzer.
RSM
See relational storage manager.
S
schema
A description of the database as it exists on mass storage that describes units of data
such as storage areas, tables, record types, and relations
schema name
The name that uniquely identifies the units of data associated with a particular schema.
See also qualifier.
scratch bank
An application-level bank used only by RDMS for working storage.
SDF
See system data format.
secondary index
One or more columns of a relational table. Secondary index values can be specified to
find particular data values in an RDMS table more efficiently. RDMS uses secondary
indexes to choose the best access strategy for finding the data desired. See also primary
key.
sector address
The mass storage address of a page in a file.
security
The protection of a database from unauthorized access. See also data access control;
definition access control.
select list
The list of columns specified in a query specification.
SELECT privilege
A privilege granted by owners of RDMS tables to other users to enable them to retrieve
data. Synonymous with FETCH privilege. See also data access control.
semi-join
A join operation in which the last table in the join has no columns projected and a global
DISTINCT is specified in the select list.
serializability
An optional, configurable locking strategy that can be implicitly employed by RDMS to
ensure that if concurrent users are updating or reading a database, the results of their
activities appear as though they happened in order instead of at the same time.
SFS
See Shared File System.
shared lock
A lock that guarantees that records read by one user are not changed by another user for
the duration of a step.
short recovery
The process that recovers an inconsistent database to a consistent state if the database
is in an inconsistent state because program steps did not complete update actions
because of a host or component failure. Short recovery is also used to restart an
application group after medium or long recovery.
snapshot
A collection of sorted or grouped records.
SQL
See Structured Query Language.
SQLCODE
The standard SQL 89 variable used to check for the successful completion of an SQL
statement. SQLCODE is an integer.
SQL routine
A stored procedure or stored function.
SQLSTATE
The standard SQL 92 variable used to check for the successful completion of an SQL
statement. SQLSTATE is 5 characters long and consists of a 2-character class and a
3-character subclass.
static ESQL
See embedded SQL.
step
A recoverable or nonrecoverable unit of work, such as an application program or part of a
program. Steps are the smallest recoverable unit of a thread. Each step begins and ends
with a thread control command or rollback caused by an error. Users can recover
recoverable steps to restore the database to a consistent state. See also step control.
step control
An Exec integrated recovery component that uses queues and queue items to record
and update the current state of all steps accessing the database within a recoverable
application group. Step control provides central control information for the other
integrated recovery components.
storage area
A UDS database file—actually stored in an Exec or TIP file (for RDMS, the data stored in
one or more relational tables; for DMS, an area of records; for SFS, a file of PCIOS or
SFS data).
stored function
A stored procedure that returns a value to the caller.
stored procedure
An executable database object (usually, a number of SQL statements) stored in the
database that can be called from a client or host application.
string literal
A character or characters enclosed in apostrophes (sometimes referred to as “single
quotation marks”) to indicate a literal value.
subquery
A query specification nested within a Boolean expression of another query expression.
The Boolean expression that references the subquery can be part of either the WHERE
or HAVING clause.
syntax
The format and rules for writing commands or statements.
system function
One of the RDMS built-in datetime functions, CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, and the keyword USER. See also function.
T
table
Synonym for relational table.
table constraint
See constraint.
table definition
See relational table definition.
table-level lock
A lock on an entire table.
table-level security
The level of security that enables the owner of a table to control who has access to all
versions of the table and which commands can access those versions.
table owner
See owner.
table version
See version.
TCS
See table control system.
thread
A sequence of commands from one user that constitutes a session of work centered
around one application group. The user determines when the thread begins and ends.
Threads are often referred to as “user programs” or “run units” and can be partitioned
into steps. All commands submitted to RDMS must be part of a thread. A COMMIT or
ROLLBACK statement indicates the end of a step within the thread.
thread rollback
The recovery process that reverses the effect of a thread on the database since the last
BEGIN THREAD or COMMIT statement executed.
TIP
See Transaction Processing.
TRCCTL
See trace control.
tuple
Synonym for row.
tuple variable
An obsolete term. See correlation name.
U
UCS COBOL
The extended mode compiler version of COBOL.
UCS FORTRAN
The extended mode compiler version of FORTRAN.
UDS
See Universal Data System.
UDS Control
See Universal Data System Control.
uncorrelated query
An outer query whose subquery or subqueries contain no outer references. Contrast
with correlated query.
UNION operator
A logical set operator used in RDMS to derive one table from two other tables. The result
of a UNION operation is a set of all selected rows from both tables not including
duplicates. The result of a UNION ALL operation is a set of all selected rows from both
tables including duplicates.
unique constraint
See constraint.
universal quantifier
One of the keywords ANY, ALL, or SOME when used with a comparison operator.
unloading
The moving of data from an RDMS database to an SDF file.
unowned schema
A schema created through UREP. Contrast with owned schema. See also owner.
updatable view
A relational view that can be used to alter the contents of the underlying tables. Such a
view must meet certain conditions to be updatable.
update lock
A user- or system-specified lock on a file or page intended to allow only the changing of
data in the file or page and coinstantaneously restrict other threads from accessing the
affected data.
UPDATE privilege
A privilege that owners of RDMS tables grant to other users to enable them to change
information. See also data access control.
UREP
See Unisys Repository Manager.
V
value
A numeric, alphabetic, or alphanumeric character string stored for an entity (such as an
attribute) at the address allocated for that entity. See also data value.
value expression
A subcomponent of a predicate that results in either a single numeric value or a character
string value. A value expression in its simplest form can be a literal, a column, or a
program variable. In a more complex form, it can be an arithmetic expression or an
aggregate function.
variable
A symbolic name used to identify a single storage sequence. Its name remains fixed
during the execution of a program; its value can change during execution. Contrast with
constant.
VDT
See view definition table.
version
Another copy of a table, which can contain different data. Many different versions of a
table can exist. Each version of the table is associated with the same storage area name
but has a different version name attached to it within that storage area definition. All
versions of a table have identical column names, primary keys, and secondary indexes
(because they share the same definition). Each version, however, can contain different
data. Data associated with each version is stored in its own file.
version-level security
The level of security that enables the owner of a table to control who has access to a
specific version of the table and which statements can access that version.
view
Synonym for relational view.
view definition
See relational view definition.
view owner
See owner.
W
work
The SQL name for a thread.
X
XPC
See Extended Processing Complex.
XRLOAD
The Unisys stand-alone utility processor that implements fast initial offline loading of
large amounts of data into an RDMS database. XRLOAD does not access UDS Control or
RDMS.
XTC
See Extended Transaction Capacity.
A columns
introduction to, 3-1
names, listing for views, 7-3
aggregate operations, 7-4
specifying (select list), 5-2
aliases in table lists, using, 5-4
COMMANDLOOKS recovery option, 10-6
ALTER TABLE statement, effect on
COMMANDSLOOKS recovery option, 4-3
views, 7-5
COMMIT statement (example), 4-4, 10-10
application group, 4-1
conceptual table, 5-7
attribute (See columns)
Condition command, IPF, 10-9
authorization-id, as owner of view, 7-1
configuration attributes
AVG function, 7-4
RDMS-DEFAULT-QUALIFIER, 7-2
RDMS-SERIALIZABLE, 8-2
Copy command, IPF, 10-9
B correlation name, 5-4
COUNT function, 7-4
backslash escape character, 11-4 CREATE SCHEMA statement
BEGIN THREAD statement authorization-id as owner of view, 7-1
examples, 4-3 schema name as default qualifier, A-2
starting a session, 4-2 view name, 7-2
BEGIN THREAD statement examples, 10-5 CREATE VIEW statement
Boolean expressions, 5-4 access privileges, 7-1
built-in functions, 7-4 examples, 7-2, 7-3
query specifications, 7-4
use, 7-1
C cross-product tables, 5-9
cursor operations, support of, 11-1
CALL statement, 11-7 cursors
canceling changes to database, 4-4 closing, 5-15
CAT command, ECL, A-1 declaring, 5-13
clauses opening, 5-14
ACCESS CONTROL, 7-1 using, 5-13
FOR, 4-2 with IPF SQL Interface, 11-1
FROM, 5-1 CUSTOMERS table, 3-2
GROUP BY, 5-2
HAVING, 5-2
IN, 8-3 D
ORDER BY, 7-1
RETRIEVE INTO, 6-3 data
VALUES, 6-2 accessing efficiently, 8-2
WHERE, 5-2 deleting, 2-2
WHERE CURRENT OF, 6-3 inserting, 2-2
WITH CHECK OPTION, 7-1, 7-6 restricting access to, 8-2
CLOSE statement (example), 5-15, 11-3 retrieving, 2-2
column names, listing for views, 7-3 updating, 2-2
E
I
embedded SQL (See ESQL)
END THREAD statement indicator variables, using with SQL, 11-7
ending a session, 4-5 INSERT statement
example, 4-5, 10-11 description of, 6-2
error messages, retrieving, 4-3 examples, 6-2
escape character, specifying (example), 10-4 views, rules for updating with, 7-5
ESQL inserting data, 2-2
description of, 9-1 interfaces
dynamic, 9-1 description of, 9-1
interpreter/ third-generation language, 9-1 ESQL, 9-1
introduction to, 2-3 interpreter/third-generation language, 9-1
IPF SQL, 9-2 IPF SQL, 9-2
module language, 9-2
*78310778-003*
7831 0778–003