ALLBASE/SQL FORTRAN Application Programming Guide MPE/iX 5.0 Documentation
ALLBASE/SQL FORTRAN Application Programming Guide
Table of Contents
ALLBASE/SQL FORTRAN Application Programming Guide
ALLBASE/SQL FORTRAN Application Programming Guide : COPYRIGHT NOTICE
Ch 1. Getting Started with ALLBASE/SQL Programming in FORTRAN
ALLBASE/SQL FORTRAN Programs
Program Structure
DBEnvironment Access
Authorization
File Referencing
Native Language Support
The ALLBASE/SQL FORTRAN Preprocessor
Effect of Preprocessing on Source Code
Effect of Preprocessing on DBEnvironments
The Stored Section
Purpose of Sections
Section Validity
The Compiler and the Linker
The Executable Program
Installing the Program Module
Granting Required Owner Authorization
Granting Program User Authorization
Running the Program
Maintaining ALLBASE/SQL Programs
Updating Application Programs
Changing Program-Related Authorization
Obsoleting Programs
Ch 2. Using The ALLBASE/SQL FORTRAN Preprocessor
FORTRAN Preprocessor
Preprocessor Modes
Preprocessor Input and Output
Source File
Output File Attributes
Modified Source File
Preprocessor Input and Output (cont.)
Variable Declaration Include File
ALLBASE/SQL Message File
Installable Module File
Stored Sections
Invoking The Fortran Preprocessor
Syntax Checking Mode
Full Preprocessing Mode
Using the Preprocessor UDC's
Running the Preprocessor in Job Mode
Preprocessing Errors
Preprocessor or DBEnvironment Termination
Preprocessor Invocation Errors
Source File Errors
DBEnvironment Errors
Ch 3. Embedding SQL Commands
General Rules for Embedding SQL
Location of SQL Commands
Prefix
FORTRAN Comments
SQL Comments
Continuation Lines
Declaring the SQLCA
Declaring Host Variables
Starting a DBE Session
Defining Transactions
Implicit Status Checking
Terminating a DBE Session
Defining and Manipulating Data
Data Definition
Data Manipulation
Explicit Status Checking
Obtaining ALLBASE/SQL Messages
Ch 4. Host Variables
Using Host Variables
Host Variable Names
Input and Output Host Variables
Data Values and Null Indicators
Indicator Variables
Declaring Host Variables
Declaring Variables for Data Types
Variable Declarations
Data Types
CHARACTER Data
VARCHAR Data
SMALLINT Data
INTEGER Data
FLOAT Data
Floating Point Data Compatibility
BINARY Data
Binary Data Compatibility
Using the LONG Phrase with Binary Data Types
DECIMAL Data
DATE, TIME, DATETIME, and INTERVAL Data
Using Default Data Values
Coding Considerations
When the DEFAULT Clause Cannot be Used
Indicator Variable Declaration
Dynamic Command Variable Declaration
Savepoint Number Variable Declaration
Message Catalog Variable Declaration
DBEnvironment Name
Data Type Compatibility
Character Data Conversion
Character Data Truncation
Numeric Data Conversion
Declaring Host Variables for Data Values and Indicator Variables
Declaring Host Variables for Dynamic Commands
Declaring Host Variables for Savepoint Numbers
Declaring Host Variables for Message Catalog Messages
Declaring Host Variables Passed from Subprograms
Declaring Host Variables for MPE XL File Values
Declaring Host Variables for DBEnvironment Names
Ch 5. Runtime Status Checking and the SQLCA
The Importance of Status Checking
Handling Runtime Errors and Warnings
Maintaining Data Consistency
Determining Number of Rows Processed
The SQLCA COMMON Block
SQLCODE
SQLERRD(3)
SQLWARN(0)
SQLWARN(1)
SQLWARN(2)
SQLWARN(6)
Approaches to Status Checking
Implicit Status Checking
Implicitly Invoking Status-Checking Subprogram Units
Explicit Status Checking
Explicitly Invoking Status-Checking Subprogram Units
Explicitly Checking for Number of Rows
Using SQLErrd(3) for UPDATE and DELETE Operations
Using SQLCode of 100
Using SQLCode of -10002
Ch 6. Overview of Data Manipulation
The Query
The SELECT Command
Selecting from Multiple Tables
Selecting Using Views
Query Efficiency
Simple Data Manipulation
Introducing the Cursor
Sequential Table Processing
Dynamic Operations
Ch 7. Simple Data Manipulation
Simple Data Manipulation Commands
The SELECT Command
The INSERT Command
The DELETE Command
The UPDATE Command
Transaction Management for Simple Operations
Program Using SELECT, UPDATE, DELETE, and INSERT
Select Function
Update Function
Delete Function
Insert Function
Transaction Management for Simple Operations (cont.)
Ch 8. Processing with Cursors
Sequential Table Processing Commands
The DECLARE CURSOR Command
The OPEN Command
The FETCH Command
The UPDATE WHERE CURRENT Command
The DELETE WHERE CURRENT Command
The CLOSE Command
Transaction Management for Cursor Operations
Using KEEP CURSOR
OPEN Command Using KEEP CURSOR WITH LOCKS
OPEN Command Using KEEP CURSOR WITH NOLOCKS
KEEP CURSOR and Isolation Levels
KEEP CURSOR and BEGIN WORK
KEEP CURSOR and COMMIT WORK
KEEP CURSOR and ROLLBACK WORK
KEEP CURSOR and Aborted Transactions
Writing Keep Cursor Applications
Program Using UPDATE WHERE CURRENT
FetchUpdate Function
DisplayUpdate Subroutine
Ch 9. Using Dynamic Operations
Review of Preprocessing Events
Differences between Dynamic and Non-Dynamic Preprocessing
Permanently Stored vs. Temporary Sections
Examples of Non-Dynamic and Dynamic SQL Statements
Why Use Dynamic Preprocessing?
Passing Dynamic Commands to ALLBASE/SQL
Understanding Dynamic Operations
Preprocessing of Dynamic Non-Queries
Using EXECUTE IMMEDIATE
Using PREPARE and EXECUTE
Programs Using Dynamic Operations
Sample Program Using EXECUTE IMMEDIATE
Sample Program Using PREPARE and EXECUTE
Ch 10. Programming with Constraints
Comparing Statement Level and Row Level Integrity
Using Unique and Referential Integrity Constraints
Designing an Application Using Statement Level Integrity Checks
Insert a Member in the Recreation Database
Update an Event in the Recreation Database
Delete a Club in the Recreation Database
Delete an Event in the Recreation Database
Ch 11. Programming with LONG Columns
General Concepts
Restrictions
Defining LONG Columns with a CREATE TABLE or ALTER TABLE Command
Defining Input and Output with the LONG Column I/O String
Putting Data into a LONG Column with an INSERT Command
Insert Using Host Variables for LONG Column I/O Strings
Example Data File
Retrieving LONG Column Data with a SELECT, FETCH, or REFETCH Command
Using the LONG Column Descriptor
Example LONG Column Descriptor Declaration
Using LONG Columns with a SELECT Command
Using LONG Columns with a Dynamic FETCH Command
Changing a LONG Column with an UPDATE [WHERE CURRENT] Command
Removing LONG Column Data with a DELETE [WHERE CURRENT] Command
Coding Considerations
File versus Random Heap Space
File Naming Conventions
Considering Multiple Users
Deciding How Much Space to Allocate and Where
Ch 12. Programming with ALLBASE/SQL Functions
Programming with Date/Time Functions
Where Date/Time Functions Can Be Used
Defining and Using Host Variables with Date/Time Functions
Using Date/Time Input Functions
Examples of TO_DATETIME, TO_DATE, TO_TIME, and TO_INTERVAL Functions
Example Using the INSERT Command
Example Using the UPDATE Command
Example Using the SELECT Command
Example Using the DELETE Command
Using Date/Time Output Functions
Example TO_CHAR Function
Example TO_INTEGER Function
Using the Date/Time ADD_MONTHS Function
Example ADD_MONTHS Function
Coding Considerations
Programming with TID Data Access
Understanding TID Function Input and Output
Using the TID Function in a Select List
Using the TID Function in a WHERE Clause
Declaring TID Host Variables
Understanding the SQLTID Data Format
Transaction Management with TID Access
Comparing TID Access to Other Types of Data Access
Verifying Data that is Accessed by TID
Considering Interactive User Applications
INDEX
Index
MPE/iX 5.0 Documentation