The following list describes the variable declaration syntax for
character data types that the SQL precompiler supports in COBOL:
o PICTURE IS can be abbreviated as PICTURE or PIC.
o CHARACTER SET character-set-name PICTURE IS.
o PICTURE clauses for numeric variables must begin with S (must
be signed) and cannot include P characters.
o PICTURE clauses cannot include editing characters.
For information about the supported character sets, see the
Oracle Rdb SQL Reference Manual.
The following list describes the variable declaration syntax that
the SQL precompiler supports in COBOL:
o PICTURE IS clause
- PICTURE IS can be abbreviated as PICTURE or PIC.
- PICTURE clauses for numeric variables must begin with S
(must be signed) and cannot include P characters.
- PICTURE clauses cannot include editing characters.
o USAGE IS clause
- USAGE IS must immediately follow a PICTURE clause.
- USAGE IS can be abbreviated as USAGE or omitted completely.
- USAGE IS must have as an argument BINARY, COMPUTATIONAL,
COMPUTATIONAL-1, COMPUTATIONAL-2, or COMPUTATIONAL-3.
COMPUTATIONAL can be abbreviated as COMP in all USAGE IS or
DISPLAY declarations. BINARY is a synonym for COMPUTATIONAL
or COMP.
o VALUE IS clause
VALUE IS can be abbreviated as VALUE and is allowed without
restriction.
o IS EXTERNAL clause
IS EXTERNAL can be abbreviated as EXTERNAL and is allowed
without restriction.
o IS GLOBAL clause
IS GLOBAL can be abbreviated as GLOBAL and is allowed without
restriction.
o SIGN clause
SIGN is allowed but must immediately follow a PICTURE clause
or a USAGE IS clause.
o Group data items
- Group data items are allowed without restriction.
- Variables associated with the SQL VARCHAR and LONG VARCHAR
data types must be declared as group data items with two
elementary items at level 49. The first elementary item
must be a small integer to contain the actual length of
the character string. The second elementary item must be a
character string long enough to contain the string itself.
* Declaration for an SQL column
* defined as VARCHAR (80):
*
01 VARYING_STRING.
49 STRING_LENGTH PIC S9(4) USAGE IS COMP.
49 STRING_TEXT PIC X(80).
o OCCURS n TIMES clause
- OCCURS clauses are permitted only for declarations of
indicator arrays. Although you can use any data type for
indicator array elements, Oracle Rdb recommends that you
declare them as integers (PIC S9(9) COMP).
- Multidimension tables (nested OCCURS clauses) and variable-
occurrence data items (OCCURS DEPENDING ON clause) are not
supported.
o REDEFINES clauses
You can refer to host language variables that have a REDEFINES
clause or that are subordinate to a REDEFINES clause.
o SQL date-time data types
- SQL_DATE, SQL_DATE_ANSI, SQL_DATE_VMS
- SQL_TIME, SQL_TIMESTAMP
- SQL_INTERVAL (DAY TO SECOND)
Use this data type for variables that represent the
difference between two dates or times. (Precompiler Date-
Time Data Mapping lists all the supported INTERVAL data
types.)
The precompiler replaces these data types with host language
data declarations that are supported in the compilers
themselves.