Pathmaker Programming Guide

Appendix C Defining Data for a NonStop
SQL Pathmaker Application
067868 Tandem Computers Incorporated C–1
NonStop SQL is a relational database management system that uses the industry
standard SQL language to define and manipulate data. You can use the Pathmaker
product to create an application that manipulates data in a NonStop SQL database.
The topic of defining data for a Pathmaker application that accesses data in a
NonStop SQL database is discussed in Section 2 of this manual. This appendix
discusses additional considerations for designing data for such an application.
Topics in this section include:
Using null values in a NonStop SQL Pathmaker application.
Using clustering keys in a NonStop SQL Pathmaker application.
Using date and time data types in a NonStop SQL Pathmaker application.
Using Null Values NonStop SQL databases can contain a value that indicates that the data for a particular
column is not applicable or is unknown. This type of value is called a null value.
When you are creating a NonStop SQL table, null values are allowed in a column,
unless you explicitly disallow them. If you do not want to permit null values in a
column, you must use the NOT NULL clause in the SQL DDL definition of the
column. The only exceptions to this rule are columns used in the primary key of a
table. A primary key cannot contain a null value, so columns that form a primary key
are created as NOT NULL, whether you explicitly include the NOT NULL clause or
not.
The format the Pathmaker product uses to generate working storage (in the requester)
and IPC definitions and logical file entries (in the server) is affected by allowing null
values. When a column can contain a null value, the Pathmaker product generates a
special structure for that column. For example, suppose you have the following SQL
DDL definition:
CREATE TABLE employee (name CHAR(20));
Because you did not specify a NOT NULL clause, the NAME column will accept null
values. The Pathmaker product will produce the following SCREEN COBOL output
in the requester context portion of the requester source code Working-Storage Section:
01 EMPLOYEE.
02 NAME.
03 INDICATOR PIC S9(4) COMP VALUE 0.
03 VALU PIC X(20)
VALUE SPACE.
INDICATOR is a flag that indicates whether the field contains a null value. If
INDICATOR = -1, the field contains a null value. VALU is the value of the field.