This Natural profile and session parameter can be used to determine the
interpretation of database field short names. It corresponds to the option
DBSHORT
of the Natural system command
COMPOPT
.
A database field defined in a DDM is described by two names:
the short name with a length of 2 characters, used by Natural to communicate with the database (especially with Adabas);
the long name with a length of 3-32 characters (1-32 characters, if the underlying database type accessed is DB2/SQL), which is supposed to be used to reference the field in the Natural programming code.
Under special conditions, you may reference a database field in a Natural program with its short name instead of the long name. This applies if running in Reporting Mode without Natural Security and if the database access statement contains a reference to a DDM instead of a view.
The decision if a field name is regarded as a short-name reference
depends on the name length. When the field identifier consists of two
characters, a short-name reference is assumed; a field name with another length
is considered as a long-name reference. This standard interpretation rule for
database fields can additionally be influenced and controlled by setting the
compiler option DBSHORT
to ON
or OFF
:
Possible settings | ON |
The usage of a short name is allowed for referencing a database field. However, a data base short name is not permitted in general
(even if
|
|
---|---|---|---|
OFF |
A database field may only be referenced via its long name. Every database field identifier is considered as a long-name reference, regardless of its length. If a two character name is supplied which can only be found as a short name but not as a long name, syntax error NAT0981 is raised at compile time. This makes it possible to use long names defined in a DDM with 2-byte identifier length. This option is essential if the underlying database you access with this DDM is SQL (DB2) and table columns with a two character name exist. For all other database types (for example, Adabas), however, any attempt to define a long field with a 2-byte name length will be rejected at DDM generation. Moreover, if no short-name references are used (what can be enforced
via |
||
Default setting | ON |
||
Dynamic specification | yes | ||
Specification within session | yes | Applicable Statements: | OPTIONS |
Applicable Command: | Either
GLOBALS or
DBSHORT option of
COMPOPT |
Assume the following data base field definition in the DDM
EMPLOYEES
:
Short Name | Long Name |
---|---|
AA |
PERSONNEL-ID |
Example 1:
OPTIONS DBSHORT=ON READ EMPLOYEES DISPLAY AA /* data base short name AA is allowed END
Example 2:
OPTIONS DBSHORT=OFF READ EMPLOYEES DISPLAY AA /* syntax error NAT0981, because DBSHORT=OFF END
Example 3:
OPTIONS DBSHORT=ON DEFINE DATA LOCAL 1 V1 VIEW OF EMPLOYEES 2 PERSONNEL-ID END-DEFINE READ V1 BY PERSONNEL-ID DISPLAY AA /* syntax error NAT0981, because PERSONNEL-ID is defined in view; /* (even if DBSHORT=ON) END-READ END