Version 6.3.8 für Windows
 —  Parameter-Referenz  —

DBSHORT - Interpretation of Database Field Short Names

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:

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 DBSHORT=ON)

  • for the definition of a field when a view is created;

  • when a view field is used in the programming code;

  • when a DEFINE DATA LOCAL statement was previously used to defines variables;

  • when running under Natural Security.

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 DBSHORT=OFF), the program becomes independent of being compiled without Natural Security.

Default setting ON  
Dynamic specification yes  
Specification within session yes Applicable Statements: OPTIONS
Applicable Command: Either GLOBALS or DBSHORT option of COMPOPT

Examples:

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

Seitenanfang