OSQL CREATE DS Command

Purpose:  Creates a Data Set object in the current DBL with the format specified in the Schema Definition.

You must first define a Schema Definition and then execute a CREATE DS command from the ACCENT R command level to create a new Oracle table or to attach to an existing Oracle table.  The OSQL CREATE DS command may be used to automatically download the Oracle Table Definitions.

You cannot create an Oracle table until you have specified the Oracle database in which the table is located, or will be located, with the USE ORACLE SERVER command.

Syntax

CREATE DS table_name SD schema_definition_name
[ATTACH ENTRY /ONLY/ CREATE /IF MISSING/]

table_name

is the name of the Data Set entry in ACCENT R and the name of the Oracle table.

schema_definition_name

is an existing Schema Definition that describes the attributes of the Oracle table.

ATTACH

creates a Data Set object in the DBL and specifies that the table already exists in the Oracle database.  The data in the Oracle table is to be recognized as the data for the Data Set.  If the table specified by table_name does not exist in the Oracle database, ACCENT R aborts the command and displays an error message.  You must ensure that the Schema Definition matches the data in the Oracle table.

ENTRY /ONLY

creates a Data Set object in the DBL but does not check to see if an associated table exists in the Oracle database or attempt to create a new one.

CREATE /IF MISSING

creates a Data Set object in the DBL and checks to see if an associated table exists in the Oracle database.  ACCENT R creates the table in the Oracle database if the table does not exist.  If the Oracle table already exists, ACCENT R attaches it to the Data Set object in the DBL.

Example

*USE DBL BOOKS

*USE ORACLE SERVER BOOKS_ORA

PASSWORD:

*CREATE DS DISCOUNTS_ORA SD DISCOUNTS_ORA CREATE IF MISSING

This command creates a table named DISCOUNTS_ORA in the BOOKS DBL if a table with that name does not already exist.  Otherwise, the table is attached to the ACCENT R Data Set object for DISCOUNTS_ORA.  The Schema Definition for this table is shown in the previous section.  In this example, the table DISCOUNTS_ORA will be created in the current Oracle Server.

NOTES:  Be careful if you are attaching to an Oracle table with the CREATE /IF MISSING/ option or the ATTACH option.  ACCENT R cannot check the column names in the Oracle table against the field names specified in the Schema Definition.  Also, ACCENT R cannot check to see if the data types match.  Use the data type conversion table described in the previous chapter to match the data types of the columns or use the OSQL CREATE DS command to automatically read the Oracle Table Definition.

SEE ALSO:  OSQL CREATE DS

Creating and removing an Oracle Table    Remove DS Command