Purpose
Specifies a name that can be used as a synonym for the set of data type attributes you give to the alias.
Syntax
DEFINE ALIAS [alias-name, attribute,...];
Parameters
-
alias-name
- Specifies the name that can be used wherever the explicit data type defined by the specified attributes is allowed.
- attributes
- The specified attributes for the alias. Separate each attribute with a comma(,). The attributes that can be specified are any of the attributes for variables that can be returned by a function (for example, those attributes valid in the RETURNS option and attribute). Therefore, you cannot specify an alias for an array or a structured attribute list.
- Also, as in the RETURNS option and attribute, any string lengths or area sizes must be restricted expressions.
Missing data attributes are supplied using PL/I defaults.
Example
define alias Name char(31) varying;
define alias Salary fixed dec(7); /* real by default */
define alias Zip char(5) /* nonvarying by default */
Note: Whenever Name is used in a DECLARE statement, it has the attributes
char(31) varying.
Restrictions
Using the
attributes parameter to specify an alias for a type that is defined in a DEFINE ORDINAL statement is not supported.
Alias of aliases is also not supported.
Description
An alias can be used wherever an explicit data type can be used. Using DEFINE ALIAS, you can define an alias for a collection of data attributes. This lets you assign meaningful names to data types, which can make a program easier to understand. Aliases also let you provide a shorter notation for a set of data attributes, which can decrease typographical errors.